diff --git a/Demo/Views/ContactView.swift b/Demo/Views/ContactView.swift index b58948b..4239074 100644 --- a/Demo/Views/ContactView.swift +++ b/Demo/Views/ContactView.swift @@ -9,7 +9,7 @@ struct ContactView: View { @State private var error: Error? // We just pass along the identifier and then lets the property wrapper handle the fetch and observation - init(identifier: CNContact.ID) { + init(identifier: String) { _contact = FetchContact( idenfifier: identifier, keysToFetch: .allExcludingNote diff --git a/Sources/Connections/Support/Identifiable.swift b/Sources/Connections/Support/Identifiable.swift index f2b297a..2ed0f9c 100644 --- a/Sources/Connections/Support/Identifiable.swift +++ b/Sources/Connections/Support/Identifiable.swift @@ -1,8 +1,14 @@ import Foundation import Contacts -extension CNContact { - public var id: String { identifier } +@available(iOS, obsoleted: 16, message: "Contacts module includes it in iOS17+, macOS14+") +@available(macOS, obsoleted: 14, message: "Contacts module includes it in iOS17+, macOS14+") +extension CNContact: Identifiable { + public typealias ID = UUID + public var id: UUID { + UUID(uuidString: identifier.replacingOccurrences(of: ":ABPerson", with: ""))! + } + } extension CNGroup: Identifiable {