From 00ea885e330a538909639ef72024a26b996f3066 Mon Sep 17 00:00:00 2001 From: Satish Babariya Date: Tue, 12 Dec 2017 10:57:41 +0530 Subject: [PATCH] Minor Changes --- SwiftyContacts/Classes/SwiftyContacts.swift | 61 +++++++++++---------- fastlane/README.md | 6 +- fastlane/report.xml | 22 ++++---- 3 files changed, 47 insertions(+), 42 deletions(-) diff --git a/SwiftyContacts/Classes/SwiftyContacts.swift b/SwiftyContacts/Classes/SwiftyContacts.swift index 97fe1b2..83eb6e1 100644 --- a/SwiftyContacts/Classes/SwiftyContacts.swift +++ b/SwiftyContacts/Classes/SwiftyContacts.swift @@ -56,6 +56,7 @@ public enum ContactsFetchResult { /// Fetching Contacts from phone /// - parameter completionHandler: Returns Either [CNContact] or Error. + public func fetchContacts( completionHandler : @escaping (_ result : ContactsFetchResult) -> ()){ let contactStore : CNContactStore = CNContactStore() @@ -76,6 +77,7 @@ public func fetchContacts( completionHandler : @escaping (_ result : ContactsFet /// - Parameters: /// - sortOrder: To return contacts in a specific sort order. /// - completionHandler: Result Handler +@available(iOS 10.0, *) public func fetchContacts(ContactsSortorder sortOrder:CNContactSortOrder, completionHandler : @escaping (_ result : ContactsFetchResult) -> ()){ let contactStore : CNContactStore = CNContactStore() @@ -96,35 +98,36 @@ public func fetchContacts(ContactsSortorder sortOrder:CNContactSortOrder, comple /// etching Contacts from phone with Grouped By Alphabet /// -/// - Parameter completionHandler: It will return Dictonary of Alphabets with Their Sorted Respective Contacts -public func fetchContactsGroupedByAlphabets( completionHandler : @escaping (_ result : [String: [CNContact]],Error?) -> ()){ - - let fetchRequest: CNContactFetchRequest = CNContactFetchRequest(keysToFetch: [CNContactVCardSerialization.descriptorForRequiredKeys()]) - var orderedContacts: [String: [CNContact]] = [String: [CNContact]]() - CNContact.localizedString(forKey: CNLabelPhoneNumberiPhone) - fetchRequest.mutableObjects = false - fetchRequest.unifyResults = true - fetchRequest.sortOrder = .givenName - do { - try CNContactStore().enumerateContacts(with: fetchRequest, usingBlock: { (contact, _) -> Void in - // Ordering contacts based on alphabets in firstname - var key: String = "#" - // If ordering has to be happening via family name change it here. - if let firstLetter = contact.givenName[0..<1], firstLetter.containsAlphabets() { - key = firstLetter.uppercased() - } - var contacts = [CNContact]() - if let segregatedContact = orderedContacts[key] { - contacts = segregatedContact - } - contacts.append(contact) - orderedContacts[key] = contacts - }) - } catch { - completionHandler(orderedContacts, error) - } - completionHandler(orderedContacts,nil) -} +/// - Parameter completionHandler: It will return Dictonary of Alphabets with Their Sorted Respective Contacts. +//@available(iOS 10.0, *) +//public func fetchContactsGroupedByAlphabets( completionHandler : @escaping (_ result : [String: [CNContact]],Error?) -> ()){ +// +// let fetchRequest: CNContactFetchRequest = CNContactFetchRequest(keysToFetch: [CNContactVCardSerialization.descriptorForRequiredKeys()]) +// var orderedContacts: [String: [CNContact]] = [String: [CNContact]]() +// CNContact.localizedString(forKey: CNLabelPhoneNumberiPhone) +// fetchRequest.mutableObjects = false +// fetchRequest.unifyResults = true +// fetchRequest.sortOrder = .givenName +// do { +// try CNContactStore().enumerateContacts(with: fetchRequest, usingBlock: { (contact, _) -> Void in +// // Ordering contacts based on alphabets in firstname +// var key: String = "#" +// // If ordering has to be happening via family name change it here. +// if let firstLetter = contact.givenName[0..<1], firstLetter.containsAlphabets() { +// key = firstLetter.uppercased() +// } +// var contacts = [CNContact]() +// if let segregatedContact = orderedContacts[key] { +// contacts = segregatedContact +// } +// contacts.append(contact) +// orderedContacts[key] = contacts +// }) +// } catch { +// completionHandler(orderedContacts, error) +// } +// completionHandler(orderedContacts,nil) +//} /// Fetching Contacts from phone /// - parameter completionHandler: Returns Either [CNContact] or Error. diff --git a/fastlane/README.md b/fastlane/README.md index 4613f90..69600af 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -12,9 +12,9 @@ xcode-select --install - + + diff --git a/fastlane/report.xml b/fastlane/report.xml index 8f1fbfb..9a9823e 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,52 +5,54 @@ - + - + - + - + - + - + - + - + - + - + + +
Homebrew -Installer Script -Rubygems +HomebrewInstaller ScriptRubyGems
macOS