Skip to content
This repository was archived by the owner on Aug 29, 2024. It is now read-only.

Commit 7da0a5a

Browse files
Support watchOS 9 (#60)
1 parent f3feb4b commit 7da0a5a

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import PackageDescription
33

44
let package = Package(
55
name: "Zephyr",
6-
platforms: [.iOS(.v11), .tvOS(.v11)],
6+
platforms: [.iOS(.v11), .tvOS(.v11), .watchOS("9.0")],
77
products: [.library(name: "Zephyr", targets: ["Zephyr"])],
88
targets: [.target(name: "Zephyr", path: "Sources")],
99
swiftLanguageVersions: [.v5]

Sources/Zephyr.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import Foundation
1010
#if os(iOS) || os(tvOS)
1111
import UIKit
12+
#elseif os(watchOS)
13+
import WatchKit
1214
#endif
1315

1416
/// Enumerates the Local (`UserDefaults`) and Remote (`NSUNSUbiquitousKeyValueStore`) data stores
@@ -234,6 +236,14 @@ private extension Zephyr {
234236
name: UIApplication.willEnterForegroundNotification,
235237
object: nil)
236238
#endif
239+
240+
#if os(watchOS)
241+
if #available(watchOS 9.0, *) {
242+
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(notification:)),
243+
name: WKExtension.applicationWillEnterForegroundNotification,
244+
object: nil)
245+
}
246+
#endif
237247
}
238248

239249
/// Compares the last sync date between `NSUbiquitousKeyValueStore` and `UserDefaults`.

Zephyr.podspec

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Pod::Spec.new do |s|
1616
# Deployment
1717
s.ios.deployment_target = '11.0'
1818
s.tvos.deployment_target = '11.0'
19+
s.watchos.deployment_target = '9.0'
1920

2021
# Sources
2122
s.source = { :git => "https://github.com/ArtSabintsev/Zephyr.git", :tag => s.version.to_s }

0 commit comments

Comments
 (0)