Fetch contact list with filter(mail, phone number) easy and quickly just with single protocol.
These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.
- Xcode 10+
- Swift 4.2+
##Create Enum for filter
enum ContactsFilter {
case none
case mail
case phoneNumber
}
class ViewController: UIViewController,PhoneContactProtocol {
}
func setFilter(contacts: [ContactModel]) {
for c in contacts {
print(c.name)
}
}
self.fetchContacts(filter: .phoneNumber)