Documentation Archive Developer
Search

AddressBook Changes for Swift

AddressBook

Removed ABPeoplePickerSelectionBehavior.value
Added ABPeoplePickerSelectionBehavior.init(rawValue: UInt32)
Added ABPeoplePickerSelectionBehavior.rawValue
Modified ABAddressBook
Declaration
From
class ABAddressBook : NSObject {
    class func sharedAddressBook() -> ABAddressBook!
    init!() -> ABAddressBook
    class func addressBook() -> ABAddressBook!
    func recordsMatchingSearchElement(_ search: ABSearchElement!) -> [AnyObject]!
    func save() -> Bool
    func saveAndReturnError(_ error: NSErrorPointer) -> Bool
    func hasUnsavedChanges() -> Bool
    func me() -> ABPerson!
    func setMe(_ moi: ABPerson!)
    func recordForUniqueId(_ uniqueId: String!) -> ABRecord!
    func addRecord(_ record: ABRecord!, error error: NSErrorPointer) -> Bool
    func addRecord(_ record: ABRecord!) -> Bool
    func removeRecord(_ record: ABRecord!, error error: NSErrorPointer) -> Bool
    func removeRecord(_ record: ABRecord!) -> Bool
    func people() -> [AnyObject]!
    func groups() -> [AnyObject]!
    func recordClassFromUniqueId(_ uniqueId: String!) -> String!
    func formattedAddressFromDictionary(_ address: [NSObject : AnyObject]!) -> NSAttributedString!
    func defaultCountryCode() -> String!
    func defaultNameOrdering() -> Int
}
To
class ABAddressBook : NSObject {
    class func sharedAddressBook() -> ABAddressBook!
     init!()
    class func addressBook() -> ABAddressBook!
    func recordsMatchingSearchElement(_ search: ABSearchElement!) -> [AnyObject]!
    func save() -> Bool
    func saveAndReturnError() throws
    func hasUnsavedChanges() -> Bool
    func me() -> ABPerson!
    func setMe(_ moi: ABPerson!)
    func recordForUniqueId(_ uniqueId: String!) -> ABRecord!
    func addRecord(_ record: ABRecord!, error error: ()) throws
    func addRecord(_ record: ABRecord!) -> Bool
    func removeRecord(_ record: ABRecord!, error error: ()) throws
    func removeRecord(_ record: ABRecord!) -> Bool
    func people() -> [AnyObject]!
    func groups() -> [AnyObject]!
    func recordClassFromUniqueId(_ uniqueId: String!) -> String!
    func formattedAddressFromDictionary(_ address: [NSObject : AnyObject]!) -> NSAttributedString!
    func defaultCountryCode() -> String!
    func defaultNameOrdering() -> Int
}

Declaration
From
func addRecord(_ record: ABRecord!, error error: NSErrorPointer) -> Bool
To
func addRecord(_ record: ABRecord!, error error: ()) throws

Declaration
From
func removeRecord(_ record: ABRecord!, error error: NSErrorPointer) -> Bool
To
func removeRecord(_ record: ABRecord!, error error: ()) throws

Declaration
From
func saveAndReturnError(_ error: NSErrorPointer) -> Bool
To
func saveAndReturnError() throws

DeclarationProtocols
From
struct ABPeoplePickerSelectionBehavior {
    init(_ value: UInt32)
    var value: UInt32
}
--
To
struct ABPeoplePickerSelectionBehavior : RawRepresentable {
    init(_ rawValue: UInt32)
    init(rawValue rawValue: UInt32)
    var rawValue: UInt32
}
RawRepresentable

Modified ABRecord
Declaration
From
class ABRecord : NSObject {
    init!()
    init!(addressBook addressBook: ABAddressBook!)
    func valueForProperty(_ property: String!) -> AnyObject!
    func setValue(_ value: AnyObject!, forProperty property: String!, error error: NSErrorPointer) -> Bool
    func setValue(_ value: AnyObject!, forProperty property: String!) -> Bool
    func removeValueForProperty(_ property: String!) -> Bool
    func isReadOnly() -> Bool
}
extension ABRecord {
    var uniqueId: String! { get }
    var displayName: String! { get }
}
To
class ABRecord : NSObject {
    init!()
    init!(addressBook addressBook: ABAddressBook!)
    func valueForProperty(_ property: String!) -> AnyObject!
    func setValue(_ value: AnyObject!, forProperty property: String!, error error: ()) throws
    func setValue(_ value: AnyObject!, forProperty property: String!) -> Bool
    func removeValueForProperty(_ property: String!) -> Bool
    func isReadOnly() -> Bool
}
extension ABRecord {
    var uniqueId: String! { get }
    var displayName: String! { get }
}

Declaration
From
func setValue(_ value: AnyObject!, forProperty property: String!, error error: NSErrorPointer) -> Bool
To
func setValue(_ value: AnyObject!, forProperty property: String!, error error: ()) throws

Declaration
From
class ABSearchElement : NSObject {
    init!(forConjunction conjuction: ABSearchConjunction, children children: [AnyObject]!) -> ABSearchElement
    class func searchElementForConjunction(_ conjuction: ABSearchConjunction, children children: [AnyObject]!) -> ABSearchElement!
    func matchesRecord(_ record: ABRecord!) -> Bool
}
To
class ABSearchElement : NSObject {
     init!(forConjunction conjuction: ABSearchConjunction, children children: [AnyObject]!)
    class func searchElementForConjunction(_ conjuction: ABSearchConjunction, children children: [AnyObject]!) -> ABSearchElement!
    func matchesRecord(_ record: ABRecord!) -> Bool
}

Declaration
From
init!(forConjunction conjuction: ABSearchConjunction, children children: [AnyObject]!) -> ABSearchElement
To
init!(forConjunction conjuction: ABSearchConjunction, children children: [AnyObject]!)

Declaration
From
func ABBeginLoadingImageDataForClient(_ person: ABPerson!, _ callback: ABImageClientCallback, _ refcon: UnsafeMutablePointer<Void>) -> CFIndex
To
func ABBeginLoadingImageDataForClient(_ person: ABPerson!, _ callback: ABImageClientCallback!, _ refcon: UnsafeMutablePointer<Void>) -> CFIndex

Declaration
From
typealias ABImageClientCallback = CFunctionPointer<((CFData!, CFIndex, UnsafeMutablePointer<Void>) -> Void)>
To
typealias ABImageClientCallback = (CFData!, CFIndex, UnsafeMutablePointer<Void>) -> Void