Deleting Contact from CNContactViewController(for: selectedContact) does not dismiss the contact card

Hi,

I have an app when the user taps the row of a cell it takes them to the iOS Contact card for that person where they can call the person or edit the contact. But when I tap edit then delete the contact Contact card just sits there. I would expect it to dismiss.

This is the code I used in the didSeletCell which takes them to the card.

Code Block
do {
selectedContact = try self.contactsStore.unifiedContact(withIdentifier: user.contactID, keysToFetch: [CNContactViewController.descriptorForRequiredKeys()])
let contactViewController = CNContactViewController(for: selectedContact)
contactViewController.delegate = self
contactViewController.hidesBottomBarWhenPushed = true
contactViewController.allowsEditing = true
contactViewController.allowsActions = true
selectedContactID = selectedContact.identifier
navigationController?.navigationBar.backgroundColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0)
navigationController?.pushViewController(contactViewController, animated: true)
} catch let error {
print(error)
}


The app just sits there, in the simulator until I click the cancel button at the top. The contact is gone however.
Deleting Contact from CNContactViewController(for: selectedContact) does not dismiss the contact card
 
 
Q