While trying to integrate the Address Book framework and converting CF types to NS Classes to Swift classes, I noticed something strange:
ABRecordCopyCompositeName(record)?.takeRetainedValue() as? NSString
returns nil
ABRecordCopyCompositeName(record)?.takeRetainedValue() as NSString?
returns Optional("John Smith")
My question is that isn't as? NSString
synonymous to as NSString? as? NSString
? (If so, why not?)
Therefore,
ABRecordCopyCompositeName(record)?.takeRetainedValue() as? NSString
should be equivalent to
ABRecordCopyCompositeName(record)?.takeRetainedValue() as NSString? as? NSString
which should return "John Smith".
(This was working on iOS 8.3, but iOS 8.4 broke my AddressBook feature.)