forked from loopandlearn/LoopFollow
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request loopandlearn#208 from loopandlearn/ios17-calendar
Preparation for ios17 calendar access
- Loading branch information
Showing
6 changed files
with
184 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// | ||
// EKEventStore+Extensions.swift | ||
// LoopFollow | ||
// | ||
// Created by Jonas Björkert on 2023-07-27. | ||
// Copyright © 2023 Jon Fawcett. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import EventKit | ||
|
||
#if swift(>=5.9) | ||
extension EKEventStore { | ||
func requestCalendarAccess(completion: @escaping (Bool, Error?) -> Void) { | ||
if #available(iOS 17, *) { | ||
requestFullAccessToEvents { (granted, error) in | ||
completion(granted, error) | ||
} | ||
} else { | ||
requestAccess(to: .event) { (granted, error) in | ||
completion(granted, error) | ||
} | ||
} | ||
} | ||
} | ||
#else | ||
extension EKEventStore { | ||
func requestCalendarAccess(completion: @escaping (Bool, Error?) -> Void) { | ||
requestAccess(to: .event) { (granted, error) in | ||
completion(granted, error) | ||
} | ||
} | ||
} | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.