ContactsInterface
public class ContactsInterface : ContactsInterfaceProtocol
Provides a basic mechanism for interacting with the Contacts framework.
Conforms to the ContactsInterfaceProtocol protocol.
Seealso
ContactsHandler
-
Initialize object with the
CNContactStoreand a fetch request.If the contact store is not provided a new one is created. The fetch request is used for contacts removal. If not provided, the default fetch request will be used which will match to all contacts on a device.
Declaration
Swift
public init(contactStore: CNContactStore = CNContactStore(), fetchRequest: CNContactFetchRequest? = nil)Parameters
contactStoreA contact store used to communicate.
fetchRequestA fetch request used for contacts removal.
-
Adds all contacts to the
CNContactStore.Declaration
Swift
public func addAll(_ contacts: [CNMutableContact], completion: @escaping ContactsInterfaceProtocol.CompletionBlock)Parameters
contactsList of contacts.
completionCompletion closure called after contacts were saved to the store.
-
Remove all contacts from the
CNContactStore.Declaration
Swift
public func removeAll(completion: @escaping ContactsInterfaceProtocol.CompletionBlock)Parameters
completionCompletion closure called after contacts were removed from the store.
-
Request access to the
Contactsframework.Declaration
Swift
public func requestAccess(completion: @escaping ContactsInterfaceProtocol.CompletionBlock)Parameters
completionCompletion closure.
ContactsInterface Class Reference