Swift – Checking unmanaged address book single value property for nil

If I want the values associated with various properties, I use the following syntax: let first = ABRecordCopyValue(person, kABPersonFirstNameProperty)?.takeRetainedValue() as? String let last = ABRecordCopyValue(person, kABPersonLastNameProperty)?.takeRetainedValue() as? String Or you can use optional binding: if let first = ABRecordCopyValue(person, kABPersonFirstNameProperty)?.takeRetainedValue() as? String { // use `first` here } if let last = ABRecordCopyValue(person, kABPersonLastNameProperty)?.takeRetainedValue() as? … Read more