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

Support watchOS 9 #60

Merged
merged 3 commits into from
Jul 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PackageDescription

let package = Package(
name: "Zephyr",
platforms: [.iOS(.v11), .tvOS(.v11)],
platforms: [.iOS(.v11), .tvOS(.v11), .watchOS("9.0")],
ArtSabintsev marked this conversation as resolved.
Show resolved Hide resolved
products: [.library(name: "Zephyr", targets: ["Zephyr"])],
targets: [.target(name: "Zephyr", path: "Sources")],
swiftLanguageVersions: [.v5]
Expand Down
10 changes: 10 additions & 0 deletions Sources/Zephyr.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
import Foundation
#if os(iOS) || os(tvOS)
import UIKit
#elseif os(watchOS)
import WatchKit
#endif

/// Enumerates the Local (`UserDefaults`) and Remote (`NSUNSUbiquitousKeyValueStore`) data stores
Expand Down Expand Up @@ -234,6 +236,14 @@ private extension Zephyr {
name: UIApplication.willEnterForegroundNotification,
object: nil)
#endif

#if os(watchOS)
if #available(watchOS 9.0, *) {
NotificationCenter.default.addObserver(self, selector: #selector(willEnterForeground(notification:)),
name: WKExtension.applicationWillEnterForegroundNotification,
object: nil)
}
#endif
}

/// Compares the last sync date between `NSUbiquitousKeyValueStore` and `UserDefaults`.
Expand Down
1 change: 1 addition & 0 deletions Zephyr.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Pod::Spec.new do |s|
# Deployment
s.ios.deployment_target = '11.0'
s.tvos.deployment_target = '11.0'
s.watchos.deployment_target = '9.0'

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