import Contacts // import these framework
import ContactsUI
//--- Your Button Action
@IBAction func buttonClick(_ sender: Any)
{
let openContact = CNContact()
let vc = CNContactViewController(forNewContact: openContact)
vc.delegate = self // this delegate CNContactViewControllerDelegate
// self.navigationController?.pushViewController(vc, animated: true)
self.present(UINavigationController(rootViewController: vc), animated:true)
}
func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) {
self.dismiss(animated: true, completion: nil)
}