Created
February 5, 2020 13:03
-
-
Save gustafnilklint/9ee7356f4c1d31406bc9774679592e93 to your computer and use it in GitHub Desktop.
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
func handle(_ backgroundTasks: Set<WKRefreshBackgroundTask>) { | |
for task in backgroundTasks { | |
switch task { | |
case let backgroundTask as WKApplicationRefreshBackgroundTask: | |
BackgroundService.shared.updateContent() | |
backgroundTask.setTaskCompletedWithSnapshot(false) | |
case let urlSessionTask as WKURLSessionRefreshBackgroundTask: | |
BackgroundService.shared.handleDownload(urlSessionTask) | |
default: | |
task.setTaskCompletedWithSnapshot(false) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment