I have an application that consists of a tab bar, and one of the tab items is titled "Contacts". When the user selects this item, I would like to present them right away with the CNContactPickerViewController
. Currently, I have a controller, ContactsController
, set for the tab item for "Contacts". When the view is loaded, this code is run in the viewWillAppear
method:
override func viewWillAppear(animated: Bool) {
let contactPicker = CNContactPickerViewController()
contactPicker.delegate = self
contactPicker.navigationItem.rightBarButtonItem = nil
self.presentViewController(contactPicker, animated: false, completion: nil)
super.viewWillAppear(animated)
}
I feel like this is inefficient, as I have to load a view, only to present another view. I have tried searching around to see if there is any possibility I could convert my ContactsController
from a UIViewController
to a CNContactPickerViewController
, but had no luck. The default phone application for the iPhone has exactly the feature I am looking for when you select contacts. Is there anyway to recreate this? Thanks!