diff --git a/.codecov.yml b/.codecov.yml index f894afcd2..91d745324 100644 --- a/.codecov.yml +++ b/.codecov.yml @@ -4,7 +4,7 @@ coverage: status: patch: default: - target: auto + target: 0 changes: false project: default: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c0cba7629..a5afd2a72 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,13 @@ jobs: run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(iOS\) -destination platform\=iOS\ Simulator,name\=iPhone\ 12\ Pro\ Max -derivedDataPath DerivedData test | xcpretty env: DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} + - name: Prepare codecov + run: | + XCTEST=$(find DerivedData -type f -name 'ParseSwiftTests') + PROFDATA=$(find DerivedData -type f -name '*.profdata') + xcrun llvm-cov export "${XCTEST}" -format="lcov" -instr-profile "${PROFDATA}" > info.lcov + env: + DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: @@ -43,6 +50,13 @@ jobs: run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(macOS\) -destination platform\=macOS -derivedDataPath DerivedData test | xcpretty env: DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} + - name: Prepare codecov + run: | + XCTEST=$(find DerivedData -type f -name 'ParseSwiftTestsmacOS') + PROFDATA=$(find DerivedData -type f -name '*.profdata') + xcrun llvm-cov export "${XCTEST}" -format="lcov" -instr-profile "${PROFDATA}" > info.lcov + env: + DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: @@ -58,6 +72,13 @@ jobs: run: set -o pipefail && env NSUnbufferedIO=YES xcodebuild -workspace Parse.xcworkspace -scheme ParseSwift\ \(tvOS\) -destination platform\=tvOS\ Simulator,name\=Apple\ TV -derivedDataPath DerivedData test | xcpretty env: DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} + - name: Prepare codecov + run: | + XCTEST=$(find DerivedData -type f -name 'ParseSwiftTeststvOS') + PROFDATA=$(find DerivedData -type f -name '*.profdata') + xcrun llvm-cov export "${XCTEST}" -format="lcov" -instr-profile "${PROFDATA}" > info.lcov + env: + DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v2 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6fc5d7c50..a4adfaeb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,10 +17,6 @@ jobs: run: ./Scripts/update_build env: BUILD_VERSION: ${{ env.TAG }} - - name: CocoaPods - run: set -o pipefail && env NSUnbufferedIO=YES pod lib lint --allow-warnings --verbose - env: - DEVELOPER_DIR: ${{ env.CI_XCODE_13 }} - name: Deploy CocoaPods run: set -o pipefail && env NSUnbufferedIO=YES pod trunk push ParseSwift.podspec --allow-warnings --verbose env: diff --git a/CHANGELOG.md b/CHANGELOG.md index 09758fa0c..c0220d125 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,9 +1,19 @@ # Parse-Swift Changelog ### main -[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.11.0...main) + +[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/2.0.0...main) * _Contributing to this repo? Add info about your change here to be included in the next release_ +### 2.0.0 +[Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.11.0...2.0.0) + +__New features__ +- Added option to delete Parse items from Keychain when the app is running for the first time ([#254](https://github.com/parse-community/Parse-Swift/pull/254)), thanks to [Corey Baker](https://github.com/cbaker6). + +__Improvements__ +- (Breaking Change) ParseObject's now conform to Identifiable and can be used directly with SwiftUI without additonal properties needed. Drops support for iOS 12, tvOS 12, watchOS 5, and macOS 10.13/14 ([#254](https://github.com/parse-community/Parse-Swift/pull/254)), thanks to [Corey Baker](https://github.com/cbaker6). + ### 1.11.0 [Full Changelog](https://github.com/parse-community/Parse-Swift/compare/1.10.4...1.11.0) diff --git a/Package.swift b/Package.swift index 2d267e373..53ee5313d 100644 --- a/Package.swift +++ b/Package.swift @@ -4,7 +4,7 @@ import PackageDescription let package = Package( name: "ParseSwift", - platforms: [.iOS(.v12), .macOS(.v10_13), .tvOS(.v12), .watchOS(.v5)], + platforms: [.iOS(.v13), .macOS(.v10_15), .tvOS(.v13), .watchOS(.v6)], products: [ .library( name: "ParseSwift", diff --git a/ParseSwift.playground/Pages/17 - SwiftUI - Finding Objects.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/17 - SwiftUI - Finding Objects.xcplaygroundpage/Contents.swift index 67502511d..83b89fa58 100644 --- a/ParseSwift.playground/Pages/17 - SwiftUI - Finding Objects.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/17 - SwiftUI - Finding Objects.xcplaygroundpage/Contents.swift @@ -18,15 +18,7 @@ PlaygroundPage.current.needsIndefiniteExecution = true initializeParse() //: Create your own value typed ParseObject. -struct GameScore: ParseObject, Identifiable { - - //: Conform to Identifiable for iOS13+ - var id: String { // swiftlint:disable:this identifier_name - guard let objectId = self.objectId else { - return UUID().uuidString - } - return objectId - } +struct GameScore: ParseObject { //: These are required for any Object. var objectId: String? diff --git a/ParseSwift.playground/Pages/18 - SwiftUI - Finding Objects With Custom ViewModel.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/18 - SwiftUI - Finding Objects With Custom ViewModel.xcplaygroundpage/Contents.swift index 329e3fb2b..a7367d2f8 100644 --- a/ParseSwift.playground/Pages/18 - SwiftUI - Finding Objects With Custom ViewModel.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/18 - SwiftUI - Finding Objects With Custom ViewModel.xcplaygroundpage/Contents.swift @@ -19,15 +19,7 @@ PlaygroundPage.current.needsIndefiniteExecution = true initializeParse() //: Create your own value typed ParseObject. -struct GameScore: ParseObject, Identifiable { - - //: Conform to Identifiable for iOS13+ - var id: String { // swiftlint:disable:this identifier_name - guard let objectId = self.objectId else { - return UUID().uuidString - } - return objectId - } +struct GameScore: ParseObject { //: These are required for any Object. var objectId: String? diff --git a/ParseSwift.podtemplate b/ParseSwift.podtemplate index 03382c518..652a393f5 100644 --- a/ParseSwift.podtemplate +++ b/ParseSwift.podtemplate @@ -10,10 +10,10 @@ Pod::Spec.new do |s| :git => "#{s.homepage}.git", :tag => "#{s.version}", } - s.ios.deployment_target = "12.0" - s.osx.deployment_target = "10.13" - s.tvos.deployment_target = "12.0" - s.watchos.deployment_target = "5.0" + s.ios.deployment_target = "13.0" + s.osx.deployment_target = "10.15" + s.tvos.deployment_target = "13.0" + s.watchos.deployment_target = "6.0" s.swift_versions = ['5.1', '5.2', '5.3', '5.4', '5.5'] s.source_files = "Sources/ParseSwift/**/*.swift" s.license = { diff --git a/ParseSwift.xcodeproj/project.pbxproj b/ParseSwift.xcodeproj/project.pbxproj index f4e9f0b2c..2b1354314 100644 --- a/ParseSwift.xcodeproj/project.pbxproj +++ b/ParseSwift.xcodeproj/project.pbxproj @@ -293,10 +293,6 @@ 705D950925BE4C08003EF6F8 /* SubscriptionCallback.swift in Sources */ = {isa = PBXBuildFile; fileRef = 705D950725BE4C08003EF6F8 /* SubscriptionCallback.swift */; }; 705D950A25BE4C08003EF6F8 /* SubscriptionCallback.swift in Sources */ = {isa = PBXBuildFile; fileRef = 705D950725BE4C08003EF6F8 /* SubscriptionCallback.swift */; }; 705D950B25BE4C08003EF6F8 /* SubscriptionCallback.swift in Sources */ = {isa = PBXBuildFile; fileRef = 705D950725BE4C08003EF6F8 /* SubscriptionCallback.swift */; }; - 70647E8E259E3375004C1004 /* LocallyIdentifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E8D259E3375004C1004 /* LocallyIdentifiable.swift */; }; - 70647E8F259E3375004C1004 /* LocallyIdentifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E8D259E3375004C1004 /* LocallyIdentifiable.swift */; }; - 70647E90259E3375004C1004 /* LocallyIdentifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E8D259E3375004C1004 /* LocallyIdentifiable.swift */; }; - 70647E91259E3375004C1004 /* LocallyIdentifiable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E8D259E3375004C1004 /* LocallyIdentifiable.swift */; }; 70647E9C259E3A9A004C1004 /* ParseType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E9B259E3A9A004C1004 /* ParseType.swift */; }; 70647E9D259E3A9A004C1004 /* ParseType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E9B259E3A9A004C1004 /* ParseType.swift */; }; 70647E9E259E3A9A004C1004 /* ParseType.swift in Sources */ = {isa = PBXBuildFile; fileRef = 70647E9B259E3A9A004C1004 /* ParseType.swift */; }; @@ -867,7 +863,6 @@ 705A99F8259807F900B3547F /* ParseFileManagerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseFileManagerTests.swift; sourceTree = ""; }; 705A9A2E25991C1400B3547F /* Fileable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Fileable.swift; sourceTree = ""; }; 705D950725BE4C08003EF6F8 /* SubscriptionCallback.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SubscriptionCallback.swift; sourceTree = ""; }; - 70647E8D259E3375004C1004 /* LocallyIdentifiable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LocallyIdentifiable.swift; sourceTree = ""; }; 70647E9B259E3A9A004C1004 /* ParseType.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseType.swift; sourceTree = ""; }; 70732C592606CCAD000CAB81 /* ParseObjectCustomObjectIdTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseObjectCustomObjectIdTests.swift; sourceTree = ""; }; 707A3BF025B0A4F0000D215C /* ParseAuthentication.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ParseAuthentication.swift; sourceTree = ""; }; @@ -1291,7 +1286,6 @@ 70BC988F252A5B5C00FF3074 /* Objectable.swift */, F97B45C824D9C6F200F4A88B /* Queryable.swift */, F97B45C724D9C6F200F4A88B /* Savable.swift */, - 70647E8D259E3375004C1004 /* LocallyIdentifiable.swift */, 70647E9B259E3A9A004C1004 /* ParseType.swift */, 91BB8FCE2690BA70005A6BA5 /* QueryObservable.swift */, 91F346BD269B77B5005727B6 /* CloudObservable.swift */, @@ -1972,7 +1966,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "if which swiftlint >/dev/null; then\n swiftlint --fix --strict\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; + shellScript = "if which swiftlint >/dev/null; then\n swiftlint --fix && swiftlint --strict\nelse\n echo \"warning: SwiftLint not installed, download from https://github.com/realm/SwiftLint\"\nfi\n"; }; 918CED61268A23A700CFDC83 /* SwiftLint */ = { isa = PBXShellScriptBuildPhase; @@ -2074,7 +2068,6 @@ 705A9A2F25991C1400B3547F /* Fileable.swift in Sources */, 89899D342603CF36002E2043 /* ParseTwitter.swift in Sources */, F97B464A24D9C78B00F4A88B /* Delete.swift in Sources */, - 70647E8E259E3375004C1004 /* LocallyIdentifiable.swift in Sources */, F97B460624D9C6F200F4A88B /* ParseUser.swift in Sources */, 700396F825A394AE0052CB31 /* ParseLiveQueryDelegate.swift in Sources */, F97B465A24D9C78C00F4A88B /* Increment.swift in Sources */, @@ -2284,7 +2277,6 @@ 705A9A3025991C1400B3547F /* Fileable.swift in Sources */, 89899D332603CF36002E2043 /* ParseTwitter.swift in Sources */, F97B464B24D9C78B00F4A88B /* Delete.swift in Sources */, - 70647E8F259E3375004C1004 /* LocallyIdentifiable.swift in Sources */, F97B460724D9C6F200F4A88B /* ParseUser.swift in Sources */, 700396F925A394AE0052CB31 /* ParseLiveQueryDelegate.swift in Sources */, F97B465B24D9C78C00F4A88B /* Increment.swift in Sources */, @@ -2589,7 +2581,6 @@ 705A9A3225991C1400B3547F /* Fileable.swift in Sources */, 89899D282603CF35002E2043 /* ParseTwitter.swift in Sources */, F97B45F524D9C6F200F4A88B /* Pointer.swift in Sources */, - 70647E91259E3375004C1004 /* LocallyIdentifiable.swift in Sources */, F97B460924D9C6F200F4A88B /* ParseUser.swift in Sources */, 700396FB25A394AE0052CB31 /* ParseLiveQueryDelegate.swift in Sources */, F97B463A24D9C74400F4A88B /* Responses.swift in Sources */, @@ -2713,7 +2704,6 @@ 705A9A3125991C1400B3547F /* Fileable.swift in Sources */, 89899D322603CF35002E2043 /* ParseTwitter.swift in Sources */, F97B45F424D9C6F200F4A88B /* Pointer.swift in Sources */, - 70647E90259E3375004C1004 /* LocallyIdentifiable.swift in Sources */, F97B460824D9C6F200F4A88B /* ParseUser.swift in Sources */, 700396FA25A394AE0052CB31 /* ParseLiveQueryDelegate.swift in Sources */, F97B463924D9C74400F4A88B /* Responses.swift in Sources */, @@ -2857,7 +2847,7 @@ CODE_SIGN_STYLE = Automatic; GCC_GENERATE_TEST_COVERAGE_FILES = YES; INFOPLIST_FILE = TestHost/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2873,7 +2863,7 @@ CODE_SIGN_STYLE = Automatic; GCC_GENERATE_TEST_COVERAGE_FILES = YES; INFOPLIST_FILE = TestHost/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -2934,14 +2924,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -2993,12 +2983,12 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; MACOSX_DEPLOYMENT_TARGET = 10.13; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; - SWIFT_VERSION = 4.2; + SWIFT_VERSION = 5.0; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -3016,7 +3006,7 @@ GCC_GENERATE_TEST_COVERAGE_FILES = YES; INFOPLIST_FILE = "ParseSwift-iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MARKETING_VERSION = 1.8.3; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; @@ -3041,7 +3031,7 @@ GCC_GENERATE_TEST_COVERAGE_FILES = YES; INFOPLIST_FILE = "ParseSwift-iOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; - IPHONEOS_DEPLOYMENT_TARGET = 12.0; + IPHONEOS_DEPLOYMENT_TARGET = 13.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; MARKETING_VERSION = 1.8.3; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; @@ -3111,7 +3101,7 @@ INFOPLIST_FILE = "ParseSwift-macOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.15; MARKETING_VERSION = 1.8.3; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; PRODUCT_NAME = ParseSwift; @@ -3138,7 +3128,7 @@ INFOPLIST_FILE = "ParseSwift-macOS/Info.plist"; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.13; + MACOSX_DEPLOYMENT_TARGET = 10.15; MARKETING_VERSION = 1.8.3; PRODUCT_BUNDLE_IDENTIFIER = com.parse.ParseSwift; PRODUCT_NAME = ParseSwift; @@ -3168,7 +3158,7 @@ SDKROOT = appletvos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 12.0; + TVOS_DEPLOYMENT_TARGET = 13.0; }; name = Debug; }; @@ -3188,7 +3178,7 @@ SDKROOT = appletvos; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 12.0; + TVOS_DEPLOYMENT_TARGET = 13.0; }; name = Release; }; @@ -3304,7 +3294,7 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; TVOS_DEPLOYMENT_TARGET = 12.0; - WATCHOS_DEPLOYMENT_TARGET = 5.0; + WATCHOS_DEPLOYMENT_TARGET = 6.0; }; name = Debug; }; @@ -3333,7 +3323,7 @@ SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 4; TVOS_DEPLOYMENT_TARGET = 12.0; - WATCHOS_DEPLOYMENT_TARGET = 5.0; + WATCHOS_DEPLOYMENT_TARGET = 6.0; }; name = Release; }; @@ -3361,7 +3351,7 @@ SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 12.0; + TVOS_DEPLOYMENT_TARGET = 13.0; WATCHOS_DEPLOYMENT_TARGET = 5.0; }; name = Debug; @@ -3389,7 +3379,7 @@ SKIP_INSTALL = YES; SWIFT_VERSION = 5.0; TARGETED_DEVICE_FAMILY = 3; - TVOS_DEPLOYMENT_TARGET = 12.0; + TVOS_DEPLOYMENT_TARGET = 13.0; WATCHOS_DEPLOYMENT_TARGET = 5.0; }; name = Release; diff --git a/README.md b/README.md index 30182916c..d24a8b5e6 100644 --- a/README.md +++ b/README.md @@ -83,8 +83,6 @@ Please checkout the [Swift Playground](https://github.com/parse-community/Parse- ## LiveQuery -**Requires: iOS 13.0+, macOS 10.15+, macCatalyst 13.0+, tvOS 13.0+, watchOS 6.0+** - `Query` is one of the key concepts on the Parse Platform. It allows you to retrieve `ParseObject`s by specifying some conditions, making it easy to build apps such as a dashboard, a todo list or even some strategy games. However, `Query` is based on a pull model, which is not suitable for apps that need real-time support. Suppose you are building an app that allows multiple users to edit the same file at the same time. `Query` would not be an ideal tool since you can not know when to query from the server to get the updates. diff --git a/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple+combine.swift b/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple+combine.swift index 8b469a6b8..4c2b87f25 100644 --- a/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple+combine.swift +++ b/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseApple { // MARK: Login - Combine @@ -48,7 +47,6 @@ public extension ParseApple { } } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseApple { // MARK: Link - Combine diff --git a/Sources/ParseSwift/Authentication/3rd Party/ParseFacebook/ParseFacebook+combine.swift b/Sources/ParseSwift/Authentication/3rd Party/ParseFacebook/ParseFacebook+combine.swift index 07d6a86f1..53f77c71c 100644 --- a/Sources/ParseSwift/Authentication/3rd Party/ParseFacebook/ParseFacebook+combine.swift +++ b/Sources/ParseSwift/Authentication/3rd Party/ParseFacebook/ParseFacebook+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseFacebook { // MARK: Login - Combine /** @@ -70,7 +69,6 @@ public extension ParseFacebook { } } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseFacebook { // MARK: Link - Combine /** diff --git a/Sources/ParseSwift/Authentication/3rd Party/ParseLDAP/ParseLDAP+combine.swift b/Sources/ParseSwift/Authentication/3rd Party/ParseLDAP/ParseLDAP+combine.swift index 044695e59..9875a15e7 100644 --- a/Sources/ParseSwift/Authentication/3rd Party/ParseLDAP/ParseLDAP+combine.swift +++ b/Sources/ParseSwift/Authentication/3rd Party/ParseLDAP/ParseLDAP+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseLDAP { // MARK: Login - Combine /** @@ -47,7 +46,6 @@ public extension ParseLDAP { } } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseLDAP { // MARK: Link - Combine /** diff --git a/Sources/ParseSwift/Authentication/3rd Party/ParseTwitter/ParseTwitter+combine.swift b/Sources/ParseSwift/Authentication/3rd Party/ParseTwitter/ParseTwitter+combine.swift index bc9107a01..de7377cf0 100644 --- a/Sources/ParseSwift/Authentication/3rd Party/ParseTwitter/ParseTwitter+combine.swift +++ b/Sources/ParseSwift/Authentication/3rd Party/ParseTwitter/ParseTwitter+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseTwitter { // MARK: Login - Combine @@ -60,7 +59,6 @@ public extension ParseTwitter { } } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseTwitter { // MARK: Link - Combine diff --git a/Sources/ParseSwift/Authentication/Internal/ParseAnonymous+combine.swift b/Sources/ParseSwift/Authentication/Internal/ParseAnonymous+combine.swift index 11da58bfe..dd4f84e99 100644 --- a/Sources/ParseSwift/Authentication/Internal/ParseAnonymous+combine.swift +++ b/Sources/ParseSwift/Authentication/Internal/ParseAnonymous+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseAnonymous { // MARK: Login - Combine @@ -44,7 +43,6 @@ public extension ParseAnonymous { } } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseAnonymous { // MARK: Link - Combine diff --git a/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication+combine.swift b/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication+combine.swift index d37156d4b..953b92c79 100644 --- a/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication+combine.swift +++ b/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseAuthentication { // MARK: Convenience Implementations - Combine @@ -31,7 +30,6 @@ public extension ParseAuthentication { } } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseUser { // MARK: 3rd Party Authentication - Login Combine diff --git a/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication.swift b/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication.swift index 744573c3e..1ab615004 100644 --- a/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication.swift +++ b/Sources/ParseSwift/Authentication/Protocols/ParseAuthentication.swift @@ -103,7 +103,6 @@ public protocol ParseAuthentication: Codable { - parameter callbackQueue: The queue to return to after completion. Default value of .main. - parameter completion: The block to execute. */ - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func loginPublisher(authData: [String: String], options: API.Options) -> Future @@ -114,7 +113,6 @@ public protocol ParseAuthentication: Codable { - parameter callbackQueue: The queue to return to after completion. Default value of .main. - parameter completion: The block to execute. */ - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func linkPublisher(authData: [String: String], options: API.Options) -> Future @@ -126,7 +124,6 @@ public protocol ParseAuthentication: Codable { - parameter completion: The block to execute. It should have the following argument signature: `(Result)`. */ - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func unlinkPublisher(_ user: AuthenticatedUser, options: API.Options) -> Future @@ -137,7 +134,6 @@ public protocol ParseAuthentication: Codable { - parameter completion: The block to execute. It should have the following argument signature: `(Result)`. */ - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func unlinkPublisher(options: API.Options) -> Future #endif } diff --git a/Sources/ParseSwift/Coding/ParseEncoder.swift b/Sources/ParseSwift/Coding/ParseEncoder.swift index 98d3cda6d..af1ec4bcf 100644 --- a/Sources/ParseSwift/Coding/ParseEncoder.swift +++ b/Sources/ParseSwift/Coding/ParseEncoder.swift @@ -361,13 +361,13 @@ private class _ParseEncoder: JSONEncoder, Encoder { } } else { if self.collectChildren { - if let updatedFile = self.filesSavedBeforeThisOne?[value.localId] { + if let updatedFile = self.filesSavedBeforeThisOne?[value.id] { valueToEncode = updatedFile } else { //New object needs to be saved before it can be stored self.newObjects.append(value) } - } else if let currentFile = self.filesSavedBeforeThisOne?[value.localId] { + } else if let currentFile = self.filesSavedBeforeThisOne?[value.id] { valueToEncode = currentFile } else if dictionary.count > 0 { //Only top level objects can be saved without a pointer diff --git a/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift b/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift index ed9f727ac..e8f521324 100644 --- a/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift +++ b/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift @@ -11,7 +11,6 @@ import Foundation import FoundationNetworking #endif -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) final class LiveQuerySocket: NSObject { private var session: URLSession! var delegates = [URLSessionWebSocketTask: LiveQuerySocketDelegate]() @@ -43,7 +42,6 @@ final class LiveQuerySocket: NSObject { } // MARK: Status -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension LiveQuerySocket { enum Status: String { case open @@ -52,7 +50,6 @@ extension LiveQuerySocket { } // MARK: Connect -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension LiveQuerySocket { func connect(task: URLSessionWebSocketTask, completion: @escaping (Error?) -> Void) throws { @@ -75,7 +72,6 @@ extension LiveQuerySocket { } // MARK: Send -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension LiveQuerySocket { func send(_ data: Data, task: URLSessionWebSocketTask, completion: @escaping (Error?) -> Void) { guard let encodedAsString = String(data: data, encoding: .utf8) else { @@ -89,7 +85,6 @@ extension LiveQuerySocket { } // MARK: Receive -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension LiveQuerySocket { func receive(_ task: URLSessionWebSocketTask) { @@ -124,7 +119,6 @@ extension LiveQuerySocket { } // MARK: Ping -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension LiveQuerySocket { func sendPing(_ task: URLSessionWebSocketTask, pongReceiveHandler: @escaping (Error?) -> Void) { @@ -133,13 +127,11 @@ extension LiveQuerySocket { } // MARK: URLSession -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension URLSession { static let liveQuery = LiveQuerySocket() } // MARK: URLSessionWebSocketDelegate -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension LiveQuerySocket: URLSessionWebSocketDelegate { func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, diff --git a/Sources/ParseSwift/LiveQuery/ParseLiveQuery+combine.swift b/Sources/ParseSwift/LiveQuery/ParseLiveQuery+combine.swift index 1dfd11dd5..f1892c4bf 100644 --- a/Sources/ParseSwift/LiveQuery/ParseLiveQuery+combine.swift +++ b/Sources/ParseSwift/LiveQuery/ParseLiveQuery+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery { // MARK: Combine diff --git a/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift b/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift index 2dcaa8f48..0c4e9915c 100644 --- a/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift +++ b/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift @@ -46,7 +46,6 @@ import FoundationNetworking running. Initializing new instances will create a new task/connection to the `ParseLiveQuery` server. When an instance is deinitialized it will automatically close it's connection gracefully. */ -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public final class ParseLiveQuery: NSObject { // Queues let synchronizationQueue: DispatchQueue @@ -225,7 +224,6 @@ Not attempting to open ParseLiveQuery socket anymore } // MARK: Helpers -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery { /// Current LiveQuery client. @@ -327,7 +325,6 @@ extension ParseLiveQuery { } // MARK: Delegate -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery: LiveQuerySocketDelegate { func status(_ status: LiveQuerySocket.Status, @@ -585,7 +582,6 @@ extension ParseLiveQuery: LiveQuerySocketDelegate { } // MARK: Connection -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery { /// Manually establish a connection to the `ParseLiveQuery` Server. @@ -717,7 +713,6 @@ extension ParseLiveQuery { } // MARK: SubscriptionRecord -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery { class SubscriptionRecord { @@ -772,7 +767,6 @@ extension ParseLiveQuery { } // MARK: Subscribing -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery { func subscribe(_ query: Query) throws -> Subscription { @@ -801,7 +795,6 @@ extension ParseLiveQuery { } // MARK: Unsubscribing -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery { func unsubscribe(_ query: Query) throws where T: ParseObject { @@ -830,7 +823,6 @@ extension ParseLiveQuery { } // MARK: Updating -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) extension ParseLiveQuery { func update(_ handler: T) throws where T: QuerySubscribable { @@ -847,7 +839,6 @@ extension ParseLiveQuery { } // MARK: ParseLiveQuery - Subscribe -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Query { #if canImport(Combine) /** @@ -916,7 +907,6 @@ public extension Query { } // MARK: ParseLiveQuery - Unsubscribe -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Query { /** Unsubscribes all current subscriptions for a given query on the default @@ -956,7 +946,6 @@ public extension Query { } // MARK: ParseLiveQuery - Update -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Query { /** Updates an existing subscription with a new query on the default `ParseLiveQuery` client. diff --git a/Sources/ParseSwift/LiveQuery/Protocols/LiveQuerySocketDelegate.swift b/Sources/ParseSwift/LiveQuery/Protocols/LiveQuerySocketDelegate.swift index e83ce78ac..9cfe75d93 100644 --- a/Sources/ParseSwift/LiveQuery/Protocols/LiveQuerySocketDelegate.swift +++ b/Sources/ParseSwift/LiveQuery/Protocols/LiveQuerySocketDelegate.swift @@ -11,7 +11,6 @@ import Foundation import FoundationNetworking #endif -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) protocol LiveQuerySocketDelegate: AnyObject { func status(_ status: LiveQuerySocket.Status, closeCode: URLSessionWebSocketTask.CloseCode?, diff --git a/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift b/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift index 21fd5ca45..fcfce314d 100644 --- a/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift +++ b/Sources/ParseSwift/LiveQuery/Protocols/ParseLiveQueryDelegate.swift @@ -14,7 +14,6 @@ import FoundationNetworking // swiftlint:disable line_length /// Receive/respond to notifications from the ParseLiveQuery Server. -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public protocol ParseLiveQueryDelegate: AnyObject { /** @@ -68,7 +67,6 @@ public protocol ParseLiveQueryDelegate: AnyObject { func closedSocket(_ code: URLSessionWebSocketTask.CloseCode?, reason: Data?) } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseLiveQueryDelegate { func received(_ challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, diff --git a/Sources/ParseSwift/LiveQuery/Subscription.swift b/Sources/ParseSwift/LiveQuery/Subscription.swift index 5624f1c9d..a0acbb8d9 100644 --- a/Sources/ParseSwift/LiveQuery/Subscription.swift +++ b/Sources/ParseSwift/LiveQuery/Subscription.swift @@ -62,7 +62,6 @@ private func == (lhs: Event, rhs: Event) -> Bool { as the subscription can be used as a SwiftUI publisher. Meaning it can serve indepedently as a ViewModel in MVVM. */ -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) open class Subscription: QueryViewModel, QuerySubscribable { /// Updates and notifies when there's a new event related to a specific query. diff --git a/Sources/ParseSwift/Objects/ParseInstallation+combine.swift b/Sources/ParseSwift/Objects/ParseInstallation+combine.swift index f09802dca..344f97a66 100644 --- a/Sources/ParseSwift/Objects/ParseInstallation+combine.swift +++ b/Sources/ParseSwift/Objects/ParseInstallation+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseInstallation { // MARK: Fetchable - Combine @@ -66,7 +65,6 @@ public extension ParseInstallation { } // MARK: Batch Support - Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Sequence where Element: ParseInstallation { /** Fetches a collection of installations *aynchronously* with the current data from the server and sets diff --git a/Sources/ParseSwift/Objects/ParseObject+combine.swift b/Sources/ParseSwift/Objects/ParseObject+combine.swift index c702c9a5c..57f9b5627 100644 --- a/Sources/ParseSwift/Objects/ParseObject+combine.swift +++ b/Sources/ParseSwift/Objects/ParseObject+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseObject { // MARK: Combine @@ -62,7 +61,6 @@ public extension ParseObject { } } -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Sequence where Element: ParseObject { // MARK: Batch Support - Combine /** diff --git a/Sources/ParseSwift/Objects/ParseObject.swift b/Sources/ParseSwift/Objects/ParseObject.swift index 5abfe9456..17218485a 100644 --- a/Sources/ParseSwift/Objects/ParseObject.swift +++ b/Sources/ParseSwift/Objects/ParseObject.swift @@ -28,32 +28,6 @@ import Foundation object.createdAt = createdAt return object } - - When designing applications for SwiftUI, it is recommended to make all `ParseObject`'s conform to - `Identifiable`. This can be accomplised by doing the following: - - struct GameScore: ParseObject, Identifiable { - - // Add this computed property to conform to `Identifiable` for iOS13+ - var id: String { - guard let objectId = self.objectId else { - return UUID().uuidString - } - return objectId - } - - // These are required for any Object. - var objectId: String? - var createdAt: Date? - var updatedAt: Date? - var ACL: ParseACL? - - // Your own properties. - var score: Int = 0 - var location: ParseGeoPoint? - var name: String? - var myFiles: [ParseFile]? - } - important: It is recommended that all added properties be optional properties so they can eventually be used as Parse `Pointer`'s. If a developer really wants to have a required key, they should require it on the server-side or @@ -74,6 +48,7 @@ public protocol ParseObject: Objectable, Fetchable, Savable, Deletable, + Identifiable, Hashable, CustomDebugStringConvertible, CustomStringConvertible { @@ -82,6 +57,18 @@ public protocol ParseObject: Objectable, // MARK: Default Implementations public extension ParseObject { + /** + A computed property that is the same value as `objectId` and makes it easy to use `ParseObject`'s + as models in MVVM and SwiftUI. + - note: `id` allows `ParseObjects`'s to be used even if they are unsaved and do not have an `objectId`. + */ + var id: String { // swiftlint:disable:this identifier_name + guard let objectId = self.objectId else { + return UUID().uuidString + } + return objectId + } + /** Determines if two objects have the same objectId. - parameter as: Object to compare. @@ -832,7 +819,7 @@ extension ParseObject { } try savableFiles.forEach { - filesFinishedSaving[$0.localId] = try $0.save(options: options, callbackQueue: queue) + filesFinishedSaving[$0.id] = try $0.save(options: options, callbackQueue: queue) } } completion(objectsFinishedSaving, filesFinishedSaving, nil) diff --git a/Sources/ParseSwift/Objects/ParseUser+combine.swift b/Sources/ParseSwift/Objects/ParseUser+combine.swift index b660f8461..4c4378755 100644 --- a/Sources/ParseSwift/Objects/ParseUser+combine.swift +++ b/Sources/ParseSwift/Objects/ParseUser+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseUser { // MARK: Signing Up - Combine @@ -201,7 +200,6 @@ public extension ParseUser { } // MARK: Batch Support - Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Sequence where Element: ParseUser { /** Fetches a collection of users *aynchronously* with the current data from the server and sets diff --git a/Sources/ParseSwift/Operations/ParseOperation+combine.swift b/Sources/ParseSwift/Operations/ParseOperation+combine.swift index cef9b79e2..7ef943ff4 100644 --- a/Sources/ParseSwift/Operations/ParseOperation+combine.swift +++ b/Sources/ParseSwift/Operations/ParseOperation+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseOperation { // MARK: Savable - Combine diff --git a/Sources/ParseSwift/Parse.swift b/Sources/ParseSwift/Parse.swift index cff442ea9..014fbc3a6 100644 --- a/Sources/ParseSwift/Parse.swift +++ b/Sources/ParseSwift/Parse.swift @@ -47,6 +47,15 @@ public struct ParseConfiguration { /// The disk capacity of the cache, in bytes. Defaults to 10MB. var cacheDiskCapacity = 10_000_000 + /// If your app previously used the iOS Objective-C SDK, setting this value + /// to `true` will attempt to migrate relevant data stored in the Keychain to + /// ParseSwift. Defaults to `false`. + var migrateFromObjcSDK: Bool = false + + /// Deletes the Parse Keychain when the app is running for the first time. + /// Defaults to `false`. + var deleteKeychainIfNeeded: Bool = false + internal var authentication: ((URLAuthenticationChallenge, (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)? @@ -93,6 +102,8 @@ public struct ParseConfiguration { requestCachePolicy: URLRequest.CachePolicy = .useProtocolCachePolicy, cacheMemoryCapacity: Int = 512_000, cacheDiskCapacity: Int = 10_000_000, + migrateFromObjcSDK: Bool = false, + deleteKeychainIfNeeded: Bool = false, httpAdditionalHeaders: [String: String]? = nil, authentication: ((URLAuthenticationChallenge, (URLSession.AuthChallengeDisposition, @@ -111,6 +122,8 @@ public struct ParseConfiguration { self.requestCachePolicy = requestCachePolicy self.cacheMemoryCapacity = cacheMemoryCapacity self.cacheDiskCapacity = cacheDiskCapacity + self.migrateFromObjcSDK = migrateFromObjcSDK + self.deleteKeychainIfNeeded = deleteKeychainIfNeeded self.httpAdditionalHeaders = httpAdditionalHeaders ParseStorage.shared.use(keyValueStore ?? InMemoryKeyValueStore()) } @@ -129,11 +142,11 @@ public struct ParseSwift { `application(... didFinishLaunchingWithOptions launchOptions...)`. - parameter configuration: The Parse configuration. */ - static public func initialize(configuration: ParseConfiguration, - migrateFromObjcSDK: Bool = false) { + static public func initialize(configuration: ParseConfiguration) { Self.configuration = configuration Self.sessionDelegate = ParseURLSessionDelegate(callbackQueue: .main, authentication: configuration.authentication) + deleteKeychainIfNeeded() do { let previousSDKVersion = try ParseVersion(ParseVersion.current) @@ -184,7 +197,7 @@ public struct ParseSwift { BaseParseInstallation.createNewInstallationIfNeeded() #if !os(Linux) && !os(Android) - if migrateFromObjcSDK { + if configuration.migrateFromObjcSDK { if let identifier = Bundle.main.bundleIdentifier { let objcParseKeychain = KeychainStore(service: "\(identifier).com.parse.sdk") guard let installationId: String = objcParseKeychain.object(forKey: "installationId"), @@ -226,6 +239,8 @@ public struct ParseSwift { for more info. - parameter migrateFromObjcSDK: If your app previously used the iOS Objective-C SDK, setting this value to `true` will attempt to migrate relevant data stored in the Keychain to ParseSwift. Defaults to `false`. + - parameter deleteKeychainIfNeeded: Deletes the Parse Keychain when the app is running for the first time. + Defaults to `false`. - parameter authentication: A callback block that will be used to receive/accept/decline network challenges. Defaults to `nil` in which the SDK will use the default OS authentication methods for challenges. It should have the following argument signature: `(challenge: URLAuthenticationChallenge, @@ -247,6 +262,7 @@ public struct ParseSwift { cacheDiskCapacity: Int = 10_000_000, httpAdditionalHeaders: [String: String]? = nil, migrateFromObjcSDK: Bool = false, + deleteKeychainIfNeeded: Bool = false, authentication: ((URLAuthenticationChallenge, (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) -> Void)? = nil @@ -262,9 +278,10 @@ public struct ParseSwift { requestCachePolicy: requestCachePolicy, cacheMemoryCapacity: cacheMemoryCapacity, cacheDiskCapacity: cacheDiskCapacity, + migrateFromObjcSDK: migrateFromObjcSDK, + deleteKeychainIfNeeded: deleteKeychainIfNeeded, httpAdditionalHeaders: httpAdditionalHeaders, - authentication: authentication), - migrateFromObjcSDK: migrateFromObjcSDK) + authentication: authentication)) } internal static func initialize(applicationId: String, @@ -280,6 +297,7 @@ public struct ParseSwift { cacheDiskCapacity: Int = 10_000_000, httpAdditionalHeaders: [String: String]? = nil, migrateFromObjcSDK: Bool = false, + deleteKeychainIfNeeded: Bool = false, testing: Bool = false, authentication: ((URLAuthenticationChallenge, (URLSession.AuthChallengeDisposition, @@ -295,11 +313,29 @@ public struct ParseSwift { requestCachePolicy: requestCachePolicy, cacheMemoryCapacity: cacheMemoryCapacity, cacheDiskCapacity: cacheDiskCapacity, + migrateFromObjcSDK: migrateFromObjcSDK, + deleteKeychainIfNeeded: deleteKeychainIfNeeded, httpAdditionalHeaders: httpAdditionalHeaders, authentication: authentication) configuration.isTestingSDK = testing - initialize(configuration: configuration, - migrateFromObjcSDK: migrateFromObjcSDK) + initialize(configuration: configuration) + } + + static internal func deleteKeychainIfNeeded() { + #if !os(Linux) && !os(Android) + // Clear items out of the Keychain on app first run. + if UserDefaults.standard.object(forKey: ParseConstants.bundlePrefix) == nil { + if Self.configuration.deleteKeychainIfNeeded == true { + try? KeychainStore.old.deleteAll() + try? KeychainStore.shared.deleteAll() + } + + // This is no longer the first run + UserDefaults.standard.setValue(String(ParseConstants.bundlePrefix), + forKey: ParseConstants.bundlePrefix) + UserDefaults.standard.synchronize() + } + #endif } /** diff --git a/Sources/ParseSwift/ParseConstants.swift b/Sources/ParseSwift/ParseConstants.swift index d9327a9dd..4297c847f 100644 --- a/Sources/ParseSwift/ParseConstants.swift +++ b/Sources/ParseSwift/ParseConstants.swift @@ -10,11 +10,12 @@ import Foundation enum ParseConstants { static let sdk = "swift" - static let version = "1.11.0" + static let version = "2.0.0" static let fileManagementDirectory = "parse/" static let fileManagementPrivateDocumentsDirectory = "Private Documents/" static let fileManagementLibraryDirectory = "Library/" static let fileDownloadsDirectory = "Downloads" + static let bundlePrefix = "com.parse.ParseSwift" static let batchLimit = 50 #if os(iOS) static let deviceType = "ios" diff --git a/Sources/ParseSwift/Protocols/CloudObservable.swift b/Sources/ParseSwift/Protocols/CloudObservable.swift index 5e4e19f1d..dbab40b65 100644 --- a/Sources/ParseSwift/Protocols/CloudObservable.swift +++ b/Sources/ParseSwift/Protocols/CloudObservable.swift @@ -12,7 +12,6 @@ import Foundation This protocol describes the interface for creating a view model for `ParseCloud` functions and jobs. You can use this protocol on any custom class of yours, instead of `CloudViewModel`, if it fits your use case better. */ -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public protocol CloudObservable: ObservableObject { /// The `ParseObject` associated with this view model. diff --git a/Sources/ParseSwift/Protocols/Fileable.swift b/Sources/ParseSwift/Protocols/Fileable.swift index a5465fab6..50e9060e5 100644 --- a/Sources/ParseSwift/Protocols/Fileable.swift +++ b/Sources/ParseSwift/Protocols/Fileable.swift @@ -8,7 +8,7 @@ import Foundation -protocol Fileable: ParseType, Decodable, LocallyIdentifiable { +protocol Fileable: ParseType, Decodable, Identifiable { var __type: String { get } // swiftlint:disable:this identifier_name var name: String { get set } var url: URL? { get set } @@ -23,14 +23,14 @@ extension Fileable { if let url = url { hasher.combine(url) } else { - hasher.combine(self.localId) + hasher.combine(self.id) } } public static func == (lhs: Self, rhs: Self) -> Bool { guard let lURL = lhs.url, let rURL = rhs.url else { - return lhs.localId == rhs.localId + return lhs.id == rhs.id } return lURL == rURL } diff --git a/Sources/ParseSwift/Protocols/LocallyIdentifiable.swift b/Sources/ParseSwift/Protocols/LocallyIdentifiable.swift deleted file mode 100644 index d6dc08677..000000000 --- a/Sources/ParseSwift/Protocols/LocallyIdentifiable.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// LocallyIdentifiable.swift -// ParseSwift -// -// Created by Corey Baker on 12/31/20. -// Copyright © 2020 Parse Community. All rights reserved. -// - -import Foundation - -public protocol LocallyIdentifiable: Encodable, Hashable { - var localId: UUID { get set } -} - -extension LocallyIdentifiable { - - mutating func hash(into hasher: inout Hasher) { - hasher.combine(self.localId) - } - - static func == (lhs: Self, rhs: Self) -> Bool { - return lhs.localId == rhs.localId - } -} diff --git a/Sources/ParseSwift/Protocols/QueryObservable.swift b/Sources/ParseSwift/Protocols/QueryObservable.swift index 8e6fcc1a4..d0a6017ce 100644 --- a/Sources/ParseSwift/Protocols/QueryObservable.swift +++ b/Sources/ParseSwift/Protocols/QueryObservable.swift @@ -13,7 +13,6 @@ import Foundation This protocol describes the interface for creating a view model for a `Query`. You can use this protocol on any custom class of yours, instead of `QueryViewModel`, if it fits your use case better. */ -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public protocol QueryObservable: ObservableObject { /// The `ParseObject` associated with this view model. diff --git a/Sources/ParseSwift/Storage/ParseFileManager.swift b/Sources/ParseSwift/Storage/ParseFileManager.swift index 9236404b5..536962eca 100644 --- a/Sources/ParseSwift/Storage/ParseFileManager.swift +++ b/Sources/ParseSwift/Storage/ParseFileManager.swift @@ -89,7 +89,7 @@ public struct ParseFileManager { public init?() { #if os(Linux) || os(Android) let applicationId = ParseSwift.configuration.applicationId - applicationIdentifier = "com.parse.ParseSwift.\(applicationId)" + applicationIdentifier = "\(ParseConstants.bundlePrefix).\(applicationId)" #else if let identifier = Bundle.main.bundleIdentifier { applicationIdentifier = identifier diff --git a/Sources/ParseSwift/Types/CloudViewModel.swift b/Sources/ParseSwift/Types/CloudViewModel.swift index d04bb7b0b..c6515c50c 100644 --- a/Sources/ParseSwift/Types/CloudViewModel.swift +++ b/Sources/ParseSwift/Types/CloudViewModel.swift @@ -12,7 +12,6 @@ import Foundation A default implementation of the `CloudCodeObservable` protocol. Suitable for `ObjectObserved` and can be used as a SwiftUI view model. */ -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) open class CloudViewModel: CloudObservable { public typealias CloudCodeType = T @@ -68,7 +67,6 @@ open class CloudViewModel: CloudObservable { } // MARK: CloudCodeViewModel -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseCloud { /** diff --git a/Sources/ParseSwift/Types/ParseAnalytics+combine.swift b/Sources/ParseSwift/Types/ParseAnalytics+combine.swift index 49763431c..80a66bdfd 100644 --- a/Sources/ParseSwift/Types/ParseAnalytics+combine.swift +++ b/Sources/ParseSwift/Types/ParseAnalytics+combine.swift @@ -14,7 +14,6 @@ import Combine import UIKit #endif -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseAnalytics { // MARK: Combine diff --git a/Sources/ParseSwift/Types/ParseCloud+combine.swift b/Sources/ParseSwift/Types/ParseCloud+combine.swift index 3e6370373..c5b16ef4d 100644 --- a/Sources/ParseSwift/Types/ParseCloud+combine.swift +++ b/Sources/ParseSwift/Types/ParseCloud+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseCloud { // MARK: Functions - Combine diff --git a/Sources/ParseSwift/Types/ParseConfig+combine.swift b/Sources/ParseSwift/Types/ParseConfig+combine.swift index e362d7155..18fae84fb 100644 --- a/Sources/ParseSwift/Types/ParseConfig+combine.swift +++ b/Sources/ParseSwift/Types/ParseConfig+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseConfig { // MARK: Fetchable - Combine diff --git a/Sources/ParseSwift/Types/ParseFile+combine.swift b/Sources/ParseSwift/Types/ParseFile+combine.swift index b24e053c2..9c89187ab 100644 --- a/Sources/ParseSwift/Types/ParseFile+combine.swift +++ b/Sources/ParseSwift/Types/ParseFile+combine.swift @@ -13,7 +13,6 @@ import FoundationNetworking #endif import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseFile { // MARK: Combine diff --git a/Sources/ParseSwift/Types/ParseFile.swift b/Sources/ParseSwift/Types/ParseFile.swift index 9352d2718..a92c9cef7 100644 --- a/Sources/ParseSwift/Types/ParseFile.swift +++ b/Sources/ParseSwift/Types/ParseFile.swift @@ -18,7 +18,7 @@ public struct ParseFile: Fileable, Savable, Fetchable, Deletable, Hashable { && data == nil } - public var localId: UUID + public var id: UUID // swiftlint:disable:this identifier_name /** The name of the file. @@ -83,7 +83,7 @@ public struct ParseFile: Fileable, Savable, Fetchable, Deletable, Hashable { self.metadata = metadata self.tags = tags self.options = options - self.localId = UUID() + self.id = UUID() } /** @@ -109,7 +109,7 @@ public struct ParseFile: Fileable, Savable, Fetchable, Deletable, Hashable { self.metadata = metadata self.tags = tags self.options = options - self.localId = UUID() + self.id = UUID() } /** @@ -135,7 +135,7 @@ public struct ParseFile: Fileable, Savable, Fetchable, Deletable, Hashable { self.metadata = metadata self.tags = tags self.options = options - self.localId = UUID() + self.id = UUID() } enum CodingKeys: String, CodingKey { @@ -150,7 +150,7 @@ extension ParseFile { let values = try decoder.container(keyedBy: CodingKeys.self) url = try values.decode(URL.self, forKey: .url) name = try values.decode(String.self, forKey: .name) - localId = UUID() + id = UUID() } } diff --git a/Sources/ParseSwift/Types/ParseHealth+combine.swift b/Sources/ParseSwift/Types/ParseHealth+combine.swift index 91aa7778d..e4873fbab 100644 --- a/Sources/ParseSwift/Types/ParseHealth+combine.swift +++ b/Sources/ParseSwift/Types/ParseHealth+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension ParseHealth { // MARK: Combine diff --git a/Sources/ParseSwift/Types/Pointer.swift b/Sources/ParseSwift/Types/Pointer.swift index a87a2eafd..46f55dcf6 100644 --- a/Sources/ParseSwift/Types/Pointer.swift +++ b/Sources/ParseSwift/Types/Pointer.swift @@ -137,7 +137,6 @@ public extension Pointer { - parameter options: A set of header options sent to the server. Defaults to an empty set. - returns: A publisher that eventually produces a single value and then finishes or fails. */ - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func fetchPublisher(includeKeys: [String]? = nil, options: API.Options = []) -> Future { Future { promise in diff --git a/Sources/ParseSwift/Types/Query+combine.swift b/Sources/ParseSwift/Types/Query+combine.swift index b743f1a09..234793623 100644 --- a/Sources/ParseSwift/Types/Query+combine.swift +++ b/Sources/ParseSwift/Types/Query+combine.swift @@ -10,7 +10,6 @@ import Foundation import Combine -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Query { // MARK: Queryable - Combine diff --git a/Sources/ParseSwift/Types/Query.swift b/Sources/ParseSwift/Types/Query.swift index f89493a82..9f0742262 100644 --- a/Sources/ParseSwift/Types/Query.swift +++ b/Sources/ParseSwift/Types/Query.swift @@ -916,7 +916,6 @@ public struct Query: Encodable, Equatable where T: ParseObject { - warning: This is only for `ParseLiveQuery`. - parameter keys: A variadic list of fields to receive back instead of the whole `ParseObject`. */ - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public func fields(_ keys: String...) -> Query { var mutableQuery = self if mutableQuery.fields != nil { @@ -938,7 +937,6 @@ public struct Query: Encodable, Equatable where T: ParseObject { - warning: This is only for `ParseLiveQuery`. - parameter keys: An array of fields to receive back instead of the whole `ParseObject`. */ - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public func fields(_ keys: [String]) -> Query { var mutableQuery = self if mutableQuery.fields != nil { diff --git a/Sources/ParseSwift/Types/QueryViewModel.swift b/Sources/ParseSwift/Types/QueryViewModel.swift index a3ba9cd1c..b52b92e7c 100644 --- a/Sources/ParseSwift/Types/QueryViewModel.swift +++ b/Sources/ParseSwift/Types/QueryViewModel.swift @@ -13,7 +13,6 @@ import Foundation A default implementation of the `QueryObservable` protocol. Suitable for `ObjectObserved` and can be used as a SwiftUI view model. */ -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) open class QueryViewModel: QueryObservable { public var query: Query @@ -113,7 +112,6 @@ open class QueryViewModel: QueryObservable { } // MARK: QueryViewModel -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) public extension Query { /** diff --git a/Tests/ParseSwiftTests/IOS13Tests.swift b/Tests/ParseSwiftTests/IOS13Tests.swift index 041280579..62eee6bed 100644 --- a/Tests/ParseSwiftTests/IOS13Tests.swift +++ b/Tests/ParseSwiftTests/IOS13Tests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class IOS13Tests: XCTestCase { // swiftlint:disable:this type_body_length struct Level: ParseObject { var objectId: String? @@ -24,15 +23,7 @@ class IOS13Tests: XCTestCase { // swiftlint:disable:this type_body_length var name = "First" } - struct GameScore: ParseObject, Identifiable { - - // Comform to Identifiable - var id: String { // swiftlint:disable:this identifier_name - guard let objectId = self.objectId else { - return UUID().uuidString - } - return objectId - } + struct GameScore: ParseObject { //: Those are required for Object var objectId: String? diff --git a/Tests/ParseSwiftTests/InitializeSDKTests.swift b/Tests/ParseSwiftTests/InitializeSDKTests.swift index 65217a2e5..a0c265039 100644 --- a/Tests/ParseSwiftTests/InitializeSDKTests.swift +++ b/Tests/ParseSwiftTests/InitializeSDKTests.swift @@ -51,6 +51,58 @@ class InitializeSDKTests: XCTestCase { try ParseStorage.shared.deleteAll() } + #if !os(Linux) && !os(Android) + func testDeleteKeychainOnFirstRun() throws { + let memory = InMemoryKeyValueStore() + ParseStorage.shared.use(memory) + guard let server = URL(string: "http://parse.com") else { + XCTFail("Should have unwrapped") + return + } + ParseSwift.configuration = ParseConfiguration(applicationId: "yo", + serverURL: server, + deleteKeychainIfNeeded: false) + let key = "Hello" + let value = "World" + try KeychainStore.shared.set(value, for: key) + + // Keychain should contain value on first run + ParseSwift.deleteKeychainIfNeeded() + let storedValue: String? = try KeychainStore.shared.get(valueFor: key) + XCTAssertEqual(storedValue, value) + guard let firstRun = UserDefaults.standard.object(forKey: ParseConstants.bundlePrefix) as? String else { + XCTFail("Should have unwrapped") + return + } + XCTAssertEqual(firstRun, ParseConstants.bundlePrefix) + + // Keychain should remain unchanged on 2+ runs + ParseSwift.configuration.deleteKeychainIfNeeded = true + ParseSwift.deleteKeychainIfNeeded() + let storedValue2: String? = try KeychainStore.shared.get(valueFor: key) + XCTAssertEqual(storedValue2, value) + guard let firstRun2 = UserDefaults.standard.object(forKey: ParseConstants.bundlePrefix) as? String else { + XCTFail("Should have unwrapped") + return + } + XCTAssertEqual(firstRun2, ParseConstants.bundlePrefix) + + // Keychain should delete on first run + UserDefaults.standard.removeObject(forKey: ParseConstants.bundlePrefix) + UserDefaults.standard.synchronize() + let firstRun3 = UserDefaults.standard.object(forKey: ParseConstants.bundlePrefix) as? String + XCTAssertNil(firstRun3) + ParseSwift.deleteKeychainIfNeeded() + let storedValue3: String? = try KeychainStore.shared.get(valueFor: key) + XCTAssertNil(storedValue3) + guard let firstRun4 = UserDefaults.standard.object(forKey: ParseConstants.bundlePrefix) as? String else { + XCTFail("Should have unwrapped") + return + } + XCTAssertEqual(firstRun4, ParseConstants.bundlePrefix) + } + #endif + func testCreateParseInstallationOnInit() { guard let url = URL(string: "http://localhost:1337/1") else { XCTFail("Should create valid URL") diff --git a/Tests/ParseSwiftTests/ParseAnanlyticsCombineTests.swift b/Tests/ParseSwiftTests/ParseAnanlyticsCombineTests.swift index 895b2fa2e..2e442ae85 100644 --- a/Tests/ParseSwiftTests/ParseAnanlyticsCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAnanlyticsCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseAnanlyticsCombineTests: XCTestCase { // swiftlint:disable:this type_body_length override func setUpWithError() throws { diff --git a/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift b/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift index 0f4f31e5e..d71ce7661 100644 --- a/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAnonymousCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseAnonymousCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { diff --git a/Tests/ParseSwiftTests/ParseAppleCombineTests.swift b/Tests/ParseSwiftTests/ParseAppleCombineTests.swift index 5babd6447..82bcface5 100644 --- a/Tests/ParseSwiftTests/ParseAppleCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAppleCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseAppleCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { diff --git a/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift b/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift index f7efebce2..c5fd82fed 100644 --- a/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseAuthenticationCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseAuthenticationCombineTests: XCTestCase { struct User: ParseUser { @@ -84,7 +83,6 @@ class ParseAuthenticationCombineTests: XCTestCase { } #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func loginPublisher(authData: [String: String], options: API.Options) -> Future { let error = ParseError(code: .unknownError, message: "Not implemented") @@ -93,7 +91,6 @@ class ParseAuthenticationCombineTests: XCTestCase { } } - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func linkPublisher(authData: [String: String], options: API.Options) -> Future { let error = ParseError(code: .unknownError, message: "Not implemented") diff --git a/Tests/ParseSwiftTests/ParseAuthenticationTests.swift b/Tests/ParseSwiftTests/ParseAuthenticationTests.swift index 1e60b344f..215e5b9a0 100644 --- a/Tests/ParseSwiftTests/ParseAuthenticationTests.swift +++ b/Tests/ParseSwiftTests/ParseAuthenticationTests.swift @@ -83,7 +83,6 @@ class ParseAuthenticationTests: XCTestCase { } #if canImport(Combine) - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func loginPublisher(authData: [String: String], options: API.Options) -> Future { let error = ParseError(code: .unknownError, message: "Not implemented") @@ -92,7 +91,6 @@ class ParseAuthenticationTests: XCTestCase { } } - @available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) func linkPublisher(authData: [String: String], options: API.Options) -> Future { let error = ParseError(code: .unknownError, message: "Not implemented") diff --git a/Tests/ParseSwiftTests/ParseCloudCombineTests.swift b/Tests/ParseSwiftTests/ParseCloudCombineTests.swift index ebdbc9c78..a52970083 100644 --- a/Tests/ParseSwiftTests/ParseCloudCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseCloudCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseCloudCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct Cloud: ParseCloud { diff --git a/Tests/ParseSwiftTests/ParseCloudViewModelTests.swift b/Tests/ParseSwiftTests/ParseCloudViewModelTests.swift index de05b3f16..fae640c94 100644 --- a/Tests/ParseSwiftTests/ParseCloudViewModelTests.swift +++ b/Tests/ParseSwiftTests/ParseCloudViewModelTests.swift @@ -11,7 +11,6 @@ import Foundation import XCTest @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseCloudViewModelTests: XCTestCase { struct Cloud: ParseCloud { typealias ReturnType = String? // swiftlint:disable:this nesting diff --git a/Tests/ParseSwiftTests/ParseConfigCombineTests.swift b/Tests/ParseSwiftTests/ParseConfigCombineTests.swift index ac725a262..7c22cb84c 100644 --- a/Tests/ParseSwiftTests/ParseConfigCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseConfigCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseConfigCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct Config: ParseConfig { diff --git a/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift b/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift index 6f6b511dd..690b74d70 100644 --- a/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseFacebookCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseFacebookCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { diff --git a/Tests/ParseSwiftTests/ParseFileCombineTests.swift b/Tests/ParseSwiftTests/ParseFileCombineTests.swift index 46e2f5275..2c1283fe1 100644 --- a/Tests/ParseSwiftTests/ParseFileCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseFileCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseFileCombineTests: XCTestCase { // swiftlint:disable:this type_body_length let temporaryDirectory = "\(NSTemporaryDirectory())test/" diff --git a/Tests/ParseSwiftTests/ParseFileTests.swift b/Tests/ParseSwiftTests/ParseFileTests.swift index 6065057a5..c95a48220 100644 --- a/Tests/ParseSwiftTests/ParseFileTests.swift +++ b/Tests/ParseSwiftTests/ParseFileTests.swift @@ -159,10 +159,10 @@ class ParseFileTests: XCTestCase { // swiftlint:disable:this type_body_length throw ParseError(code: .unknownError, message: "Should have converted to data") } let parseFile = ParseFile(name: "sampleData.txt", data: sampleData) - let localId = parseFile.localId + let localId = parseFile.id XCTAssertNotNil(localId) XCTAssertEqual(localId, - parseFile.localId, + parseFile.id, "localId should remain the same no matter how many times the getter is called") } @@ -188,8 +188,8 @@ class ParseFileTests: XCTestCase { // swiftlint:disable:this type_body_length parseFile2.url = nil XCTAssertNotEqual(parseFile1, parseFile2, "no urls, but localIds shoud be different") let uuid = UUID() - parseFile1.localId = uuid - parseFile2.localId = uuid + parseFile1.id = uuid + parseFile2.id = uuid XCTAssertEqual(parseFile1, parseFile2, "no urls, but localIds shoud be the same") } diff --git a/Tests/ParseSwiftTests/ParseHealthCombineTests.swift b/Tests/ParseSwiftTests/ParseHealthCombineTests.swift index 1d3a5ca0e..c78c43516 100644 --- a/Tests/ParseSwiftTests/ParseHealthCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseHealthCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseHealthCombineTests: XCTestCase { override func setUpWithError() throws { try super.setUpWithError() diff --git a/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift b/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift index 40f57dee5..80c2887ea 100644 --- a/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseInstallationCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseInstallationCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { diff --git a/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift b/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift index 55abdda6b..8af5b956b 100644 --- a/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseLDAPCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseLDAPCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { diff --git a/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift b/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift index ddda3e3d0..fabcb8f3a 100644 --- a/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseLiveQueryCombineTests.swift @@ -14,7 +14,6 @@ import XCTest import Combine #endif -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseLiveQueryCombineTests: XCTestCase { override func setUpWithError() throws { diff --git a/Tests/ParseSwiftTests/ParseLiveQueryTests.swift b/Tests/ParseSwiftTests/ParseLiveQueryTests.swift index e0051ed4b..ec4f198ab 100644 --- a/Tests/ParseSwiftTests/ParseLiveQueryTests.swift +++ b/Tests/ParseSwiftTests/ParseLiveQueryTests.swift @@ -10,7 +10,6 @@ import Foundation import XCTest @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseLiveQueryTests: XCTestCase { struct GameScore: ParseObject { //: Those are required for Object diff --git a/Tests/ParseSwiftTests/ParseObjectCombineTests.swift b/Tests/ParseSwiftTests/ParseObjectCombineTests.swift index aeff600b2..11a2e5af6 100644 --- a/Tests/ParseSwiftTests/ParseObjectCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseObjectCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct GameScore: ParseObject { diff --git a/Tests/ParseSwiftTests/ParseOperationCombineTests.swift b/Tests/ParseSwiftTests/ParseOperationCombineTests.swift index bb41e3643..55e2e8e44 100644 --- a/Tests/ParseSwiftTests/ParseOperationCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseOperationCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseOperationCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct GameScore: ParseObject { diff --git a/Tests/ParseSwiftTests/ParsePointerCombineTests.swift b/Tests/ParseSwiftTests/ParsePointerCombineTests.swift index 8bff44f90..060a292fc 100644 --- a/Tests/ParseSwiftTests/ParsePointerCombineTests.swift +++ b/Tests/ParseSwiftTests/ParsePointerCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParsePointerCombineTests: XCTestCase { struct GameScore: ParseObject { diff --git a/Tests/ParseSwiftTests/ParseQueryCombineTests.swift b/Tests/ParseSwiftTests/ParseQueryCombineTests.swift index a72ad6415..57c5efdef 100644 --- a/Tests/ParseSwiftTests/ParseQueryCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseQueryCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct GameScore: ParseObject { diff --git a/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift b/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift index f4d1d44f0..1a68c8da1 100644 --- a/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryViewModelTests.swift @@ -11,7 +11,6 @@ import Foundation import XCTest @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseQueryViewModelTests: XCTestCase { struct GameScore: ParseObject { //: Those are required for Object diff --git a/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift b/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift index 53506857b..f991cdbb3 100644 --- a/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseTwitterCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseTwitterCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser { diff --git a/Tests/ParseSwiftTests/ParseUserCombineTests.swift b/Tests/ParseSwiftTests/ParseUserCombineTests.swift index 6d3e026da..4235ae5cc 100644 --- a/Tests/ParseSwiftTests/ParseUserCombineTests.swift +++ b/Tests/ParseSwiftTests/ParseUserCombineTests.swift @@ -13,7 +13,6 @@ import XCTest import Combine @testable import ParseSwift -@available(macOS 10.15, iOS 13.0, macCatalyst 13.0, watchOS 6.0, tvOS 13.0, *) class ParseUserCombineTests: XCTestCase { // swiftlint:disable:this type_body_length struct User: ParseUser {