EKEventStore+Extensions.swift 487 B

1234567891011121314151617181920
  1. // LoopFollow
  2. // EKEventStore+Extensions.swift
  3. import EventKit
  4. import Foundation
  5. extension EKEventStore {
  6. func requestCalendarAccess(completion: @escaping (Bool, Error?) -> Void) {
  7. if #available(iOS 17, *) {
  8. requestFullAccessToEvents { granted, error in
  9. completion(granted, error)
  10. }
  11. } else {
  12. requestAccess(to: .event) { granted, error in
  13. completion(granted, error)
  14. }
  15. }
  16. }
  17. }