From fc5b553736fca1471e53ec62f81f6bb6a16234b6 Mon Sep 17 00:00:00 2001 From: Corey Date: Thu, 28 Mar 2024 09:29:55 -0700 Subject: [PATCH 01/17] ci: Update Xcode to 15.3 --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a91922aea..92fb294bf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: env: CI_XCODE_OLDEST: '/Applications/Xcode_13.3.1.app/Contents/Developer' CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer' - CI_XCODE_LATEST: '/Applications/Xcode_15.2.app/Contents/Developer' + CI_XCODE_LATEST: '/Applications/Xcode_15.3.app/Contents/Developer' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 313a5c9069091da4ae46322cdc21c894495ba58c Mon Sep 17 00:00:00 2001 From: Corey Date: Thu, 28 Mar 2024 09:31:28 -0700 Subject: [PATCH 02/17] Update release.yml --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92d38ffaf..02d8d8e1f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: types: [published] env: CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer' - CI_XCODE_LATEST: '/Applications/Xcode_15.2.app/Contents/Developer' + CI_XCODE_LATEST: '/Applications/Xcode_15.3.app/Contents/Developer' jobs: cocoapods: From 33f5ede8a5fbbd57bf4d3b46365731377276c835 Mon Sep 17 00:00:00 2001 From: Corey Date: Mon, 8 Apr 2024 16:04:51 -0700 Subject: [PATCH 03/17] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92fb294bf..b93db8e8c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ concurrency: jobs: test: timeout-minutes: 25 - runs-on: macos-13 + runs-on: macos-14 strategy: matrix: destination: ['platform=iOS\ Simulator,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=visionOS\ Simulator,name=Apple\ Vision\ Pro', 'platform=macOS'] From 92715966cd899f9221570ab6529b06e08d1477d7 Mon Sep 17 00:00:00 2001 From: Corey Date: Fri, 17 May 2024 07:34:44 -0400 Subject: [PATCH 04/17] Update ci.yml --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b93db8e8c..f683ced6c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -130,6 +130,7 @@ jobs: with: env_vars: LINUX fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} windows: timeout-minutes: 15 From 67d7651d6c0f03c6d73fa56e4ce95e5bbcb2c872 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Fri, 17 May 2024 07:45:53 -0400 Subject: [PATCH 05/17] fix test host for xrsimulator --- ParseSwift.xcodeproj/project.pbxproj | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ParseSwift.xcodeproj/project.pbxproj b/ParseSwift.xcodeproj/project.pbxproj index d529806d3..edd2940c1 100644 --- a/ParseSwift.xcodeproj/project.pbxproj +++ b/ParseSwift.xcodeproj/project.pbxproj @@ -2155,7 +2155,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; - SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos"; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos xrsimulator xros"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; @@ -2200,7 +2200,7 @@ PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost; PRODUCT_NAME = "$(TARGET_NAME)"; SDKROOT = auto; - SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos"; + SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos xrsimulator xros"; SUPPORTS_MACCATALYST = NO; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; From c790d361e042c7495e1b300a0849d2bc6da3f055 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Fri, 17 May 2024 07:50:32 -0400 Subject: [PATCH 06/17] add visionOS to targeted devices --- ParseSwift.xcodeproj/project.pbxproj | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/ParseSwift.xcodeproj/project.pbxproj b/ParseSwift.xcodeproj/project.pbxproj index edd2940c1..945bd3ec5 100644 --- a/ParseSwift.xcodeproj/project.pbxproj +++ b/ParseSwift.xcodeproj/project.pbxproj @@ -2021,7 +2021,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,3,4"; + TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7"; TVOS_DEPLOYMENT_TARGET = 13.0; WATCHOS_DEPLOYMENT_TARGET = 6.0; }; @@ -2056,7 +2056,7 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_SWIFT3_OBJC_INFERENCE = Off; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,3,4"; + TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7"; TVOS_DEPLOYMENT_TARGET = 13.0; WATCHOS_DEPLOYMENT_TARGET = 6.0; }; @@ -2086,7 +2086,7 @@ SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,3,4"; + TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestHost"; }; name = Debug; @@ -2115,7 +2115,7 @@ SUPPORTS_MACCATALYST = YES; SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,3,4"; + TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7"; TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestHost"; }; name = Release; @@ -2160,7 +2160,6 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,3"; TVOS_DEPLOYMENT_TARGET = 14.0; WATCHOS_DEPLOYMENT_TARGET = 7.0; }; @@ -2205,7 +2204,6 @@ SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO; SWIFT_EMIT_LOC_STRINGS = YES; SWIFT_VERSION = 5.0; - TARGETED_DEVICE_FAMILY = "1,2,3"; TVOS_DEPLOYMENT_TARGET = 14.0; WATCHOS_DEPLOYMENT_TARGET = 7.0; }; From f0721918cc8a5c60a7e5224af3c50ec257b93cd5 Mon Sep 17 00:00:00 2001 From: Corey Date: Fri, 17 May 2024 08:04:59 -0400 Subject: [PATCH 07/17] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f683ced6c..ac0862d55 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -129,7 +129,7 @@ jobs: uses: codecov/codecov-action@v3 with: env_vars: LINUX - fail_ci_if_error: true + fail_ci_if_error: false token: ${{ secrets.CODECOV_TOKEN }} windows: From 424e85d1998015a1164bd4540feda55db3f0ab27 Mon Sep 17 00:00:00 2001 From: Corey Date: Fri, 17 May 2024 11:16:42 -0400 Subject: [PATCH 08/17] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8eaf1af30..1d8ae10bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ on: env: CI_XCODE_OLDEST: '/Applications/Xcode_13.3.1.app/Contents/Developer' CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer' - CI_XCODE_LATEST: '/Applications/Xcode_15.3.app/Contents/Developer' + CI_XCODE_LATEST: '/Applications/Xcode_15.4.app/Contents/Developer' concurrency: group: ${{ github.workflow }}-${{ github.ref }} From 2a00ea90f51b19baf39a1dd041645550c604e975 Mon Sep 17 00:00:00 2001 From: Corey Date: Fri, 17 May 2024 12:03:16 -0400 Subject: [PATCH 09/17] install SwiftLint --- .github/workflows/ci.yml | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d8ae10bd..e6560661f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,8 +37,8 @@ jobs: action: 'test' steps: - uses: actions/checkout@v4 - - name: Use multiple cores - run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 + - name: Install SwiftLint + run: brew install swiftlint - name: Create and set the default keychain run: | security create-keychain -p "" temporary @@ -77,8 +77,8 @@ jobs: security default-keychain -s temporary security unlock-keychain -p "" temporary security set-keychain-settings -lut 7200 temporary - - name: Use multiple cores - run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 + - name: Install SwiftLint + run: brew install swiftlint - name: Build-Test run: set -o pipefail && env NSUnbufferedIO=YES swift test --enable-code-coverage | xcpretty -c env: @@ -159,8 +159,6 @@ jobs: runs-on: macos-14 steps: - uses: actions/checkout@v4 - - name: Use multiple cores - run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - name: Generate Docs run: set -o pipefail && env NSUnbufferedIO=YES Scripts/generate-documentation env: @@ -171,8 +169,6 @@ jobs: runs-on: macos-14 steps: - uses: actions/checkout@v4 - - name: Use multiple cores - run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - name: Update Framework Version run: ./Scripts/update_build env: From c2f2e125bdc578de0e3523462edc13236c59ff0f Mon Sep 17 00:00:00 2001 From: Corey Date: Fri, 17 May 2024 12:04:07 -0400 Subject: [PATCH 10/17] Update release.yml --- .github/workflows/release.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 02d8d8e1f..eb211ec90 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,7 +4,7 @@ on: types: [published] env: CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer' - CI_XCODE_LATEST: '/Applications/Xcode_15.3.app/Contents/Developer' + CI_XCODE_LATEST: '/Applications/Xcode_15.4.app/Contents/Developer' jobs: cocoapods: @@ -13,8 +13,6 @@ jobs: - uses: actions/checkout@v4 - name: Get release version run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - name: Use multiple cores - run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - name: Update Framework Version run: ./Scripts/update_build env: @@ -31,8 +29,6 @@ jobs: - uses: actions/checkout@v4 - name: Get release version run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV - - name: Use multiple cores - run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1 - name: Build and Deploy Docs run: set -o pipefail && env NSUnbufferedIO=YES Scripts/update-gh-pages-documentation-site env: From f93f69644f2b47116f3957fd99d7547a6477dbe8 Mon Sep 17 00:00:00 2001 From: Corey Date: Fri, 17 May 2024 12:14:37 -0400 Subject: [PATCH 11/17] Update ci.yml --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e6560661f..ef8fbfeab 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -131,7 +131,7 @@ jobs: uses: codecov/codecov-action@v4 with: env_vars: LINUX - fail_ci_if_error: false + fail_ci_if_error: true token: ${{ secrets.CODECOV_TOKEN }} windows: From 8132c6492cc76d732632f1a9178365f517f2b2dc Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Sun, 23 Jun 2024 21:47:46 -0700 Subject: [PATCH 12/17] fix swiftlint non_optional_string_data_conversion --- .swiftlint.yml | 1 + .../9 - Files.xcplaygroundpage/Contents.swift | 4 +- Sources/ParseSwift/API/API.swift | 8 +-- .../3rd Party/ParseApple/ParseApple.swift | 4 +- Sources/ParseSwift/Coding/AnyCodable.swift | 2 +- Sources/ParseSwift/Coding/AnyEncodable.swift | 2 +- Sources/ParseSwift/Coding/ParseCoding.swift | 3 +- Sources/ParseSwift/Extensions/Encodable.swift | 9 ++-- .../ParseSwift/Extensions/URLSession.swift | 3 +- .../LiveQuery/LiveQuerySocket.swift | 10 +--- .../ParseSwift/LiveQuery/ParseLiveQuery.swift | 2 +- Sources/ParseSwift/Objects/ParseObject.swift | 5 +- Sources/ParseSwift/Protocols/Objectable.swift | 4 +- .../ParseSwift/Protocols/ParseEncodable.swift | 5 +- .../Protocols/ParseOperationable.swift | 7 ++- .../ParseSwift/Protocols/ParseTypeable.swift | 7 ++- Sources/ParseSwift/Types/ParseError.swift | 2 +- .../ParseSwift/Types/ParseFieldOptions.swift | 7 ++- Sources/ParseSwift/Types/ParseFile.swift | 4 +- Sources/ParseSwift/Types/ParseOperation.swift | 7 ++- Sources/ParseSwift/Types/Query.swift | 19 ++++--- Tests/ParseSwiftTests/IOS13Tests.swift | 2 +- .../ParseSwiftTests/ParseAnalyticsTests.swift | 2 +- .../ParseSwiftTests/ParseFileAsyncTests.swift | 10 ++-- .../ParseHookFunctionRequestTests.swift | 5 +- .../ParseSwiftTests/ParseLiveQueryTests.swift | 26 +++++----- .../ParseObjectBatchTests.swift | 10 ++-- .../ParseObjectCustomObjectIdTests.swift | 24 ++++----- Tests/ParseSwiftTests/ParseObjectTests.swift | 6 +-- .../ParseSwiftTests/ParseOperationTests.swift | 52 +++++++++---------- Tests/ParseSwiftTests/ParsePointerTests.swift | 4 +- Tests/ParseSwiftTests/ParsePushTests.swift | 8 +-- Tests/ParseSwiftTests/ParseQueryTests.swift | 46 ++++++---------- .../ParseSwiftTests/ParseRelationTests.swift | 48 ++++++++--------- Tests/ParseSwiftTests/ParseRoleTests.swift | 24 ++++----- Tests/ParseSwiftTests/ParseSessionTests.swift | 4 +- 36 files changed, 172 insertions(+), 214 deletions(-) diff --git a/.swiftlint.yml b/.swiftlint.yml index 7d412701d..bc875a404 100644 --- a/.swiftlint.yml +++ b/.swiftlint.yml @@ -2,6 +2,7 @@ disabled_rules: - file_length - identifier_name - blanket_disable_command + - non_optional_string_data_conversion excluded: # paths to ignore during linting. Takes precedence over `included`. - Tests/ParseSwiftTests/ParseEncoderTests - DerivedData diff --git a/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift b/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift index 390e152c8..991c90a21 100644 --- a/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift +++ b/ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift @@ -194,9 +194,7 @@ Task { assertionFailure("Data is not the same. Something went wrong.") } - guard let parseFileString = String(data: dataFromParseFile, encoding: .utf8) else { - fatalError("Error: Could not create String from data.") - } + let parseFileString = String(decoding: dataFromParseFile, as: UTF8.self) print("The data saved on parse is: \"\(parseFileString)\"") } else { assertionFailure("Error fetching: there should be a localURL") diff --git a/Sources/ParseSwift/API/API.swift b/Sources/ParseSwift/API/API.swift index 0caf8882b..2ad84e035 100644 --- a/Sources/ParseSwift/API/API.swift +++ b/Sources/ParseSwift/API/API.swift @@ -257,17 +257,17 @@ public struct API { case .removeMimeType: headers.removeValue(forKey: "Content-Type") case .metadata(let metadata): - metadata.forEach {(key, value) -> Void in + metadata.forEach {(key, value) in headers[key] = value } case .tags(let tags): - tags.forEach {(key, value) -> Void in + tags.forEach {(key, value) in headers[key] = value } case .context(let context): let context = AnyEncodable(context) - if let encoded = try? ParseCoding.jsonEncoder().encode(context), - let encodedString = String(data: encoded, encoding: .utf8) { + if let encoded = try? ParseCoding.jsonEncoder().encode(context) { + let encodedString = String(decoding: encoded, as: UTF8.self) headers["X-Parse-Cloud-Context"] = encodedString } default: diff --git a/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple.swift b/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple.swift index ff59c6584..4ee71b05c 100644 --- a/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple.swift +++ b/Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple.swift @@ -30,9 +30,7 @@ public struct ParseApple: ParseAuthentication { /// to a string. func makeDictionary(user: String, identityToken: Data) throws -> [String: String] { - guard let identityTokenString = String(data: identityToken, encoding: .utf8) else { - throw ParseError(code: .otherCause, message: "Could not convert identityToken to String") - } + let identityTokenString = String(decoding: identityToken, as: UTF8.self) return [AuthenticationKeys.id.rawValue: user, AuthenticationKeys.token.rawValue: identityTokenString] } diff --git a/Sources/ParseSwift/Coding/AnyCodable.swift b/Sources/ParseSwift/Coding/AnyCodable.swift index a25f13432..20f8ab831 100755 --- a/Sources/ParseSwift/Coding/AnyCodable.swift +++ b/Sources/ParseSwift/Coding/AnyCodable.swift @@ -73,7 +73,7 @@ extension AnyCodable: Hashable { public func hash(into hasher: inout Hasher) { do { let encodedData = try ParseCoding.jsonEncoder().encode(self) - let encodedString = String(data: encodedData, encoding: .utf8) + let encodedString = String(decoding: encodedData, as: UTF8.self) hasher.combine(encodedString) } catch { hasher.combine(0) diff --git a/Sources/ParseSwift/Coding/AnyEncodable.swift b/Sources/ParseSwift/Coding/AnyEncodable.swift index f5bfe3549..17e0f93b8 100755 --- a/Sources/ParseSwift/Coding/AnyEncodable.swift +++ b/Sources/ParseSwift/Coding/AnyEncodable.swift @@ -192,7 +192,7 @@ extension AnyEncodable: Hashable { public func hash(into hasher: inout Hasher) { do { let encodedData = try ParseCoding.jsonEncoder().encode(self) - let encodedString = String(data: encodedData, encoding: .utf8) + let encodedString = String(decoding: encodedData, as: UTF8.self) hasher.combine(encodedString) } catch { hasher.combine(0) diff --git a/Sources/ParseSwift/Coding/ParseCoding.swift b/Sources/ParseSwift/Coding/ParseCoding.swift index 06b5334dc..0c08a4cdc 100644 --- a/Sources/ParseSwift/Coding/ParseCoding.swift +++ b/Sources/ParseSwift/Coding/ParseCoding.swift @@ -125,8 +125,7 @@ extension ParseCoding { if let decoded = try container.decodeIfPresent(String.self, forKey: .iso), - let date = dateFormatter.date(from: decoded) - { + let date = dateFormatter.date(from: decoded) { return date } else { throw ParseError( diff --git a/Sources/ParseSwift/Extensions/Encodable.swift b/Sources/ParseSwift/Extensions/Encodable.swift index d3e53062b..cda89d65d 100644 --- a/Sources/ParseSwift/Extensions/Encodable.swift +++ b/Sources/ParseSwift/Extensions/Encodable.swift @@ -16,20 +16,17 @@ internal extension Encodable { self, acl: nil ), - let lhsString = String(data: lhsData, encoding: .utf8), let other = other, let rhsData = try? ParseCoding .parseEncoder() .encode( other, acl: nil - ), - let rhsString = String( - data: rhsData, - encoding: .utf8 - ) else { + ) else { return false } + let lhsString = String(decoding: lhsData, as: UTF8.self) + let rhsString = String(decoding: rhsData, as: UTF8.self) return lhsString == rhsString } } diff --git a/Sources/ParseSwift/Extensions/URLSession.swift b/Sources/ParseSwift/Extensions/URLSession.swift index 7e359a786..78cba485c 100644 --- a/Sources/ParseSwift/Extensions/URLSession.swift +++ b/Sources/ParseSwift/Extensions/URLSession.swift @@ -90,8 +90,9 @@ internal extension URLSession { return .failure(ParseError(message: "Error decoding parse-server response: \(response)", swift: error)) } + let errorString = String(decoding: json, as: UTF8.self) // swiftlint:disable:next line_length - return .failure(ParseError(message: "Error decoding parse-server response: \(response) with error: \(String(describing: error)) Format: \(String(describing: String(data: json, encoding: .utf8)))", + return .failure(ParseError(message: "Error decoding parse-server response: \(response) with error: \(String(describing: error)) Format: \(errorString)", swift: error)) } return .failure(parseError) diff --git a/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift b/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift index efd941851..32045d385 100644 --- a/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift +++ b/Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift @@ -57,10 +57,7 @@ extension LiveQuerySocket { .encode(await StandardMessage(operation: .connect, // swiftlint:disable:next line_length additionalProperties: Parse.configuration.liveQueryConnectionAdditionalProperties)) - guard let encodedAsString = String(data: encoded, encoding: .utf8) else { - throw ParseError(code: .otherCause, - message: "Could not encode connect message: \(encoded)") - } + let encodedAsString = String(decoding: encoded, as: UTF8.self) try await task.send(.string(encodedAsString)) await self.receive(task) } @@ -69,10 +66,7 @@ extension LiveQuerySocket { // MARK: Send extension LiveQuerySocket { func send(_ data: Data, task: URLSessionWebSocketTask) async throws { - guard let encodedAsString = String(data: data, encoding: .utf8) else { - throw ParseError(code: .otherCause, - message: "Could not encode data as string: \(data)") - } + let encodedAsString = String(decoding: data, as: UTF8.self) try await task.send(.string(encodedAsString)) } } diff --git a/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift b/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift index b1bb856f2..d4c951062 100644 --- a/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift +++ b/Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift @@ -233,7 +233,7 @@ Not attempting to open ParseLiveQuery socket anymore // Resubscribe to all subscriptions by moving them in front of pending var tempPendingSubscriptions = [(RequestId, SubscriptionRecord)]() let subscriptions = await self.subscriptions.getCurrent() - subscriptions.forEach { (key, value) -> Void in + subscriptions.forEach { (key, value) in tempPendingSubscriptions.append((key, value)) } await self.subscriptions.removeAll() diff --git a/Sources/ParseSwift/Objects/ParseObject.swift b/Sources/ParseSwift/Objects/ParseObject.swift index 9eb742c5c..ccb4e3973 100644 --- a/Sources/ParseSwift/Objects/ParseObject.swift +++ b/Sources/ParseSwift/Objects/ParseObject.swift @@ -721,11 +721,10 @@ transactions for this call. // MARK: CustomDebugStringConvertible extension ParseObject { public var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { return "\(className) ()" } - + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(className) (\(descriptionString))" } } diff --git a/Sources/ParseSwift/Protocols/Objectable.swift b/Sources/ParseSwift/Protocols/Objectable.swift index 854380692..da61dfa8d 100644 --- a/Sources/ParseSwift/Protocols/Objectable.swift +++ b/Sources/ParseSwift/Protocols/Objectable.swift @@ -103,9 +103,7 @@ extension Objectable { let encoded = try ParseCoding.parseEncoder().encode(object, acl: nil, batching: false) - guard let hashString = String(data: encoded, encoding: .utf8) else { - throw ParseError(code: .otherCause, message: "Could not create hash") - } + let hashString = String(decoding: encoded, as: UTF8.self) return hashString } diff --git a/Sources/ParseSwift/Protocols/ParseEncodable.swift b/Sources/ParseSwift/Protocols/ParseEncodable.swift index 395350cff..87dbb05b7 100644 --- a/Sources/ParseSwift/Protocols/ParseEncodable.swift +++ b/Sources/ParseSwift/Protocols/ParseEncodable.swift @@ -17,11 +17,10 @@ public protocol ParseEncodable: Encodable {} // MARK: CustomDebugStringConvertible extension ParseEncodable { public var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { return "()" } - + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(descriptionString)" } } diff --git a/Sources/ParseSwift/Protocols/ParseOperationable.swift b/Sources/ParseSwift/Protocols/ParseOperationable.swift index eacc9ab3b..9f4081258 100644 --- a/Sources/ParseSwift/Protocols/ParseOperationable.swift +++ b/Sources/ParseSwift/Protocols/ParseOperationable.swift @@ -19,11 +19,10 @@ public protocol ParseOperationable: Codable, // MARK: CustomDebugStringConvertible public extension ParseOperationable { var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { - return "()" + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { + return "()" } - + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(descriptionString)" } } diff --git a/Sources/ParseSwift/Protocols/ParseTypeable.swift b/Sources/ParseSwift/Protocols/ParseTypeable.swift index 63f4e40cb..555049652 100644 --- a/Sources/ParseSwift/Protocols/ParseTypeable.swift +++ b/Sources/ParseSwift/Protocols/ParseTypeable.swift @@ -19,11 +19,10 @@ public protocol ParseTypeable: Codable, // MARK: CustomDebugStringConvertible extension ParseTypeable { public var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { - return "()" + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { + return "()" } - + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(descriptionString)" } } diff --git a/Sources/ParseSwift/Types/ParseError.swift b/Sources/ParseSwift/Types/ParseError.swift index 93e3789e6..5478f9725 100644 --- a/Sources/ParseSwift/Types/ParseError.swift +++ b/Sources/ParseSwift/Types/ParseError.swift @@ -540,7 +540,7 @@ extension ParseError: LocalizedError { } } -// MARK: +// MARK: Equatable extension ParseError: Equatable { public static func == (lhs: Self, rhs: Self) -> Bool { lhs.code == rhs.code && diff --git a/Sources/ParseSwift/Types/ParseFieldOptions.swift b/Sources/ParseSwift/Types/ParseFieldOptions.swift index 73a7a7e99..b40230a9f 100644 --- a/Sources/ParseSwift/Types/ParseFieldOptions.swift +++ b/Sources/ParseSwift/Types/ParseFieldOptions.swift @@ -43,11 +43,10 @@ extension ParseFieldOptions where V: ParseObject { // MARK: CustomDebugStringConvertible extension ParseFieldOptions { public var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { - return "()" + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { + return "()" } - + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(descriptionString)" } } diff --git a/Sources/ParseSwift/Types/ParseFile.swift b/Sources/ParseSwift/Types/ParseFile.swift index 0e7cb1ca5..c33011109 100644 --- a/Sources/ParseSwift/Types/ParseFile.swift +++ b/Sources/ParseSwift/Types/ParseFile.swift @@ -520,10 +520,10 @@ extension ParseFile { // MARK: CustomDebugStringConvertible extension ParseFile: CustomDebugStringConvertible { public var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { return "()" } + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(descriptionString)" } } diff --git a/Sources/ParseSwift/Types/ParseOperation.swift b/Sources/ParseSwift/Types/ParseOperation.swift index 1a375911a..804bda361 100644 --- a/Sources/ParseSwift/Types/ParseOperation.swift +++ b/Sources/ParseSwift/Types/ParseOperation.swift @@ -439,11 +439,10 @@ public extension ParseObject { // MARK: CustomDebugStringConvertible public extension ParseOperation { var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { - return "()" + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { + return "()" } - + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(descriptionString)" } } diff --git a/Sources/ParseSwift/Types/Query.swift b/Sources/ParseSwift/Types/Query.swift index 07cdac0f0..6c3754d26 100644 --- a/Sources/ParseSwift/Types/Query.swift +++ b/Sources/ParseSwift/Types/Query.swift @@ -73,7 +73,7 @@ public struct Query: ParseTypeable where T: ParseObject { return nil } let encoded = try ParseCoding.jsonEncoder().encode(value) - return String(data: encoded, encoding: .utf8) + return String(decoding: encoded, as: UTF8.self) } } @@ -104,7 +104,7 @@ public struct Query: ParseTypeable where T: ParseObject { return nil } let encoded = try ParseCoding.jsonEncoder().encode(value) - return String(data: encoded, encoding: .utf8) + return String(decoding: encoded, as: UTF8.self) } } @@ -903,8 +903,7 @@ extension Query: Queryable { pipeline.forEach { updatedPipeline = $0.map { [$0.key: AnyCodable($0.value)] } } guard let encoded = try? ParseCoding.jsonEncoder() - .encode(self.`where`), - let whereString = String(data: encoded, encoding: .utf8) else { + .encode(self.`where`) else { let error = ParseError(code: .otherCause, message: "Cannot decode \"where\" to String.") callbackQueue.async { @@ -912,7 +911,7 @@ extension Query: Queryable { } return } - + let whereString = String(decoding: encoded, as: UTF8.self) var query = self query.`where` = QueryWhere() @@ -976,8 +975,7 @@ extension Query: Queryable { pipeline.forEach { updatedPipeline = $0.map { [$0.key: AnyCodable($0.value)] } } guard let encoded = try? ParseCoding.jsonEncoder() - .encode(self.`where`), - let whereString = String(data: encoded, encoding: .utf8) else { + .encode(self.`where`) else { let error = ParseError(code: .otherCause, message: "Cannot decode \"where\" to String.") callbackQueue.async { @@ -986,6 +984,7 @@ extension Query: Queryable { return } + let whereString = String(decoding: encoded, as: UTF8.self) var query = self query.`where` = QueryWhere() @@ -1710,7 +1709,7 @@ internal extension Query { return nil } let encoded = try ParseCoding.jsonEncoder().encode(value) - return String(data: encoded, encoding: .utf8) + return String(decoding: encoded, as: UTF8.self) } func encodeAsString(_ key: KeyPath?>) throws -> String? { @@ -1718,12 +1717,12 @@ internal extension Query { return nil } let encoded = try ParseCoding.jsonEncoder().encode(value) - return String(data: encoded, encoding: .utf8) + return String(decoding: encoded, as: UTF8.self) } func encodeAsString(_ key: KeyPath) throws -> String? where W: Encodable { let encoded = try ParseCoding.jsonEncoder().encode(self[keyPath: key]) - return String(data: encoded, encoding: .utf8) + return String(decoding: encoded, as: UTF8.self) } } // swiftlint:disable:this file_length diff --git a/Tests/ParseSwiftTests/IOS13Tests.swift b/Tests/ParseSwiftTests/IOS13Tests.swift index 662ba7680..e68724bc8 100644 --- a/Tests/ParseSwiftTests/IOS13Tests.swift +++ b/Tests/ParseSwiftTests/IOS13Tests.swift @@ -123,7 +123,7 @@ class IOS13Tests: XCTestCase { .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } } diff --git a/Tests/ParseSwiftTests/ParseAnalyticsTests.swift b/Tests/ParseSwiftTests/ParseAnalyticsTests.swift index fcdbdebc9..940604072 100644 --- a/Tests/ParseSwiftTests/ParseAnalyticsTests.swift +++ b/Tests/ParseSwiftTests/ParseAnalyticsTests.swift @@ -64,7 +64,7 @@ class ParseAnalyticsTests: XCTestCase { let expected2 = "{\"dimensions\":{\"stop\":\"drop\"},\"name\":\"hello\"}" XCTAssertEqual(decoded2, expected2) let encoded3 = try ParseCoding.parseEncoder().encode(event2) - let decoded3 = String(data: encoded3, encoding: .utf8) + let decoded3 = String(decoding: encoded3, as: UTF8.self) let expected3 = "{\"dimensions\":{\"stop\":\"drop\"}}" XCTAssertEqual(decoded3, expected3) } diff --git a/Tests/ParseSwiftTests/ParseFileAsyncTests.swift b/Tests/ParseSwiftTests/ParseFileAsyncTests.swift index 3dfe200eb..da920270f 100644 --- a/Tests/ParseSwiftTests/ParseFileAsyncTests.swift +++ b/Tests/ParseSwiftTests/ParseFileAsyncTests.swift @@ -316,9 +316,9 @@ class ParseFileAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let downloadTask = URLSession.shared.downloadTask(with: .init(fileURLWithPath: "http://localhost:1337/parse/files/applicationId/d3a37aed0672a024595b766f97133615_logo.svg")) let task = downloadTask as URLSessionTask // swiftlint:disable:next line_length - let uploadCompletion: ((URLSessionTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionTask, _: Int64, _: Int64, _: Int64) -> Void in } + let uploadCompletion: ((URLSessionTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionTask, _: Int64, _: Int64, _: Int64) in } // swiftlint:disable:next line_length - let downloadCompletion: ((URLSessionDownloadTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionDownloadTask, _: Int64, _: Int64, _: Int64) -> Void in } + let downloadCompletion: ((URLSessionDownloadTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionDownloadTask, _: Int64, _: Int64, _: Int64) in } // Add tasks Parse.sessionDelegate.streamDelegates[task] = .init(data: .init()) @@ -358,7 +358,7 @@ class ParseFileAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let expectation2 = XCTestExpectation(description: "Call delegate 2") // swiftlint:disable:next line_length - let uploadCompletion: ((URLSessionTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionTask, _: Int64, sent: Int64, total: Int64) -> Void in + let uploadCompletion: ((URLSessionTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionTask, _: Int64, sent: Int64, total: Int64) in if sent < total { Task { let uploadCount = await Parse.sessionDelegate.delegates.uploadDelegates.count @@ -429,7 +429,7 @@ class ParseFileAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let expectation2 = XCTestExpectation(description: "Call delegate 2") // swiftlint:disable:next line_length - let downloadCompletion: ((URLSessionDownloadTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionDownloadTask, _: Int64, sent: Int64, total: Int64) -> Void in + let downloadCompletion: ((URLSessionDownloadTask, Int64, Int64, Int64) -> Void) = { (_: URLSessionDownloadTask, _: Int64, sent: Int64, total: Int64) in if sent < total { Task { let downloadCount = await Parse.sessionDelegate.delegates.downloadDelegates.count @@ -497,7 +497,7 @@ class ParseFileAsyncTests: XCTestCase { // swiftlint:disable:this type_body_leng let expectation1 = XCTestExpectation(description: "Call delegate 1") let expectation2 = XCTestExpectation(description: "Call delegate 2") - let streamCompletion: ((InputStream?) -> Void) = { (_: InputStream?) -> Void in + let streamCompletion: ((InputStream?) -> Void) = { (_: InputStream?) in Task { let streamCount = Parse.sessionDelegate.streamDelegates.count let taskCount = await Parse.sessionDelegate.delegates.taskCallbackQueues.count diff --git a/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift b/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift index fa4e49d94..d0ad8eb5e 100644 --- a/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift +++ b/Tests/ParseSwiftTests/ParseHookFunctionRequestTests.swift @@ -82,10 +82,7 @@ class ParseHookFunctionRequestTests: XCTestCase { let failedLoginCount = 3 var accountLockoutExpiresAt = Date() let encodedDate = try ParseCoding.jsonEncoder().encode(accountLockoutExpiresAt) - guard let encodeedDateString = String(data: encodedDate, encoding: .utf8) else { - XCTFail("Should have unwrapped") - return - } + let encodeedDateString = String(decoding: encodedDate, as: UTF8.self) accountLockoutExpiresAt = try ParseCoding.jsonDecoder().decode(Date.self, from: encodedDate) // swiftlint:disable:next line_length let encodedString = "{\"className\":\"_User\",\"sessionToken\":\"\(sessionToken)\",\"_failed_login_count\":\(failedLoginCount),\"_account_lockout_expires_at\":\(encodeedDateString)}" diff --git a/Tests/ParseSwiftTests/ParseLiveQueryTests.swift b/Tests/ParseSwiftTests/ParseLiveQueryTests.swift index 41901390e..d1b6d1e3a 100644 --- a/Tests/ParseSwiftTests/ParseLiveQueryTests.swift +++ b/Tests/ParseSwiftTests/ParseLiveQueryTests.swift @@ -199,7 +199,7 @@ class ParseLiveQueryTests: XCTestCase { let message = await StandardMessage(operation: .connect, additionalProperties: true) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -209,7 +209,7 @@ class ParseLiveQueryTests: XCTestCase { let message = await StandardMessage(operation: .connect) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -223,7 +223,7 @@ class ParseLiveQueryTests: XCTestCase { let message = await StandardMessage(operation: .subscribe, additionalProperties: true) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -232,7 +232,7 @@ class ParseLiveQueryTests: XCTestCase { let message = await StandardMessage(operation: .subscribe, additionalProperties: false) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -248,7 +248,7 @@ class ParseLiveQueryTests: XCTestCase { additionalProperties: true) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -263,7 +263,7 @@ class ParseLiveQueryTests: XCTestCase { additionalProperties: true) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -304,7 +304,7 @@ class ParseLiveQueryTests: XCTestCase { additionalProperties: true) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -337,7 +337,7 @@ class ParseLiveQueryTests: XCTestCase { let message = RedirectResponse(op: .redirect, url: url) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -346,7 +346,7 @@ class ParseLiveQueryTests: XCTestCase { let message = ConnectionResponse(op: .connected, clientId: "yolo", installationId: "naw") let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -355,7 +355,7 @@ class ParseLiveQueryTests: XCTestCase { let message = UnsubscribedResponse(op: .connected, requestId: 1, clientId: "yolo", installationId: "naw") let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -370,7 +370,7 @@ class ParseLiveQueryTests: XCTestCase { installationId: "naw") let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -379,7 +379,7 @@ class ParseLiveQueryTests: XCTestCase { let message = ErrorResponse(op: .error, code: 1, message: "message", reconnect: true) let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -391,7 +391,7 @@ class ParseLiveQueryTests: XCTestCase { installationId: "naw") let encoded = try ParseCoding.jsonEncoder() .encode(message) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } diff --git a/Tests/ParseSwiftTests/ParseObjectBatchTests.swift b/Tests/ParseSwiftTests/ParseObjectBatchTests.swift index ec3dc3ff4..7e2abc9b4 100644 --- a/Tests/ParseSwiftTests/ParseObjectBatchTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectBatchTests.swift @@ -87,7 +87,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let expected = "{\"body\":{\"requests\":[{\"body\":{\"other\":{\"__type\":\"Pointer\",\"className\":\"Game2\",\"objectId\":\"brave\"},\"points\":10},\"method\":\"PUT\",\"path\":\"\\/parse\\/classes\\/GameScore\\/yolo\"}],\"transaction\":false},\"method\":\"POST\",\"path\":\"\\/batch\"}" let encoded = try ParseCoding.parseEncoder().encode(batch, batching: true) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -108,7 +108,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le let expected = "{\"body\":{\"requests\":[{\"body\":{\"other\":{\"__type\":\"Pointer\",\"className\":\"Game2\",\"objectId\":\"brave\"},\"points\":10},\"method\":\"PUT\",\"path\":\"\\/parse\\/classes\\/GameScore\\/yolo\"},{\"body\":{\"other\":{\"__type\":\"Pointer\",\"className\":\"Game2\",\"objectId\":\"brave\"},\"points\":10},\"method\":\"PUT\",\"path\":\"\\/parse\\/classes\\/GameScore\\/yolo\"}],\"transaction\":false},\"method\":\"POST\",\"path\":\"\\/batch\"}" let encoded = try ParseCoding.parseEncoder().encode(batch, batching: true) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -131,7 +131,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -555,7 +555,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -1150,7 +1150,7 @@ class ParseObjectBatchTests: XCTestCase { // swiftlint:disable:this type_body_le .encode(score, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } diff --git a/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift b/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift index 289bf3e90..dfd16ceaf 100644 --- a/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectCustomObjectIdTests.swift @@ -169,7 +169,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -197,7 +197,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -222,7 +222,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -249,7 +249,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -274,7 +274,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -300,7 +300,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -325,7 +325,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -352,7 +352,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -377,7 +377,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -403,7 +403,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -428,7 +428,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -455,7 +455,7 @@ class ParseObjectCustomObjectIdTests: XCTestCase { // swiftlint:disable:this typ collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } diff --git a/Tests/ParseSwiftTests/ParseObjectTests.swift b/Tests/ParseSwiftTests/ParseObjectTests.swift index ea002a26e..7cc648181 100644 --- a/Tests/ParseSwiftTests/ParseObjectTests.swift +++ b/Tests/ParseSwiftTests/ParseObjectTests.swift @@ -890,7 +890,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -918,7 +918,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) var empty = score.mergeable @@ -933,7 +933,7 @@ class ParseObjectTests: XCTestCase { // swiftlint:disable:this type_body_length .encode(body2, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) } diff --git a/Tests/ParseSwiftTests/ParseOperationTests.swift b/Tests/ParseSwiftTests/ParseOperationTests.swift index 4577bc4de..38c276aa1 100644 --- a/Tests/ParseSwiftTests/ParseOperationTests.swift +++ b/Tests/ParseSwiftTests/ParseOperationTests.swift @@ -112,7 +112,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"points\":{\"__op\":\"Increment\",\"amount\":1}}" let encoded = try ParseCoding.parseEncoder() .encode(body) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -454,7 +454,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"points\":{\"__op\":\"Increment\",\"amount\":1}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -472,7 +472,7 @@ class ParseOperationTests: XCTestCase { .increment("otherPoints", by: 1.1) let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertTrue(decoded.contains("otherPoints\":{\"__op\":\"Increment\",\"amount\":")) XCTAssertTrue(decoded.contains("1.1")) } @@ -484,7 +484,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"Add\",\"objects\":[\"hello\"]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -495,7 +495,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"Add\",\"objects\":[\"hello\"]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -506,7 +506,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"AddUnique\",\"objects\":[\"hello\"]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -517,7 +517,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"AddUnique\",\"objects\":[\"hello\"]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -531,7 +531,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"AddRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"yolo\"}]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -545,7 +545,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"previous\":{\"__op\":\"AddRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"yolo\"}]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -556,7 +556,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"Remove\",\"objects\":[\"hello\"]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -567,7 +567,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"Remove\",\"objects\":[\"hello\"]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -581,7 +581,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"yolo\"}]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -595,7 +595,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"previous\":{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"yolo\"}]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -617,7 +617,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"Batch\",\"ops\":[{\"__op\":\"Add\",\"objects\":[\"hello\"]},{\"__op\":\"Remove\",\"objects\":[\"world\"]}]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -635,7 +635,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"test\":{\"__op\":\"Batch\",\"ops\":[{\"__op\":\"AddRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"yolo\"}]},{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"yolo\"}]}]}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -646,7 +646,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"levels\":[\"hello\"],\"points\":15}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertEqual(operations.target.points, 15) var level = Level(level: 12) @@ -655,7 +655,7 @@ class ParseOperationTests: XCTestCase { let expected2 = "{\"previous\":[{\"level\":12,\"members\":[\"hello\",\"world\"]}]}" let encoded2 = try ParseCoding.parseEncoder() .encode(operations2) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) XCTAssertEqual(operations2.target.previous, [level]) let operations3 = score.operation.set(("points", \.points), to: nil) @@ -663,7 +663,7 @@ class ParseOperationTests: XCTestCase { let expected3 = "{\"levels\":[\"hello\"],\"points\":null}" let encoded3 = try ParseCoding.parseEncoder() .encode(operations3) - let decoded3 = try XCTUnwrap(String(data: encoded3, encoding: .utf8)) + let decoded3 = String(decoding: encoded3, as: UTF8.self) XCTAssertEqual(decoded3, expected3) XCTAssertNil(operations3.target.points) } @@ -726,7 +726,7 @@ class ParseOperationTests: XCTestCase { let expected = "{}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertEqual(operations.target.objectId, "test") var level = Level(level: 12) @@ -736,7 +736,7 @@ class ParseOperationTests: XCTestCase { let operations2 = score.operation.set(("previous", \.previous), to: [level]) let encoded2 = try ParseCoding.parseEncoder() .encode(operations2) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) XCTAssertEqual(operations2.target.previous, [level]) } @@ -747,14 +747,14 @@ class ParseOperationTests: XCTestCase { let expected = "{}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) let operations2 = score.operation .set(("levels", \.levels), to: nil) let expected2 = "{}" let encoded2 = try ParseCoding.parseEncoder() .encode(operations2) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) XCTAssertNil(operations2.target.levels) } @@ -765,14 +765,14 @@ class ParseOperationTests: XCTestCase { let expected = "{\"points\":10}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) let operations2 = score.operation .forceSet(("points", \.points), value: nil) let expected2 = "{\"points\":null}" let encoded2 = try ParseCoding.parseEncoder() .encode(operations2) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) XCTAssertNil(operations2.target.points) } @@ -784,7 +784,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"points\":{\"__op\":\"Delete\"}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -795,7 +795,7 @@ class ParseOperationTests: XCTestCase { let expected = "{\"points\":{\"__op\":\"Delete\"}}" let encoded = try ParseCoding.parseEncoder() .encode(operations) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } } diff --git a/Tests/ParseSwiftTests/ParsePointerTests.swift b/Tests/ParseSwiftTests/ParsePointerTests.swift index 772d551a1..1eb9302c7 100644 --- a/Tests/ParseSwiftTests/ParsePointerTests.swift +++ b/Tests/ParseSwiftTests/ParsePointerTests.swift @@ -315,7 +315,7 @@ class ParsePointerTests: XCTestCase { objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil) - let decoded = String(data: encoded.encoded, encoding: .utf8) + let decoded = String(decoding: encoded.encoded, as: UTF8.self) XCTAssertEqual(decoded, // swiftlint:disable:next line_length "{\"other\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"yarr\"},\"points\":50}") @@ -331,7 +331,7 @@ class ParsePointerTests: XCTestCase { let pointerType = try PointerType(score) let encoded = try ParseCoding.parseEncoder().encode(pointerType) - let decoded = String(data: encoded, encoding: .utf8) + let decoded = String(decoding: encoded, as: UTF8.self) XCTAssertEqual(decoded, "{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"yarr\"}") } diff --git a/Tests/ParseSwiftTests/ParsePushTests.swift b/Tests/ParseSwiftTests/ParsePushTests.swift index be3ba5e4f..741b9efd2 100644 --- a/Tests/ParseSwiftTests/ParsePushTests.swift +++ b/Tests/ParseSwiftTests/ParsePushTests.swift @@ -66,9 +66,7 @@ internal struct ParsePushStatusResponse: ParseObject { func setQueryWhere(_ query: QueryWhere) throws -> Self { var mutatingResponse = self let whereData = try ParseCoding.jsonEncoder().encode(query) - guard let whereString = String(data: whereData, encoding: .utf8) else { - throw ParseError(code: .otherCause, message: "Should have created String") - } + let whereString = String(decoding: whereData, as: UTF8.self) mutatingResponse.query = whereString return mutatingResponse } @@ -76,9 +74,7 @@ internal struct ParsePushStatusResponse: ParseObject { func setPayload(_ payload: V) throws -> Self { var mutatingResponse = self let payloadData = try ParseCoding.jsonEncoder().encode(payload) - guard let payloadString = String(data: payloadData, encoding: .utf8) else { - throw ParseError(code: .otherCause, message: "Should have created String") - } + let payloadString = String(decoding: payloadData, as: UTF8.self) mutatingResponse.payload = payloadString return mutatingResponse } diff --git a/Tests/ParseSwiftTests/ParseQueryTests.swift b/Tests/ParseSwiftTests/ParseQueryTests.swift index f0938583f..320ada440 100644 --- a/Tests/ParseSwiftTests/ParseQueryTests.swift +++ b/Tests/ParseSwiftTests/ParseQueryTests.swift @@ -92,9 +92,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length func encodeDoubleAsString(_ double: Double) throws -> String { let encodedDouble = try ParseCoding.jsonEncoder().encode(double) - guard let decodedDouble = String(data: encodedDouble, encoding: .utf8) else { - throw QueryTestError.couldNotDecodeAsString - } + let decodedDouble = String(decoding: encodedDouble, as: UTF8.self) return decodedDouble } @@ -373,7 +371,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length .select("yolo", "nolo") let encoded = try ParseCoding.jsonEncoder().encode(query) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, // swiftlint:disable:next line_length "{\"_method\":\"GET\",\"excludeKeys\":[\"hello\",\"world\"],\"include\":[\"bar\",\"foo\"],\"keys\":[\"nolo\",\"yolo\"],\"limit\":100,\"skip\":0,\"where\":{}}") @@ -442,7 +440,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{}},\"method\":\"POST\",\"path\":\"\\/classes\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -461,7 +459,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"_method\":\"GET\",\"explain\":true,\"limit\":100,\"skip\":0,\"where\":{}},\"method\":\"POST\",\"path\":\"\\/classes\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -785,7 +783,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"_method\":\"GET\",\"limit\":1,\"skip\":0,\"where\":{}},\"method\":\"POST\",\"path\":\"\\/classes\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -797,7 +795,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"_method\":\"GET\",\"explain\":true,\"limit\":1,\"skip\":0,\"where\":{}},\"method\":\"POST\",\"path\":\"\\/classes\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -1037,7 +1035,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"_method\":\"GET\",\"count\":true,\"limit\":0,\"skip\":0,\"where\":{}},\"method\":\"POST\",\"path\":\"\\/classes\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -1049,7 +1047,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"_method\":\"GET\",\"count\":true,\"explain\":true,\"limit\":1,\"skip\":0,\"where\":{}},\"method\":\"POST\",\"path\":\"\\/classes\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -2131,10 +2129,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length do { let encoded = try ParseCoding.jsonEncoder().encode(queryWhere) - guard let decoded = String(data: encoded, encoding: .utf8) else { - XCTFail("Should have casted") - return - } + let decoded = String(decoding: encoded, as: UTF8.self) XCTAssertEqual(expected, decoded) } catch { @@ -2154,10 +2149,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length do { let encoded = try ParseCoding.jsonEncoder().encode(queryWhere) - guard let decoded = String(data: encoded, encoding: .utf8) else { - XCTFail("Should have casted") - return - } + let decoded = String(decoding: encoded, as: UTF8.self) XCTAssertEqual(expected, decoded) } catch { @@ -2177,10 +2169,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length do { let encoded = try ParseCoding.jsonEncoder().encode(queryWhere) - guard let decoded = String(data: encoded, encoding: .utf8) else { - XCTFail("Should have casted") - return - } + let decoded = String(decoding: encoded, as: UTF8.self) XCTAssertEqual(expected, decoded) } catch { @@ -2200,10 +2189,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length do { let encoded = try ParseCoding.jsonEncoder().encode(queryWhere) - guard let decoded = String(data: encoded, encoding: .utf8) else { - XCTFail("Should have casted") - return - } + let decoded = String(decoding: encoded, as: UTF8.self) XCTAssertEqual(expected, decoded) } catch { @@ -3496,7 +3482,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"pipeline\":[{\"hello\":\"\(value)\"}]},\"method\":\"POST\",\"path\":\"\\/aggregate\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(aggregate) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -3507,7 +3493,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"explain\":true},\"method\":\"POST\",\"path\":\"\\/aggregate\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -3517,7 +3503,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"distinct\":\"hello\"},\"method\":\"POST\",\"path\":\"\\/aggregate\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(aggregate) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -3529,7 +3515,7 @@ class ParseQueryTests: XCTestCase { // swiftlint:disable:this type_body_length let expected = "{\"body\":{\"distinct\":\"hello\",\"explain\":true},\"method\":\"POST\",\"path\":\"\\/aggregate\\/GameScore\"}" let encoded = try ParseCoding.jsonEncoder() .encode(command) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } diff --git a/Tests/ParseSwiftTests/ParseRelationTests.swift b/Tests/ParseSwiftTests/ParseRelationTests.swift index 32995833b..b3809a07e 100644 --- a/Tests/ParseSwiftTests/ParseRelationTests.swift +++ b/Tests/ParseSwiftTests/ParseRelationTests.swift @@ -112,13 +112,13 @@ class ParseRelationTests: XCTestCase { let expected = "{\"__type\":\"Relation\"}" let encoded = try ParseCoding.jsonEncoder().encode(relation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) relation.className = "hello" let expected2 = "{\"__type\":\"Relation\",\"className\":\"hello\"}" let encoded2 = try ParseCoding.jsonEncoder().encode(relation) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) XCTAssertEqual(relation.debugDescription, "{\"__type\":\"Relation\",\"className\":\"hello\"}") @@ -141,31 +141,31 @@ class ParseRelationTests: XCTestCase { let expected = "{\"__type\":\"Relation\",\"className\":\"Level\"}" let encoded = try ParseCoding.jsonEncoder().encode(relation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) relation.className = "hello" let expected2 = "{\"__type\":\"Relation\",\"className\":\"hello\"}" let encoded2 = try ParseCoding.jsonEncoder().encode(relation) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) var relation2 = try score.relation("yolo", className: "Level") let expected3 = "{\"__type\":\"Relation\",\"className\":\"Level\"}" let encoded3 = try ParseCoding.jsonEncoder().encode(relation2) - let decoded3 = try XCTUnwrap(String(data: encoded3, encoding: .utf8)) + let decoded3 = String(decoding: encoded3, as: UTF8.self) XCTAssertEqual(decoded3, expected3) relation2.className = "hello" let expected4 = "{\"__type\":\"Relation\",\"className\":\"hello\"}" let encoded4 = try ParseCoding.jsonEncoder().encode(relation2) - let decoded4 = try XCTUnwrap(String(data: encoded4, encoding: .utf8)) + let decoded4 = String(decoding: encoded4, as: UTF8.self) XCTAssertEqual(decoded4, expected4) let relation4 = try score.relation("yolo", object: Level.self) let encoded5 = try ParseCoding.jsonEncoder().encode(relation4) - let decoded5 = try XCTUnwrap(String(data: encoded5, encoding: .utf8)) + let decoded5 = String(decoding: encoded5, as: UTF8.self) XCTAssertEqual(decoded5, expected) } @@ -180,13 +180,13 @@ class ParseRelationTests: XCTestCase { let expected = "{\"__type\":\"Relation\",\"className\":\"Level\"}" let encoded = try ParseCoding.jsonEncoder().encode(relation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) relation.className = "hello" let expected2 = "{\"__type\":\"Relation\",\"className\":\"hello\"}" let encoded2 = try ParseCoding.jsonEncoder().encode(relation) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) _ = try ParseRelation(parent: score, @@ -197,7 +197,7 @@ class ParseRelationTests: XCTestCase { let expected3 = "{\"__type\":\"Relation\",\"className\":\"Level\"}" let encoded3 = try ParseCoding.jsonEncoder().encode(relation2) - let decoded3 = try XCTUnwrap(String(data: encoded3, encoding: .utf8)) + let decoded3 = String(decoding: encoded3, as: UTF8.self) XCTAssertEqual(decoded3, expected3) } @@ -246,7 +246,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"level\":{\"__op\":\"AddRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"nice\"}]}}" let encoded = try ParseCoding.jsonEncoder().encode(operation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -285,7 +285,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"level\":{\"__op\":\"AddRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"nice\"}]}}" let encoded = try ParseCoding.jsonEncoder().encode(operation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -306,7 +306,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"level\":{\"__op\":\"AddRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"nice\"}]}}" let encoded = try ParseCoding.jsonEncoder().encode(operation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -365,7 +365,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"level\":{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"nice\"}]}}" let encoded = try ParseCoding.jsonEncoder().encode(operation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -404,7 +404,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"level\":{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"nice\"}]}}" let encoded = try ParseCoding.jsonEncoder().encode(operation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -425,7 +425,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"level\":{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"Level\",\"objectId\":\"nice\"}]}}" let encoded = try ParseCoding.jsonEncoder().encode(operation) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } @@ -471,14 +471,14 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"levels\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}}" let encoded = try ParseCoding.jsonEncoder().encode(query) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) let query2: Query = try relation.query("wow") // swiftlint:disable:next line_length let expected2 = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"wow\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}}" let encoded2 = try ParseCoding.jsonEncoder().encode(query2) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) guard let query3 = try level.relation?.query("levels", parent: score) else { @@ -488,7 +488,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected3 = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"levels\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}}" let encoded3 = try ParseCoding.jsonEncoder().encode(query3) - let decoded3 = try XCTUnwrap(String(data: encoded3, encoding: .utf8)) + let decoded3 = String(decoding: encoded3, as: UTF8.self) XCTAssertEqual(decoded3, expected3) guard let query4 = try level.relation?.query("levels", parent: score.toPointer()) else { @@ -498,7 +498,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected4 = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"levels\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}}" let encoded4 = try ParseCoding.jsonEncoder().encode(query4) - let decoded4 = try XCTUnwrap(String(data: encoded4, encoding: .utf8)) + let decoded4 = String(decoding: encoded4, as: UTF8.self) XCTAssertEqual(decoded4, expected4) } catch { XCTFail("Should not have thrown error") @@ -550,7 +550,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"levels\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}}" let encoded = try ParseCoding.jsonEncoder().encode(query) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } catch { XCTFail("Should not have thrown error") @@ -581,7 +581,7 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"levels\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore2\",\"objectId\":\"yolo\"}}}}" let encoded = try ParseCoding.jsonEncoder().encode(query) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } catch { XCTFail("Should not have thrown error") @@ -597,14 +597,14 @@ class ParseRelationTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"levels\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}}" let encoded = try ParseCoding.jsonEncoder().encode(query) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) let query2 = try Level.queryRelations("levels", parent: score) // swiftlint:disable:next line_length let expected2 = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"levels\",\"object\":{\"__type\":\"Pointer\",\"className\":\"GameScore\",\"objectId\":\"hello\"}}}}" let encoded2 = try ParseCoding.jsonEncoder().encode(query2) - let decoded2 = try XCTUnwrap(String(data: encoded2, encoding: .utf8)) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) } } diff --git a/Tests/ParseSwiftTests/ParseRoleTests.swift b/Tests/ParseSwiftTests/ParseRoleTests.swift index 43c17336f..55f2c2392 100644 --- a/Tests/ParseSwiftTests/ParseRoleTests.swift +++ b/Tests/ParseSwiftTests/ParseRoleTests.swift @@ -199,7 +199,7 @@ class ParseRoleTests: XCTestCase { .encode(body, collectChildren: false, objectsSavedBeforeThisOne: nil, filesSavedBeforeThisOne: nil).encoded - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) var empty = role.mergeable @@ -266,7 +266,7 @@ class ParseRoleTests: XCTestCase { } let expected = "{\"__type\":\"Relation\",\"className\":\"_User\"}" let encoded = try ParseCoding.jsonEncoder().encode(userRoles) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertEqual(userRoles.key, "users") @@ -295,7 +295,7 @@ class ParseRoleTests: XCTestCase { userRoles.key = nil let expected = "{\"__type\":\"Relation\",\"className\":\"_User\"}" let encoded = try ParseCoding.jsonEncoder().encode(userRoles) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertNil(userRoles.key) @@ -357,7 +357,7 @@ class ParseRoleTests: XCTestCase { } let expected = "{\"__type\":\"Relation\",\"className\":\"_User\"}" let encoded = try ParseCoding.jsonEncoder().encode(userRoles) - let decoded = String(data: encoded, encoding: .utf8) + let decoded = String(decoding: encoded, as: UTF8.self) XCTAssertEqual(decoded, expected) XCTAssertEqual(userRoles.key, "users") @@ -368,7 +368,7 @@ class ParseRoleTests: XCTestCase { // swiftlint:disable:next line_length let expected2 = "{\"users\":{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"heel\"}]}}" let encoded2 = try ParseCoding.jsonEncoder().encode(operation) - let decoded2 = try XCTUnwrap(try XCTUnwrap(String(data: encoded2, encoding: .utf8))) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) } @@ -386,7 +386,7 @@ class ParseRoleTests: XCTestCase { userRoles.key = nil let expected = "{\"__type\":\"Relation\",\"className\":\"_User\"}" let encoded = try ParseCoding.jsonEncoder().encode(userRoles) - let decoded = String(data: encoded, encoding: .utf8) + let decoded = String(decoding: encoded, as: UTF8.self) XCTAssertEqual(decoded, expected) XCTAssertNil(userRoles.key) @@ -397,7 +397,7 @@ class ParseRoleTests: XCTestCase { // swiftlint:disable:next line_length let expected2 = "{\"users\":{\"__op\":\"RemoveRelation\",\"objects\":[{\"__type\":\"Pointer\",\"className\":\"_User\",\"objectId\":\"heel\"}]}}" let encoded2 = try ParseCoding.jsonEncoder().encode(operation) - let decoded2 = try XCTUnwrap(try XCTUnwrap(String(data: encoded2, encoding: .utf8))) + let decoded2 = String(decoding: encoded2, as: UTF8.self) XCTAssertEqual(decoded2, expected2) } @@ -449,7 +449,7 @@ class ParseRoleTests: XCTestCase { } let expected = "{\"__type\":\"Relation\",\"className\":\"_Role\"}" let encoded = try ParseCoding.jsonEncoder().encode(roles) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertEqual(roles.key, "roles") @@ -838,7 +838,7 @@ class ParseRoleTests: XCTestCase { roles.key = nil let expected = "{\"__type\":\"Relation\",\"className\":\"_Role\"}" let encoded = try ParseCoding.jsonEncoder().encode(roles) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertNil(roles.key) @@ -900,7 +900,7 @@ class ParseRoleTests: XCTestCase { } let expected = "{\"__type\":\"Relation\",\"className\":\"_Role\"}" let encoded = try ParseCoding.jsonEncoder().encode(roles) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertEqual(roles.key, "roles") @@ -929,7 +929,7 @@ class ParseRoleTests: XCTestCase { roles.key = nil let expected = "{\"__type\":\"Relation\",\"className\":\"_Role\"}" let encoded = try ParseCoding.jsonEncoder().encode(roles) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) XCTAssertNil(roles.key) @@ -960,7 +960,7 @@ class ParseRoleTests: XCTestCase { // swiftlint:disable:next line_length let expected = "{\"_method\":\"GET\",\"limit\":100,\"skip\":0,\"where\":{\"$relatedTo\":{\"key\":\"users\",\"object\":{\"__type\":\"Pointer\",\"className\":\"_Role\",\"objectId\":\"yolo\"}}}}" let encoded = try ParseCoding.jsonEncoder().encode(query) - let decoded = try XCTUnwrap(String(data: encoded, encoding: .utf8)) + let decoded = try XCTUnwrap(String(decoding: encoded, as: UTF8.self)) XCTAssertEqual(decoded, expected) } diff --git a/Tests/ParseSwiftTests/ParseSessionTests.swift b/Tests/ParseSwiftTests/ParseSessionTests.swift index b92478619..733cf41b5 100644 --- a/Tests/ParseSwiftTests/ParseSessionTests.swift +++ b/Tests/ParseSwiftTests/ParseSessionTests.swift @@ -119,7 +119,7 @@ class ParseSessionTests: XCTestCase { func testParseURLSessionDefaultCertificatePinning() throws { let expectation1 = XCTestExpectation(description: "Authentication") URLSession.parse.delegate?.urlSession?(URLSession.parse, - didReceive: .init()) { (challenge, credential) -> Void in + didReceive: .init()) { (challenge, credential) in XCTAssertEqual(challenge, .performDefaultHandling) XCTAssertNil(credential) expectation1.fulfill() @@ -159,7 +159,7 @@ class ParseSessionTests: XCTestCase { }) let expectation1 = XCTestExpectation(description: "Authentication") URLSession.parse.delegate?.urlSession?(URLSession.parse, - didReceive: .init()) { (challenge, credential) -> Void in + didReceive: .init()) { (challenge, credential) in XCTAssertEqual(challenge, .cancelAuthenticationChallenge) XCTAssertEqual(credential, .none) expectation1.fulfill() From 549cc596aa46604b599027127d1c296642105252 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Sun, 23 Jun 2024 22:31:17 -0700 Subject: [PATCH 13/17] revert ParseTypeable description due to failures --- Sources/ParseSwift/Protocols/ParseTypeable.swift | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Sources/ParseSwift/Protocols/ParseTypeable.swift b/Sources/ParseSwift/Protocols/ParseTypeable.swift index 555049652..63f4e40cb 100644 --- a/Sources/ParseSwift/Protocols/ParseTypeable.swift +++ b/Sources/ParseSwift/Protocols/ParseTypeable.swift @@ -19,10 +19,11 @@ public protocol ParseTypeable: Codable, // MARK: CustomDebugStringConvertible extension ParseTypeable { public var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { - return "()" + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), + let descriptionString = String(data: descriptionData, encoding: .utf8) else { + return "()" } - let descriptionString = String(decoding: descriptionData, as: UTF8.self) + return "\(descriptionString)" } } From d8b4b4078c7cdc635250a429b8a1cea74146f337 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Sun, 23 Jun 2024 22:42:02 -0700 Subject: [PATCH 14/17] dont test some tests on tvOS --- Sources/ParseSwift/Protocols/ParseTypeable.swift | 7 +++---- Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift | 4 ++-- Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift | 2 +- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/Sources/ParseSwift/Protocols/ParseTypeable.swift b/Sources/ParseSwift/Protocols/ParseTypeable.swift index 63f4e40cb..555049652 100644 --- a/Sources/ParseSwift/Protocols/ParseTypeable.swift +++ b/Sources/ParseSwift/Protocols/ParseTypeable.swift @@ -19,11 +19,10 @@ public protocol ParseTypeable: Codable, // MARK: CustomDebugStringConvertible extension ParseTypeable { public var debugDescription: String { - guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self), - let descriptionString = String(data: descriptionData, encoding: .utf8) else { - return "()" + guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else { + return "()" } - + let descriptionString = String(decoding: descriptionData, as: UTF8.self) return "\(descriptionString)" } } diff --git a/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift b/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift index 9a03432bf..0a96b0aa0 100644 --- a/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift +++ b/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift @@ -113,7 +113,7 @@ class ParsePushPayloadAnyTests: XCTestCase { XCTAssertEqual(fcmPayload, decoded2) let decodedAny2 = try ParseCoding.jsonDecoder().decode(ParsePushPayloadAny.self, from: encoded).convertToApple() XCTAssertEqual(decodedAny2, applePayload) - #if !os(Linux) && !os(Android) && !os(Windows) + #if !os(Linux) && !os(Android) && !os(Windows) && !os(tvOS) XCTAssertEqual(fcmPayload.description, "{\"collapseKey\":\"nope\",\"data\":{\"help\":\"you\"},\"delayWhileIdle\":false,\"dryRun\":false,\"notification\":{\"android_channel_id\":\"you\",\"badge\":\"no\",\"body\":\"android\",\"body_loc-key\":\"cousin\",\"body-loc-args\":[\"mother\"],\"click_action\":\"to\",\"color\":\"blue\",\"icon\":\"world\",\"image\":\"icon\",\"sound\":\"yes\",\"subtitle\":\"trip\",\"tag\":\"it\",\"title\":\"hello\",\"title_loc_args\":[\"arg\"],\"title_loc_key\":\"it\"},\"restrictedPackageName\":\"geez\",\"title\":\"peace\",\"uri\":\"https:\\/\\/parse.org\"}") #endif @@ -228,7 +228,7 @@ class ParsePushPayloadAnyTests: XCTestCase { XCTAssertEqual(fcmPayload, decoded) let decoded2 = try ParseCoding.jsonDecoder().decode(ParsePushPayloadAny.self, from: encoded).convertToFirebase() XCTAssertEqual(decoded2, fcmPayload) - #if !os(Linux) && !os(Android) && !os(Windows) + #if !os(Linux) && !os(Android) && !os(Windows) && !os(tvOS) XCTAssertEqual(fcmPayload.description, "{\"collapseKey\":\"nope\",\"contentAvailable\":true,\"data\":{\"help\":\"you\"},\"delayWhileIdle\":false,\"dryRun\":false,\"mutableContent\":true,\"notification\":{\"android_channel_id\":\"you\",\"badge\":\"no\",\"body\":\"android\",\"body_loc-key\":\"cousin\",\"body-loc-args\":[\"mother\"],\"click_action\":\"to\",\"color\":\"blue\",\"icon\":\"world\",\"image\":\"icon\",\"sound\":\"yes\",\"subtitle\":\"trip\",\"tag\":\"it\",\"title\":\"hello\",\"title_loc_args\":[\"arg\"],\"title_loc_key\":\"it\"},\"priority\":\"high\",\"restrictedPackageName\":\"geez\",\"title\":\"peace\",\"uri\":\"https:\\/\\/parse.org\"}") #endif diff --git a/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift b/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift index 82dae0e1c..84dc6873f 100644 --- a/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift +++ b/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift @@ -71,7 +71,7 @@ class ParsePushPayloadFirebaseTests: XCTestCase { let encoded = try ParseCoding.parseEncoder().encode(fcmPayload) let decoded = try ParseCoding.jsonDecoder().decode(ParsePushPayloadFirebase.self, from: encoded) XCTAssertEqual(fcmPayload, decoded) - #if !os(Linux) && !os(Android) && !os(Windows) + #if !os(Linux) && !os(Android) && !os(Windows) && !os(tvOS) XCTAssertEqual(fcmPayload.description, "{\"collapseKey\":\"nope\",\"contentAvailable\":true,\"data\":{\"help\":\"you\"},\"delayWhileIdle\":false,\"dryRun\":false,\"mutableContent\":true,\"notification\":{\"android_channel_id\":\"you\",\"badge\":\"no\",\"body\":\"android\",\"body_loc-key\":\"cousin\",\"body-loc-args\":[\"mother\"],\"click_action\":\"to\",\"color\":\"blue\",\"icon\":\"world\",\"image\":\"icon\",\"sound\":\"yes\",\"subtitle\":\"trip\",\"tag\":\"it\",\"title\":\"hello\",\"title_loc_args\":[\"arg\"],\"title_loc_key\":\"it\"},\"priority\":\"high\",\"restrictedPackageName\":\"geez\",\"title\":\"peace\",\"uri\":\"https:\\/\\/parse.org\"}") #endif From a76b77b0836a7f07d2dd1eec62b5d4628b8c839a Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 24 Jun 2024 12:12:14 -0700 Subject: [PATCH 15/17] set OS version of iOS, tvOS, and visionOS --- .github/workflows/ci.yml | 2 +- Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift | 4 ++-- Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ef8fbfeab..4ca439fcb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: macos-14 strategy: matrix: - destination: ['platform=iOS\ Simulator,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=visionOS\ Simulator,name=Apple\ Vision\ Pro', 'platform=macOS'] + destination: ['platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro', 'platform=macOS'] action: ['test', 'build'] exclude: - destination: 'platform=iOS\ Simulator,name=iPhone\ 15\ Pro\ Max' diff --git a/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift b/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift index 0a96b0aa0..9a03432bf 100644 --- a/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift +++ b/Tests/ParseSwiftTests/ParsePushPayloadAnyTests.swift @@ -113,7 +113,7 @@ class ParsePushPayloadAnyTests: XCTestCase { XCTAssertEqual(fcmPayload, decoded2) let decodedAny2 = try ParseCoding.jsonDecoder().decode(ParsePushPayloadAny.self, from: encoded).convertToApple() XCTAssertEqual(decodedAny2, applePayload) - #if !os(Linux) && !os(Android) && !os(Windows) && !os(tvOS) + #if !os(Linux) && !os(Android) && !os(Windows) XCTAssertEqual(fcmPayload.description, "{\"collapseKey\":\"nope\",\"data\":{\"help\":\"you\"},\"delayWhileIdle\":false,\"dryRun\":false,\"notification\":{\"android_channel_id\":\"you\",\"badge\":\"no\",\"body\":\"android\",\"body_loc-key\":\"cousin\",\"body-loc-args\":[\"mother\"],\"click_action\":\"to\",\"color\":\"blue\",\"icon\":\"world\",\"image\":\"icon\",\"sound\":\"yes\",\"subtitle\":\"trip\",\"tag\":\"it\",\"title\":\"hello\",\"title_loc_args\":[\"arg\"],\"title_loc_key\":\"it\"},\"restrictedPackageName\":\"geez\",\"title\":\"peace\",\"uri\":\"https:\\/\\/parse.org\"}") #endif @@ -228,7 +228,7 @@ class ParsePushPayloadAnyTests: XCTestCase { XCTAssertEqual(fcmPayload, decoded) let decoded2 = try ParseCoding.jsonDecoder().decode(ParsePushPayloadAny.self, from: encoded).convertToFirebase() XCTAssertEqual(decoded2, fcmPayload) - #if !os(Linux) && !os(Android) && !os(Windows) && !os(tvOS) + #if !os(Linux) && !os(Android) && !os(Windows) XCTAssertEqual(fcmPayload.description, "{\"collapseKey\":\"nope\",\"contentAvailable\":true,\"data\":{\"help\":\"you\"},\"delayWhileIdle\":false,\"dryRun\":false,\"mutableContent\":true,\"notification\":{\"android_channel_id\":\"you\",\"badge\":\"no\",\"body\":\"android\",\"body_loc-key\":\"cousin\",\"body-loc-args\":[\"mother\"],\"click_action\":\"to\",\"color\":\"blue\",\"icon\":\"world\",\"image\":\"icon\",\"sound\":\"yes\",\"subtitle\":\"trip\",\"tag\":\"it\",\"title\":\"hello\",\"title_loc_args\":[\"arg\"],\"title_loc_key\":\"it\"},\"priority\":\"high\",\"restrictedPackageName\":\"geez\",\"title\":\"peace\",\"uri\":\"https:\\/\\/parse.org\"}") #endif diff --git a/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift b/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift index 84dc6873f..82dae0e1c 100644 --- a/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift +++ b/Tests/ParseSwiftTests/ParsePushPayloadFirebaseTests.swift @@ -71,7 +71,7 @@ class ParsePushPayloadFirebaseTests: XCTestCase { let encoded = try ParseCoding.parseEncoder().encode(fcmPayload) let decoded = try ParseCoding.jsonDecoder().decode(ParsePushPayloadFirebase.self, from: encoded) XCTAssertEqual(fcmPayload, decoded) - #if !os(Linux) && !os(Android) && !os(Windows) && !os(tvOS) + #if !os(Linux) && !os(Android) && !os(Windows) XCTAssertEqual(fcmPayload.description, "{\"collapseKey\":\"nope\",\"contentAvailable\":true,\"data\":{\"help\":\"you\"},\"delayWhileIdle\":false,\"dryRun\":false,\"mutableContent\":true,\"notification\":{\"android_channel_id\":\"you\",\"badge\":\"no\",\"body\":\"android\",\"body_loc-key\":\"cousin\",\"body-loc-args\":[\"mother\"],\"click_action\":\"to\",\"color\":\"blue\",\"icon\":\"world\",\"image\":\"icon\",\"sound\":\"yes\",\"subtitle\":\"trip\",\"tag\":\"it\",\"title\":\"hello\",\"title_loc_args\":[\"arg\"],\"title_loc_key\":\"it\"},\"priority\":\"high\",\"restrictedPackageName\":\"geez\",\"title\":\"peace\",\"uri\":\"https:\\/\\/parse.org\"}") #endif From 45d901e8ddd7b4e82e6d05b86e2460a91c3ebe79 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 24 Jun 2024 12:15:36 -0700 Subject: [PATCH 16/17] fix omitted tests in matrix --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4ca439fcb..456da211c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,13 +25,13 @@ jobs: destination: ['platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro', 'platform=macOS'] action: ['test', 'build'] exclude: - - destination: 'platform=iOS\ Simulator,name=iPhone\ 15\ Pro\ Max' + - destination: 'platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max' action: 'build' - - destination: 'platform\=tvOS\ Simulator,name\=Apple\ TV' + - destination: 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV' action: 'build' - destination: 'platform=macOS' action: 'build' - - destination: 'platform=visionOS\ Simulator,name=Apple\ Vision\ Pro' + - destination: 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro' action: 'build' - destination: 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)' action: 'test' From 2992309507859c54b6da54e641647bf73abfc942 Mon Sep 17 00:00:00 2001 From: Corey Baker Date: Mon, 24 Jun 2024 12:27:15 -0700 Subject: [PATCH 17/17] remove visionOS test for now --- .github/workflows/ci.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 456da211c..94c280622 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,7 +22,7 @@ jobs: runs-on: macos-14 strategy: matrix: - destination: ['platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro', 'platform=macOS'] + destination: ['platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max', 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV', 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)', 'platform=macOS'] # 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro' action: ['test', 'build'] exclude: - destination: 'platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max' @@ -31,8 +31,8 @@ jobs: action: 'build' - destination: 'platform=macOS' action: 'build' - - destination: 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro' - action: 'build' + # - destination: 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro' + # action: 'build' - destination: 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)' action: 'test' steps: