Closed alexanderpuchta closed 1 year ago
closed because of #321
I think your solution cleaner. So we can move on with it
i have updated the README file with help of #321 and added available iOS 17 only like suggested in https://github.com/sparrowcode/PermissionsKit/pull/321#discussion_r1338245557 @ivanvorobei
open var usageDescriptionKey: String? {
if #available(iOS 17, *) {
switch kind {
case .calendar(let access):
switch access {
case .full:
return "NSCalendarsFullAccessUsageDescription"
case .write:
return "NSCalendarsWriteOnlyAccessUsageDescription"
}
default:
fatalError()
}
} else {
return "NSCalendarsUsageDescription"
}
}
Updated permission access level to enum. For calendar it's CalendarAccess
. As well
drop @available(iOS 17.0, *)
for calendar permission becouse no reason to have it. If dev asking write only it mean he want have full access on iOS 16.
next merged 2 calendar permission to one calendar + access value
public extension Permission {
static func calendar(access: CalendarAccess) -> CalendarPermission {
CalendarPermission(kind: .calendar(access: access))
}
}
Goal
with iOS 17 there are two new methods to request access for calendars.
requestWriteOnlyAccessToEvents
->.calendarWriteOnly
requestFullAccessToEvents
->.calendar