Skip to content

Commit 4b4e6cf

Browse files
committed
Check NSUbiquitousKeyValueStore availability
1 parent 6c4d212 commit 4b4e6cf

File tree

4 files changed

+12
-2
lines changed

4 files changed

+12
-2
lines changed

Sources/Defaults+Syncing.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
// SOFTWARE.
2323
//
2424

25-
#if !os(Linux)
25+
#if !os(Linux) && !os(watchOS)
2626

2727
public extension DefaultsAdapter {
2828

Sources/Defaults.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ internal extension UserDefaults {
8383
}
8484
}
8585

86+
#if !os(Linux) && !os(watchOS)
87+
8688
// MARK: - NSUbiquitousKeyValueStore
8789

8890
public extension NSUbiquitousKeyValueStore {
@@ -107,3 +109,5 @@ public extension NSUbiquitousKeyValueStore {
107109
synchronize()
108110
}
109111
}
112+
113+
#endif

Sources/DefaultsAdapter.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,18 @@ public struct DefaultsAdapter<KeyStore: DefaultsKeyStore> {
4545

4646
public let defaults: UserDefaults
4747
public let keyStore: KeyStore
48+
49+
#if !os(Linux) && !os(watchOS)
4850
internal let syncer: DefaultsSyncer
51+
#endif
4952

5053
public init(defaults: UserDefaults, keyStore: KeyStore) {
5154
self.defaults = defaults
5255
self.keyStore = keyStore
56+
57+
#if !os(Linux) && !os(watchOS)
5358
self.syncer = DefaultsSyncer(defaults: defaults)
59+
#endif
5460
}
5561

5662
@available(*, unavailable)

Sources/DefaultsSyncer.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2222
// SOFTWARE.
2323
//
24-
#if !os(Linux)
24+
#if !os(Linux) && !os(watchOS)
2525

2626
import Foundation
2727

0 commit comments

Comments
 (0)