I'm trying to open CNContactViewController for creating a new contact from a NavigationView. So far this is what I've tried and failed:
- Added a navigation bar item and set the destination
.navigationBarItems(trailing:
NavigationLink(destination: self.addContact()) {
Text("Add")
}
)
addContactfunction returns the new view
func addContact() -> CNContactViewController {
let con = CNContact()
let vc = CNContactViewController(forNewContact: con)
return vc
}
Unfortunately this doesn't seem to be working. I'm pretty new to iOS and SwiftUI and I'm not sure if this is the way to do it, any help would be appreciated!