Skip to content

Commit

Permalink
use the new method to get access to calendar events
Browse files Browse the repository at this point in the history
  • Loading branch information
kvyatkovskys committed Sep 11, 2023
1 parent 5c4d8e6 commit fa5e7cc
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion KVKCalendar.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = 'KVKCalendar'
s.version = '0.6.15'
s.version = '0.6.16'
s.summary = 'A most fully customization calendar for Apple platforms.'

s.description = <<-DESC
Expand Down
16 changes: 12 additions & 4 deletions Sources/KVKCalendar/KVKCalendarView+Extension.swift
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,20 @@ extension KVKCalendarView {
private func requestAccessSystemCalendars(_ calendars: Set<String>,
store: EKEventStore,
completion: @escaping (Bool) -> Void) {
let status = EKEventStore.authorizationStatus(for: .event)

store.requestAccess(to: .event) { (access, error) in
print("System calendars = \(calendars) - access = \(access), error = \(error?.localizedDescription ?? "nil"), status = \(status.rawValue)")
func proxyCompletion(access: Bool, status: EKAuthorizationStatus, error: Error?) {
print("System calendars = \(calendars) - access = \(access), error = \(error?.localizedDescription ?? "nil"), status = \(status)")
completion(access)
}
let status = EKEventStore.authorizationStatus(for: .event)
if #available(iOS 17.0, *) {
store.requestFullAccessToEvents { (access, error) in
proxyCompletion(access: access, status: status, error: error)
}
} else {
store.requestAccess(to: .event) { (access, error) in
proxyCompletion(access: access, status: status, error: error)
}
}
}

private func switchCalendarType(_ type: CalendarType) {
Expand Down

0 comments on commit fa5e7cc

Please sign in to comment.