From ea11b7ac4f5d006fe46d00b428631a064445990d Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Fri, 18 Nov 2022 15:52:52 +0700 Subject: [PATCH] Target macOS 10.15, iOS 13, tvOS 13, watchOS 6 --- Package.swift | 8 +- Sources/Defaults/Defaults.swift | 2 + Sources/Defaults/Observation+Combine.swift | 4 - Sources/Defaults/SwiftUI.swift | 7 -- .../DefaultsAnySeriliazableTests.swift | 2 - Tests/DefaultsTests/DefaultsArrayTests.swift | 2 - .../DefaultsCodableEnumTests.swift | 4 - .../DefaultsTests/DefaultsCodableTests.swift | 4 - ...DefaultsCollectionCustomElementTests.swift | 4 - .../DefaultsCollectionTests.swift | 4 - .../DefaultsCustomBridgeTests.swift | 4 - .../DefaultsDictionaryTests.swift | 2 - Tests/DefaultsTests/DefaultsEnumTests.swift | 4 - .../DefaultsTests/DefaultsNSColorTests.swift | 4 - .../DefaultsNSSecureCodingTests.swift | 106 ++++++++---------- ...DefaultsSetAlgebraCustomElementTests.swift | 4 - .../DefaultsSetAlgebraTests.swift | 4 - Tests/DefaultsTests/DefaultsTests.swift | 12 -- .../DefaultsTests/DefaultsUIColorTests.swift | 4 - readme.md | 12 +- 20 files changed, 59 insertions(+), 138 deletions(-) diff --git a/Package.swift b/Package.swift index c0934cd..758fa4d 100644 --- a/Package.swift +++ b/Package.swift @@ -4,10 +4,10 @@ import PackageDescription let package = Package( name: "Defaults", platforms: [ - .macOS(.v10_13), - .iOS(.v12), - .tvOS(.v12), - .watchOS(.v5) + .macOS(.v10_15), + .iOS(.v13), + .tvOS(.v13), + .watchOS(.v6) ], products: [ .library( diff --git a/Sources/Defaults/Defaults.swift b/Sources/Defaults/Defaults.swift index 6981ebf..58e85ba 100644 --- a/Sources/Defaults/Defaults.swift +++ b/Sources/Defaults/Defaults.swift @@ -75,6 +75,8 @@ extension Defaults { // Key Type UserDefaults name Default value } ``` + + - Warning: The key must be ASCII, not start with `@`, and cannot contain a dot (`.`). */ public final class Key: _AnyKey { /** diff --git a/Sources/Defaults/Observation+Combine.swift b/Sources/Defaults/Observation+Combine.swift index 26af62c..dcb5885 100644 --- a/Sources/Defaults/Observation+Combine.swift +++ b/Sources/Defaults/Observation+Combine.swift @@ -6,7 +6,6 @@ extension Defaults { /** Custom `Subscription` for `UserDefaults` key observation. */ - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) final class DefaultsSubscription: Subscription where SubscriberType.Input == BaseChange { private var subscriber: SubscriberType? private var observation: UserDefaultsKeyObservation? @@ -43,7 +42,6 @@ extension Defaults { /** Custom Publisher, which is using DefaultsSubscription. */ - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) struct DefaultsPublisher: Publisher { typealias Output = BaseChange typealias Failure = Never @@ -87,7 +85,6 @@ extension Defaults { } ``` */ - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) public static func publisher( _ key: Key, options: ObservationOptions = [.initial] @@ -101,7 +98,6 @@ extension Defaults { /** Publisher for multiple `Key` observation, but without specific information about changes. */ - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) public static func publisher( keys: _AnyKey..., options: ObservationOptions = [.initial] diff --git a/Sources/Defaults/SwiftUI.swift b/Sources/Defaults/SwiftUI.swift index f93f2fa..662f3fc 100644 --- a/Sources/Defaults/SwiftUI.swift +++ b/Sources/Defaults/SwiftUI.swift @@ -1,8 +1,6 @@ -#if canImport(Combine) import SwiftUI import Combine -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension Defaults { @MainActor final class Observable: ObservableObject { @@ -67,7 +65,6 @@ Access stored values from SwiftUI. This is similar to `@AppStorage` but it accepts a ``Defaults/Key`` and many more types. */ -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @propertyWrapper public struct Default: DynamicProperty { public typealias Publisher = AnyPublisher, Never> @@ -152,7 +149,6 @@ public struct Default: DynamicProperty { } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension Default where Value: Equatable { /** Indicates whether the value is the same as the default value. @@ -234,7 +230,6 @@ extension Defaults.Toggle { } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) extension Defaults { // TODO: Expose this publicly at some point. private static func events( @@ -257,7 +252,6 @@ extension Defaults { } } -@available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) @propertyWrapper private struct ViewStorage: DynamicProperty { private final class ValueBox { @@ -281,4 +275,3 @@ private struct ViewStorage: DynamicProperty { self._valueBox = .init(wrappedValue: ValueBox(value())) } } -#endif diff --git a/Tests/DefaultsTests/DefaultsAnySeriliazableTests.swift b/Tests/DefaultsTests/DefaultsAnySeriliazableTests.swift index 7c29a39..b0f4017 100644 --- a/Tests/DefaultsTests/DefaultsAnySeriliazableTests.swift +++ b/Tests/DefaultsTests/DefaultsAnySeriliazableTests.swift @@ -368,7 +368,6 @@ final class DefaultsAnySerializableTests: XCTestCase { } } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeAnyKeyCombine", default: 123) let expect = expectation(description: "Observation closure being called") @@ -396,7 +395,6 @@ final class DefaultsAnySerializableTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeAnyOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsArrayTests.swift b/Tests/DefaultsTests/DefaultsArrayTests.swift index 6761d3e..eb187c8 100644 --- a/Tests/DefaultsTests/DefaultsArrayTests.swift +++ b/Tests/DefaultsTests/DefaultsArrayTests.swift @@ -81,7 +81,6 @@ final class DefaultsArrayTests: XCTestCase { XCTAssertEqual(Defaults[.array][0], newName) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key<[String]>("observeArrayKeyCombine", default: fixtureArray) let newName = "Chen" @@ -108,7 +107,6 @@ final class DefaultsArrayTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key<[String]?>("observeArrayOptionalKeyCombine") let newName = ["Chen"] diff --git a/Tests/DefaultsTests/DefaultsCodableEnumTests.swift b/Tests/DefaultsTests/DefaultsCodableEnumTests.swift index 94ea8f5..a78da57 100644 --- a/Tests/DefaultsTests/DefaultsCodableEnumTests.swift +++ b/Tests/DefaultsTests/DefaultsCodableEnumTests.swift @@ -131,7 +131,6 @@ final class DefaultsCodableEnumTests: XCTestCase { XCTAssertNotNil(UserDefaults.standard.integer(forKey: keyName)) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeCodableEnumKeyCombine", default: .tenMinutes) let expect = expectation(description: "Observation closure being called") @@ -159,7 +158,6 @@ final class DefaultsCodableEnumTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeCodableEnumOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -188,7 +186,6 @@ final class DefaultsCodableEnumTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[FixtureCodableEnum]>("observeCodableEnumArrayKeyCombine", default: [.tenMinutes]) let expect = expectation(description: "Observation closure being called") @@ -216,7 +213,6 @@ final class DefaultsCodableEnumTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: FixtureCodableEnum]>("observeCodableEnumDictionaryKeyCombine", default: ["0": .tenMinutes]) let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsCodableTests.swift b/Tests/DefaultsTests/DefaultsCodableTests.swift index 9200663..f70f5cd 100644 --- a/Tests/DefaultsTests/DefaultsCodableTests.swift +++ b/Tests/DefaultsTests/DefaultsCodableTests.swift @@ -162,7 +162,6 @@ final class DefaultsCodableTests: XCTestCase { XCTAssertNotNil(UserDefaults.standard.data(forKey: keyName)) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeCodableKeyCombine", default: fixtureCodable) let expect = expectation(description: "Observation closure being called") @@ -188,7 +187,6 @@ final class DefaultsCodableTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeCodableOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -216,7 +214,6 @@ final class DefaultsCodableTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[Unicorn]>("observeCodableArrayKeyCombine", default: [fixtureCodable]) let expect = expectation(description: "Observation closure being called") @@ -242,7 +239,6 @@ final class DefaultsCodableTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: Unicorn]>("observeCodableDictionaryKeyCombine", default: ["0": fixtureCodable]) let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsCollectionCustomElementTests.swift b/Tests/DefaultsTests/DefaultsCollectionCustomElementTests.swift index 6188fff..39b17d6 100644 --- a/Tests/DefaultsTests/DefaultsCollectionCustomElementTests.swift +++ b/Tests/DefaultsTests/DefaultsCollectionCustomElementTests.swift @@ -170,7 +170,6 @@ final class DefaultsCollectionCustomElementTests: XCTestCase { XCTAssertEqual(Defaults[.collectionCustomElementDictionary]["1"]?[0], fixtureCustomCollection2) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key>("observeCollectionCustomElementKeyCombine", default: .init(items: [fixtureCustomCollection])) let expect = expectation(description: "Observation closure being called") @@ -196,7 +195,6 @@ final class DefaultsCollectionCustomElementTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key?>("observeCollectionCustomElementOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -225,7 +223,6 @@ final class DefaultsCollectionCustomElementTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[Bag]>("observeCollectionCustomElementArrayKeyCombine", default: [.init(items: [fixtureCustomCollection])]) let expect = expectation(description: "Observation closure being called") @@ -251,7 +248,6 @@ final class DefaultsCollectionCustomElementTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: Bag]>("observeCollectionCustomElementDictionaryKeyCombine", default: ["0": .init(items: [fixtureCustomCollection])]) let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsCollectionTests.swift b/Tests/DefaultsTests/DefaultsCollectionTests.swift index 12501bc..1977cd9 100644 --- a/Tests/DefaultsTests/DefaultsCollectionTests.swift +++ b/Tests/DefaultsTests/DefaultsCollectionTests.swift @@ -156,7 +156,6 @@ final class DefaultsCollectionTests: XCTestCase { XCTAssertEqual(Defaults[.collectionDictionary]["1"]?[0], fixtureCollection[0]) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key>("observeCollectionKeyCombine", default: .init(items: fixtureCollection)) let item = "Grape" @@ -183,7 +182,6 @@ final class DefaultsCollectionTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key?>("observeCollectionOptionalKeyCombine") let item = "Grape" @@ -213,7 +211,6 @@ final class DefaultsCollectionTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[Bag]>("observeCollectionArrayKeyCombine", default: [.init(items: fixtureCollection)]) let item = "Grape" @@ -240,7 +237,6 @@ final class DefaultsCollectionTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: Bag]>("observeCollectionArrayKeyCombine", default: ["0": .init(items: fixtureCollection)]) let item = "Grape" diff --git a/Tests/DefaultsTests/DefaultsCustomBridgeTests.swift b/Tests/DefaultsTests/DefaultsCustomBridgeTests.swift index f35df79..6cbb26b 100644 --- a/Tests/DefaultsTests/DefaultsCustomBridgeTests.swift +++ b/Tests/DefaultsTests/DefaultsCustomBridgeTests.swift @@ -242,7 +242,6 @@ final class DefaultsCustomBridge: XCTestCase { XCTAssertEqual(Defaults[.customBridgeDictionary]["0"], newUser) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeCustomBridgeKeyCombine", default: fixtureCustomBridge) let newUser = User(username: "sindresorhus", password: "123456789") @@ -269,7 +268,6 @@ final class DefaultsCustomBridge: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeCustomBridgeOptionalKeyCombine") let newUser = User(username: "sindresorhus", password: "123456789") @@ -299,7 +297,6 @@ final class DefaultsCustomBridge: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[User]>("observeCustomBridgeArrayKeyCombine", default: [fixtureCustomBridge]) let newUser = User(username: "sindresorhus", password: "123456789") @@ -326,7 +323,6 @@ final class DefaultsCustomBridge: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryCombine() { let key = Defaults.Key<[String: User]>("observeCustomBridgeDictionaryKeyCombine", default: ["0": fixtureCustomBridge]) let newUser = User(username: "sindresorhus", password: "123456789") diff --git a/Tests/DefaultsTests/DefaultsDictionaryTests.swift b/Tests/DefaultsTests/DefaultsDictionaryTests.swift index 367d400..5ca3242 100644 --- a/Tests/DefaultsTests/DefaultsDictionaryTests.swift +++ b/Tests/DefaultsTests/DefaultsDictionaryTests.swift @@ -64,7 +64,6 @@ final class DefaultsDictionaryTests: XCTestCase { XCTAssertEqual(Defaults[.dictionary]["0"], newName) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key<[String: String]>("observeDictionaryKeyCombine", default: fixtureDictionary) let expect = expectation(description: "Observation closure being called") @@ -91,7 +90,6 @@ final class DefaultsDictionaryTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key<[String: String]?>("observeDictionaryOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsEnumTests.swift b/Tests/DefaultsTests/DefaultsEnumTests.swift index 2ede6de..483839a 100644 --- a/Tests/DefaultsTests/DefaultsEnumTests.swift +++ b/Tests/DefaultsTests/DefaultsEnumTests.swift @@ -116,7 +116,6 @@ final class DefaultsEnumTests: XCTestCase { XCTAssertEqual(Defaults[.enumDictionary]["0"], .halfHour) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeEnumKeyCombine", default: .tenMinutes) let expect = expectation(description: "Observation closure being called") @@ -146,7 +145,6 @@ final class DefaultsEnumTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeEnumOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -176,7 +174,6 @@ final class DefaultsEnumTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[FixtureEnum]>("observeEnumArrayKeyCombine", default: [.tenMinutes]) let expect = expectation(description: "Observation closure being called") @@ -205,7 +202,6 @@ final class DefaultsEnumTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: FixtureEnum]>("observeEnumDictionaryKeyCombine", default: ["0": .tenMinutes]) let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsNSColorTests.swift b/Tests/DefaultsTests/DefaultsNSColorTests.swift index 49a8c05..f39d3e5 100644 --- a/Tests/DefaultsTests/DefaultsNSColorTests.swift +++ b/Tests/DefaultsTests/DefaultsNSColorTests.swift @@ -126,7 +126,6 @@ final class DefaultsNSColorTests: XCTestCase { XCTAssertTrue(Defaults[.colorDictionary]["0"]?.isEqual(fixtureColor1) ?? false) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeNSColorKeyCombine", default: fixtureColor) let expect = expectation(description: "Observation closure being called") @@ -152,7 +151,6 @@ final class DefaultsNSColorTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeNSColorOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -189,7 +187,6 @@ final class DefaultsNSColorTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[NSColor]>("observeNSColorArrayKeyCombine", default: [fixtureColor]) let expect = expectation(description: "Observation closure being called") @@ -215,7 +212,6 @@ final class DefaultsNSColorTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: NSColor]>("observeNSColorDictionaryKeyCombine", default: ["0": fixtureColor]) let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsNSSecureCodingTests.swift b/Tests/DefaultsTests/DefaultsNSSecureCodingTests.swift index bba19e1..297618a 100644 --- a/Tests/DefaultsTests/DefaultsNSSecureCodingTests.swift +++ b/Tests/DefaultsTests/DefaultsNSSecureCodingTests.swift @@ -158,7 +158,6 @@ final class DefaultsNSSecureCodingTests: XCTestCase { XCTAssertEqual(Defaults[.persistentHistoryDictionary]["0"]?.value, newPersistentHistory.value) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeNSSecureCodingKeyCombine", default: persistentHistoryValue) let newPersistentHistory = ExamplePersistentHistory(value: "NewValue") @@ -185,7 +184,6 @@ final class DefaultsNSSecureCodingTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeNSSecureCodingOptionalKeyCombine") let newPersistentHistory = ExamplePersistentHistory(value: "NewValue") @@ -215,7 +213,6 @@ final class DefaultsNSSecureCodingTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[ExamplePersistentHistory]>("observeNSSecureCodingArrayKeyCombine", default: [persistentHistoryValue]) let newPersistentHistory = ExamplePersistentHistory(value: "NewValue") @@ -244,7 +241,6 @@ final class DefaultsNSSecureCodingTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: ExamplePersistentHistory]>("observeNSSecureCodingDictionaryKeyCombine", default: ["0": persistentHistoryValue]) let newPersistentHistory = ExamplePersistentHistory(value: "NewValue") @@ -273,7 +269,6 @@ final class DefaultsNSSecureCodingTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveMultipleNSSecureKeysCombine() { let key1 = Defaults.Key("observeMultipleNSSecureCodingKey1", default: ExamplePersistentHistory(value: "TestValue")) let key2 = Defaults.Key("observeMultipleNSSecureCodingKey2", default: ExamplePersistentHistory(value: "TestValue")) @@ -292,7 +287,6 @@ final class DefaultsNSSecureCodingTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveMultipleNSSecureOptionalKeysCombine() { let key1 = Defaults.Key("observeMultipleNSSecureCodingOptionalKey1") let key2 = Defaults.Key("observeMultipleNSSecureCodingOptionalKeyKey2") @@ -334,73 +328,71 @@ final class DefaultsNSSecureCodingTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) - func testRemoveDuplicatesObserveNSSecureCodingKeyCombine() { - let key = Defaults.Key("observeNSSecureCodingKey", default: ExamplePersistentHistory(value: "TestValue")) - let expect = expectation(description: "Observation closure being called") + func testRemoveDuplicatesObserveNSSecureCodingKeyCombine() { + let key = Defaults.Key("observeNSSecureCodingKey", default: ExamplePersistentHistory(value: "TestValue")) + let expect = expectation(description: "Observation closure being called") - let inputArray = ["NewTestValue", "NewTestValue", "NewTestValue", "NewTestValue2", "NewTestValue2", "NewTestValue2", "NewTestValue3", "NewTestValue3"] - let expectedArray = ["NewTestValue", "NewTestValue2", "NewTestValue3"] + let inputArray = ["NewTestValue", "NewTestValue", "NewTestValue", "NewTestValue2", "NewTestValue2", "NewTestValue2", "NewTestValue3", "NewTestValue3"] + let expectedArray = ["NewTestValue", "NewTestValue2", "NewTestValue3"] - let cancellable = Defaults - .publisher(key, options: []) - .removeDuplicates() - .map(\.newValue.value) - .collect(expectedArray.count) - .sink { result in - print("Result array: \(result)") + let cancellable = Defaults + .publisher(key, options: []) + .removeDuplicates() + .map(\.newValue.value) + .collect(expectedArray.count) + .sink { result in + print("Result array: \(result)") - if result == expectedArray { - expect.fulfill() - } else { - XCTFail("Expected Array is not matched") - } + if result == expectedArray { + expect.fulfill() + } else { + XCTFail("Expected Array is not matched") } - - inputArray.forEach { - Defaults[key] = ExamplePersistentHistory(value: $0) } - Defaults.reset(key) - cancellable.cancel() - - waitForExpectations(timeout: 10) + inputArray.forEach { + Defaults[key] = ExamplePersistentHistory(value: $0) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) - func testRemoveDuplicatesObserveNSSecureCodingOptionalKeyCombine() { - let key = Defaults.Key("observeNSSecureCodingOptionalKey") - let expect = expectation(description: "Observation closure being called") + Defaults.reset(key) + cancellable.cancel() - let inputArray = ["NewTestValue", "NewTestValue", "NewTestValue", "NewTestValue2", "NewTestValue2", "NewTestValue2", "NewTestValue3", "NewTestValue3"] - let expectedArray = ["NewTestValue", "NewTestValue2", "NewTestValue3", nil] + waitForExpectations(timeout: 10) + } - let cancellable = Defaults - .publisher(key, options: []) - .removeDuplicates() - .map(\.newValue) - .map { $0?.value } - .collect(expectedArray.count) - .sink { result in - print("Result array: \(result)") + func testRemoveDuplicatesObserveNSSecureCodingOptionalKeyCombine() { + let key = Defaults.Key("observeNSSecureCodingOptionalKey") + let expect = expectation(description: "Observation closure being called") - if result == expectedArray { - expect.fulfill() - } else { - XCTFail("Expected Array is not matched") - } + let inputArray = ["NewTestValue", "NewTestValue", "NewTestValue", "NewTestValue2", "NewTestValue2", "NewTestValue2", "NewTestValue3", "NewTestValue3"] + let expectedArray = ["NewTestValue", "NewTestValue2", "NewTestValue3", nil] + + let cancellable = Defaults + .publisher(key, options: []) + .removeDuplicates() + .map(\.newValue) + .map { $0?.value } + .collect(expectedArray.count) + .sink { result in + print("Result array: \(result)") + + if result == expectedArray { + expect.fulfill() + } else { + XCTFail("Expected Array is not matched") } - - inputArray.forEach { - Defaults[key] = ExamplePersistentHistory(value: $0) } - Defaults.reset(key) - cancellable.cancel() - - waitForExpectations(timeout: 10) + inputArray.forEach { + Defaults[key] = ExamplePersistentHistory(value: $0) } + Defaults.reset(key) + cancellable.cancel() + + waitForExpectations(timeout: 10) + } + func testObserveKey() { let key = Defaults.Key("observeNSSecureCodingKey", default: persistentHistoryValue) let newPersistentHistory = ExamplePersistentHistory(value: "NewValue") diff --git a/Tests/DefaultsTests/DefaultsSetAlgebraCustomElementTests.swift b/Tests/DefaultsTests/DefaultsSetAlgebraCustomElementTests.swift index fabb63c..8cfc860 100644 --- a/Tests/DefaultsTests/DefaultsSetAlgebraCustomElementTests.swift +++ b/Tests/DefaultsTests/DefaultsSetAlgebraCustomElementTests.swift @@ -174,7 +174,6 @@ final class DefaultsSetAlgebraCustomElementTests: XCTestCase { XCTAssertEqual(Defaults[.setAlgebraCustomElementDictionary]["1"], .init([fixtureSetAlgebra2, fixtureSetAlgebra3])) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key>("observeSetAlgebraKeyCombine", default: .init([fixtureSetAlgebra])) let expect = expectation(description: "Observation closure being called") @@ -202,7 +201,6 @@ final class DefaultsSetAlgebraCustomElementTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key?>("observeSetAlgebraOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -231,7 +229,6 @@ final class DefaultsSetAlgebraCustomElementTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[DefaultsSetAlgebra]>("observeSetAlgebraArrayKeyCombine", default: [.init([fixtureSetAlgebra])]) let expect = expectation(description: "Observation closure being called") @@ -259,7 +256,6 @@ final class DefaultsSetAlgebraCustomElementTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: DefaultsSetAlgebra]>("observeSetAlgebraDictionaryKeyCombine", default: ["0": .init([fixtureSetAlgebra])]) let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsSetAlgebraTests.swift b/Tests/DefaultsTests/DefaultsSetAlgebraTests.swift index e721b83..526ce6d 100644 --- a/Tests/DefaultsTests/DefaultsSetAlgebraTests.swift +++ b/Tests/DefaultsTests/DefaultsSetAlgebraTests.swift @@ -206,7 +206,6 @@ final class DefaultsSetAlgebraTests: XCTestCase { XCTAssertEqual(Defaults[.setAlgebraDictionary]["1"], .init([fixtureSetAlgebra2, fixtureSetAlgebra3])) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key>("observeSetAlgebraKeyCombine", default: .init([fixtureSetAlgebra])) let expect = expectation(description: "Observation closure being called") @@ -234,7 +233,6 @@ final class DefaultsSetAlgebraTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key?>("observeSetAlgebraOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -263,7 +261,6 @@ final class DefaultsSetAlgebraTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[DefaultsSetAlgebra]>("observeSetAlgebraArrayKeyCombine", default: [.init([fixtureSetAlgebra])]) let expect = expectation(description: "Observation closure being called") @@ -291,7 +288,6 @@ final class DefaultsSetAlgebraTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: DefaultsSetAlgebra]>("observeSetAlgebraDictionaryKeyCombine", default: ["0": .init([fixtureSetAlgebra])]) let expect = expectation(description: "Observation closure being called") diff --git a/Tests/DefaultsTests/DefaultsTests.swift b/Tests/DefaultsTests/DefaultsTests.swift index 5e9af35..611ae62 100644 --- a/Tests/DefaultsTests/DefaultsTests.swift +++ b/Tests/DefaultsTests/DefaultsTests.swift @@ -167,7 +167,6 @@ final class DefaultsTests: XCTestCase { Defaults.removeAll(suite: customSuite) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeKey", default: false) let expect = expectation(description: "Observation closure being called") @@ -193,7 +192,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeOptionalKey") let expect = expectation(description: "Observation closure being called") @@ -222,7 +220,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testDynamicOptionalDateTypeCombine() { let first = Date(timeIntervalSince1970: 0) let second = Date(timeIntervalSince1970: 1) @@ -254,7 +251,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveMultipleKeysCombine() { let key1 = Defaults.Key("observeKey1", default: "x") let key2 = Defaults.Key("observeKey2", default: true) @@ -273,7 +269,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveMultipleOptionalKeysCombine() { let key1 = Defaults.Key("observeOptionalKey1") let key2 = Defaults.Key("observeOptionalKey2") @@ -292,7 +287,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testReceiveValueBeforeSubscriptionCombine() { let key = Defaults.Key("receiveValueBeforeSubscription", default: "hello") let expect = expectation(description: "Observation closure being called") @@ -502,7 +496,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObservePreventPropagationCombine() { let key1 = Defaults.Key("preventPropagation6", default: nil) let expect = expectation(description: "No infinite recursion") @@ -523,7 +516,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObservePreventPropagationMultipleKeysCombine() { let key1 = Defaults.Key("preventPropagation7", default: nil) let key2 = Defaults.Key("preventPropagation8", default: nil) @@ -545,7 +537,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObservePreventPropagationModifiersCombine() { let key1 = Defaults.Key("preventPropagation9", default: nil) let expect = expectation(description: "No infinite recursion") @@ -570,7 +561,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testRemoveDuplicatesObserveKeyCombine() { let key = Defaults.Key("observeKey", default: false) let expect = expectation(description: "Observation closure being called") @@ -603,7 +593,6 @@ final class DefaultsTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testRemoveDuplicatesOptionalObserveKeyCombine() { let key = Defaults.Key("observeOptionalKey", default: nil) let expect = expectation(description: "Observation closure being called") @@ -720,7 +709,6 @@ final class DefaultsTests: XCTestCase { } } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testImmediatelyFinishingPublisherCombine() { let key = Defaults.Key("observeKey", default: false) let expect = expectation(description: "Observation closure being called without crashing") diff --git a/Tests/DefaultsTests/DefaultsUIColorTests.swift b/Tests/DefaultsTests/DefaultsUIColorTests.swift index d21a1a8..d8ee69b 100644 --- a/Tests/DefaultsTests/DefaultsUIColorTests.swift +++ b/Tests/DefaultsTests/DefaultsUIColorTests.swift @@ -125,7 +125,6 @@ final class DefaultsNSColorTests: XCTestCase { XCTAssertTrue(Defaults[.colorDictionary]["0"]?.isEqual(fixtureColor1) ?? false) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveKeyCombine() { let key = Defaults.Key("observeNSColorKeyCombine", default: fixtureColor) let expect = expectation(description: "Observation closure being called") @@ -151,7 +150,6 @@ final class DefaultsNSColorTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveOptionalKeyCombine() { let key = Defaults.Key("observeNSColorOptionalKeyCombine") let expect = expectation(description: "Observation closure being called") @@ -188,7 +186,6 @@ final class DefaultsNSColorTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveArrayKeyCombine() { let key = Defaults.Key<[UIColor]>("observeNSColorArrayKeyCombine", default: [fixtureColor]) let expect = expectation(description: "Observation closure being called") @@ -214,7 +211,6 @@ final class DefaultsNSColorTests: XCTestCase { waitForExpectations(timeout: 10) } - @available(iOS 13.0, macOS 10.15, tvOS 13.0, watchOS 6.0, iOSApplicationExtension 13.0, macOSApplicationExtension 10.15, tvOSApplicationExtension 13.0, watchOSApplicationExtension 6.0, *) func testObserveDictionaryKeyCombine() { let key = Defaults.Key<[String: UIColor]>("observeNSColorDictionaryKeyCombine", default: ["0": fixtureColor]) let expect = expectation(description: "Observation closure being called") diff --git a/readme.md b/readme.md index d4d12b7..4c25b5b 100644 --- a/readme.md +++ b/readme.md @@ -33,10 +33,10 @@ For a real-world example, see the [Plash app](https://github.com/sindresorhus/Pl ## Compatibility -- macOS 10.13+ -- iOS 12+ -- tvOS 12+ -- watchOS 5+ +- macOS 10.15+ +- iOS 13+ +- tvOS 13+ +- watchOS 6+ ## Migration Guides @@ -517,16 +517,12 @@ Type: `func` Observation API using [Publisher](https://developer.apple.com/documentation/combine/publisher) from the [Combine](https://developer.apple.com/documentation/combine) framework. -Available on macOS 10.15+, iOS 13.0+, tvOS 13.0+, and watchOS 6.0+. - #### `Defaults.publisher(keys: keys…, options:)` Type: `func` [Combine](https://developer.apple.com/documentation/combine) observation API for multiple key observation, but without specific information about changes. -Available on macOS 10.15+, iOS 13.0+, tvOS 13.0+, and watchOS 6.0+. - #### `Defaults.removeAll` ```swift