Skip to content

Commit

Permalink
Merge pull request #352 from EchoLunar/EchoLunar-patch-1
Browse files Browse the repository at this point in the history
Adapt ContactsPermission to iOS 18
  • Loading branch information
ivanvorobei authored Sep 27, 2024
2 parents 982bb42 + e6a501b commit 7fd4d6c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Sources/ContactsPermission/ContactsPermission.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ public class ContactsPermission: Permission {
open var usageDescriptionKey: String? { "NSContactsUsageDescription" }

public override var status: Permission.Status {
switch CNContactStore.authorizationStatus(for: .contacts) {
let authorizationStatus = CNContactStore.authorizationStatus(for: .contacts)
if #available(iOS 18.0, *), authorizationStatus == .limited {
return .authorized
}
switch authorizationStatus {
case .authorized: return .authorized
case .denied: return .denied
case .notDetermined: return .notDetermined
Expand Down

0 comments on commit 7fd4d6c

Please sign in to comment.