Skip to content

Commit

Permalink
Improvements for contact adding
Browse files Browse the repository at this point in the history
  • Loading branch information
nvh committed Aug 24, 2024
1 parent 4903fa1 commit 5372e5c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 11 additions & 3 deletions SwiftIslandApp/Pages/Practical/NFC/ContactViewConroller.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,19 @@
import SwiftUI
import ContactsUI

struct ContactViewConroller: UIViewControllerRepresentable {
@objc class ContactViewControllerDelegate: NSObject, CNContactViewControllerDelegate {
func contactViewController(_ viewController: CNContactViewController, didCompleteWith contact: CNContact?) {

}
}

struct ContactViewConroller: UIViewControllerRepresentable {
let contact: CNContact
func makeUIViewController(context: Context) -> UIViewController {
let viewController = CNContactViewController(forNewContact: contact)

let viewController = CNContactViewController(forUnknownContact: contact)
viewController.contactStore = CNContactStore()
viewController.allowsActions = true
viewController.allowsEditing = true
return viewController
}

Expand Down
6 changes: 5 additions & 1 deletion SwiftIslandApp/Pages/Practical/NFC/NFCPageView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ struct NFCPageView: View {
contactToSave = nil
}) {
if let contact = contactToSave {
ContactViewConroller(contact: contact.CNContact)
NavigationStack {
ContactViewConroller(contact: contact.CNContact)
.navigationTitle("Contact")
}

}
}
}
Expand Down

0 comments on commit 5372e5c

Please sign in to comment.