How can i append my HKObjectTypes into a NSSet.
It always returns empty. Any better way???
func getPermsFromOptions(_ options: NSArray) -> NSSet {
var readPermSet = NSSet()
var optionKey: String
var val: HKObjectType
for i in options{
optionKey = i as! String
val = HKObjectType.quantityType(forIdentifier: HKQuantityTypeIdentifier(rawValue: optionKey))!
readPermSet.adding(val)
print("set", readPermSet) //always empty
}
return readPermSet;
}
var readPermSet = NSSet()=>var readPermSet = NSMutabmeSet()and then,readPermSet.add(val), but why do you keep usingNSArrayandNSSet? Can't you use SwiftSetandArrayinstead?