Skip to content

Commit 47b0a3b

Browse files
authored
ci: Update Xcode to 15.4 (#166)
* ci: Update Xcode to 15.3 * Update release.yml * Update ci.yml * Update ci.yml * fix test host for xrsimulator * add visionOS to targeted devices * Update ci.yml * Update ci.yml * install SwiftLint * Update release.yml * Update ci.yml * fix swiftlint non_optional_string_data_conversion * revert ParseTypeable description due to failures * dont test some tests on tvOS * set OS version of iOS, tvOS, and visionOS * fix omitted tests in matrix * remove visionOS test for now
1 parent 077d457 commit 47b0a3b

39 files changed

+191
-243
lines changed

.github/workflows/ci.yml

+12-16
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
env:
1111
CI_XCODE_OLDEST: '/Applications/Xcode_13.3.1.app/Contents/Developer'
1212
CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer'
13-
CI_XCODE_LATEST: '/Applications/Xcode_15.2.app/Contents/Developer'
13+
CI_XCODE_LATEST: '/Applications/Xcode_15.4.app/Contents/Developer'
1414

1515
concurrency:
1616
group: ${{ github.workflow }}-${{ github.ref }}
@@ -19,26 +19,26 @@ concurrency:
1919
jobs:
2020
test:
2121
timeout-minutes: 25
22-
runs-on: macos-13
22+
runs-on: macos-14
2323
strategy:
2424
matrix:
25-
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']
25+
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'
2626
action: ['test', 'build']
2727
exclude:
28-
- destination: 'platform=iOS\ Simulator,name=iPhone\ 15\ Pro\ Max'
28+
- destination: 'platform=iOS\ Simulator,OS=17.5,name=iPhone\ 15\ Pro\ Max'
2929
action: 'build'
30-
- destination: 'platform\=tvOS\ Simulator,name\=Apple\ TV'
30+
- destination: 'platform\=tvOS\ Simulator,OS=17.5,name\=Apple\ TV'
3131
action: 'build'
3232
- destination: 'platform=macOS'
3333
action: 'build'
34-
- destination: 'platform=visionOS\ Simulator,name=Apple\ Vision\ Pro'
35-
action: 'build'
34+
# - destination: 'platform=visionOS\ Simulator,OS=1.2,name=Apple\ Vision\ Pro'
35+
# action: 'build'
3636
- destination: 'platform=watchOS\ Simulator,name=Apple\ Watch\ Series\ 9\ \(41mm\)'
3737
action: 'test'
3838
steps:
3939
- uses: actions/checkout@v4
40-
- name: Use multiple cores
41-
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
40+
- name: Install SwiftLint
41+
run: brew install swiftlint
4242
- name: Create and set the default keychain
4343
run: |
4444
security create-keychain -p "" temporary
@@ -77,8 +77,8 @@ jobs:
7777
security default-keychain -s temporary
7878
security unlock-keychain -p "" temporary
7979
security set-keychain-settings -lut 7200 temporary
80-
- name: Use multiple cores
81-
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
80+
- name: Install SwiftLint
81+
run: brew install swiftlint
8282
- name: Build-Test
8383
run: set -o pipefail && env NSUnbufferedIO=YES swift test --enable-code-coverage | xcpretty -c
8484
env:
@@ -131,7 +131,7 @@ jobs:
131131
uses: codecov/codecov-action@v4
132132
with:
133133
env_vars: LINUX
134-
fail_ci_if_error: false
134+
fail_ci_if_error: true
135135
token: ${{ secrets.CODECOV_TOKEN }}
136136

137137
windows:
@@ -159,8 +159,6 @@ jobs:
159159
runs-on: macos-14
160160
steps:
161161
- uses: actions/checkout@v4
162-
- name: Use multiple cores
163-
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
164162
- name: Generate Docs
165163
run: set -o pipefail && env NSUnbufferedIO=YES Scripts/generate-documentation
166164
env:
@@ -171,8 +169,6 @@ jobs:
171169
runs-on: macos-14
172170
steps:
173171
- uses: actions/checkout@v4
174-
- name: Use multiple cores
175-
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
176172
- name: Update Framework Version
177173
run: ./Scripts/update_build
178174
env:

.github/workflows/release.yml

+1-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
types: [published]
55
env:
66
CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer'
7-
CI_XCODE_LATEST: '/Applications/Xcode_15.2.app/Contents/Developer'
7+
CI_XCODE_LATEST: '/Applications/Xcode_15.4.app/Contents/Developer'
88

99
jobs:
1010
cocoapods:
@@ -13,8 +13,6 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- name: Get release version
1515
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
16-
- name: Use multiple cores
17-
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
1816
- name: Update Framework Version
1917
run: ./Scripts/update_build
2018
env:
@@ -31,8 +29,6 @@ jobs:
3129
- uses: actions/checkout@v4
3230
- name: Get release version
3331
run: echo "TAG=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
34-
- name: Use multiple cores
35-
run: defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
3632
- name: Build and Deploy Docs
3733
run: set -o pipefail && env NSUnbufferedIO=YES Scripts/update-gh-pages-documentation-site
3834
env:

.swiftlint.yml

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ disabled_rules:
22
- file_length
33
- identifier_name
44
- blanket_disable_command
5+
- non_optional_string_data_conversion
56
excluded: # paths to ignore during linting. Takes precedence over `included`.
67
- Tests/ParseSwiftTests/ParseEncoderTests
78
- DerivedData

ParseSwift.playground/Pages/9 - Files.xcplaygroundpage/Contents.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -194,9 +194,7 @@ Task {
194194
assertionFailure("Data is not the same. Something went wrong.")
195195
}
196196

197-
guard let parseFileString = String(data: dataFromParseFile, encoding: .utf8) else {
198-
fatalError("Error: Could not create String from data.")
199-
}
197+
let parseFileString = String(decoding: dataFromParseFile, as: UTF8.self)
200198
print("The data saved on parse is: \"\(parseFileString)\"")
201199
} else {
202200
assertionFailure("Error fetching: there should be a localURL")

ParseSwift.xcodeproj/project.pbxproj

+6-8
Original file line numberDiff line numberDiff line change
@@ -2021,7 +2021,7 @@
20212021
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
20222022
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
20232023
SWIFT_VERSION = 5.0;
2024-
TARGETED_DEVICE_FAMILY = "1,2,3,4";
2024+
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
20252025
TVOS_DEPLOYMENT_TARGET = 13.0;
20262026
WATCHOS_DEPLOYMENT_TARGET = 6.0;
20272027
};
@@ -2056,7 +2056,7 @@
20562056
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
20572057
SWIFT_SWIFT3_OBJC_INFERENCE = Off;
20582058
SWIFT_VERSION = 5.0;
2059-
TARGETED_DEVICE_FAMILY = "1,2,3,4";
2059+
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
20602060
TVOS_DEPLOYMENT_TARGET = 13.0;
20612061
WATCHOS_DEPLOYMENT_TARGET = 6.0;
20622062
};
@@ -2086,7 +2086,7 @@
20862086
SUPPORTS_MACCATALYST = YES;
20872087
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
20882088
SWIFT_VERSION = 5.0;
2089-
TARGETED_DEVICE_FAMILY = "1,2,3,4";
2089+
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
20902090
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestHost";
20912091
};
20922092
name = Debug;
@@ -2115,7 +2115,7 @@
21152115
SUPPORTS_MACCATALYST = YES;
21162116
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = YES;
21172117
SWIFT_VERSION = 5.0;
2118-
TARGETED_DEVICE_FAMILY = "1,2,3,4";
2118+
TARGETED_DEVICE_FAMILY = "1,2,3,4,6,7";
21192119
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TestHost.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/TestHost";
21202120
};
21212121
name = Release;
@@ -2155,12 +2155,11 @@
21552155
PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost;
21562156
PRODUCT_NAME = "$(TARGET_NAME)";
21572157
SDKROOT = auto;
2158-
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos";
2158+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos xrsimulator xros";
21592159
SUPPORTS_MACCATALYST = NO;
21602160
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
21612161
SWIFT_EMIT_LOC_STRINGS = YES;
21622162
SWIFT_VERSION = 5.0;
2163-
TARGETED_DEVICE_FAMILY = "1,2,3";
21642163
TVOS_DEPLOYMENT_TARGET = 14.0;
21652164
WATCHOS_DEPLOYMENT_TARGET = 7.0;
21662165
};
@@ -2200,12 +2199,11 @@
22002199
PRODUCT_BUNDLE_IDENTIFIER = com.parse.TestHost;
22012200
PRODUCT_NAME = "$(TARGET_NAME)";
22022201
SDKROOT = auto;
2203-
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos";
2202+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos xrsimulator xros";
22042203
SUPPORTS_MACCATALYST = NO;
22052204
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
22062205
SWIFT_EMIT_LOC_STRINGS = YES;
22072206
SWIFT_VERSION = 5.0;
2208-
TARGETED_DEVICE_FAMILY = "1,2,3";
22092207
TVOS_DEPLOYMENT_TARGET = 14.0;
22102208
WATCHOS_DEPLOYMENT_TARGET = 7.0;
22112209
};

Sources/ParseSwift/API/API.swift

+4-4
Original file line numberDiff line numberDiff line change
@@ -257,17 +257,17 @@ public struct API {
257257
case .removeMimeType:
258258
headers.removeValue(forKey: "Content-Type")
259259
case .metadata(let metadata):
260-
metadata.forEach {(key, value) -> Void in
260+
metadata.forEach {(key, value) in
261261
headers[key] = value
262262
}
263263
case .tags(let tags):
264-
tags.forEach {(key, value) -> Void in
264+
tags.forEach {(key, value) in
265265
headers[key] = value
266266
}
267267
case .context(let context):
268268
let context = AnyEncodable(context)
269-
if let encoded = try? ParseCoding.jsonEncoder().encode(context),
270-
let encodedString = String(data: encoded, encoding: .utf8) {
269+
if let encoded = try? ParseCoding.jsonEncoder().encode(context) {
270+
let encodedString = String(decoding: encoded, as: UTF8.self)
271271
headers["X-Parse-Cloud-Context"] = encodedString
272272
}
273273
default:

Sources/ParseSwift/Authentication/3rd Party/ParseApple/ParseApple.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,7 @@ public struct ParseApple<AuthenticatedUser: ParseUser>: ParseAuthentication {
3030
/// to a string.
3131
func makeDictionary(user: String,
3232
identityToken: Data) throws -> [String: String] {
33-
guard let identityTokenString = String(data: identityToken, encoding: .utf8) else {
34-
throw ParseError(code: .otherCause, message: "Could not convert identityToken to String")
35-
}
33+
let identityTokenString = String(decoding: identityToken, as: UTF8.self)
3634
return [AuthenticationKeys.id.rawValue: user,
3735
AuthenticationKeys.token.rawValue: identityTokenString]
3836
}

Sources/ParseSwift/Coding/AnyCodable.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ extension AnyCodable: Hashable {
7373
public func hash(into hasher: inout Hasher) {
7474
do {
7575
let encodedData = try ParseCoding.jsonEncoder().encode(self)
76-
let encodedString = String(data: encodedData, encoding: .utf8)
76+
let encodedString = String(decoding: encodedData, as: UTF8.self)
7777
hasher.combine(encodedString)
7878
} catch {
7979
hasher.combine(0)

Sources/ParseSwift/Coding/AnyEncodable.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ extension AnyEncodable: Hashable {
192192
public func hash(into hasher: inout Hasher) {
193193
do {
194194
let encodedData = try ParseCoding.jsonEncoder().encode(self)
195-
let encodedString = String(data: encodedData, encoding: .utf8)
195+
let encodedString = String(decoding: encodedData, as: UTF8.self)
196196
hasher.combine(encodedString)
197197
} catch {
198198
hasher.combine(0)

Sources/ParseSwift/Coding/ParseCoding.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,7 @@ extension ParseCoding {
125125

126126
if
127127
let decoded = try container.decodeIfPresent(String.self, forKey: .iso),
128-
let date = dateFormatter.date(from: decoded)
129-
{
128+
let date = dateFormatter.date(from: decoded) {
130129
return date
131130
} else {
132131
throw ParseError(

Sources/ParseSwift/Extensions/Encodable.swift

+3-6
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,17 @@ internal extension Encodable {
1616
self,
1717
acl: nil
1818
),
19-
let lhsString = String(data: lhsData, encoding: .utf8),
2019
let other = other,
2120
let rhsData = try? ParseCoding
2221
.parseEncoder()
2322
.encode(
2423
other,
2524
acl: nil
26-
),
27-
let rhsString = String(
28-
data: rhsData,
29-
encoding: .utf8
30-
) else {
25+
) else {
3126
return false
3227
}
28+
let lhsString = String(decoding: lhsData, as: UTF8.self)
29+
let rhsString = String(decoding: rhsData, as: UTF8.self)
3330
return lhsString == rhsString
3431
}
3532
}

Sources/ParseSwift/Extensions/URLSession.swift

+2-1
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,9 @@ internal extension URLSession {
9090
return .failure(ParseError(message: "Error decoding parse-server response: \(response)",
9191
swift: error))
9292
}
93+
let errorString = String(decoding: json, as: UTF8.self)
9394
// swiftlint:disable:next line_length
94-
return .failure(ParseError(message: "Error decoding parse-server response: \(response) with error: \(String(describing: error)) Format: \(String(describing: String(data: json, encoding: .utf8)))",
95+
return .failure(ParseError(message: "Error decoding parse-server response: \(response) with error: \(String(describing: error)) Format: \(errorString)",
9596
swift: error))
9697
}
9798
return .failure(parseError)

Sources/ParseSwift/LiveQuery/LiveQuerySocket.swift

+2-8
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,7 @@ extension LiveQuerySocket {
5757
.encode(await StandardMessage(operation: .connect,
5858
// swiftlint:disable:next line_length
5959
additionalProperties: Parse.configuration.liveQueryConnectionAdditionalProperties))
60-
guard let encodedAsString = String(data: encoded, encoding: .utf8) else {
61-
throw ParseError(code: .otherCause,
62-
message: "Could not encode connect message: \(encoded)")
63-
}
60+
let encodedAsString = String(decoding: encoded, as: UTF8.self)
6461
try await task.send(.string(encodedAsString))
6562
await self.receive(task)
6663
}
@@ -69,10 +66,7 @@ extension LiveQuerySocket {
6966
// MARK: Send
7067
extension LiveQuerySocket {
7168
func send(_ data: Data, task: URLSessionWebSocketTask) async throws {
72-
guard let encodedAsString = String(data: data, encoding: .utf8) else {
73-
throw ParseError(code: .otherCause,
74-
message: "Could not encode data as string: \(data)")
75-
}
69+
let encodedAsString = String(decoding: data, as: UTF8.self)
7670
try await task.send(.string(encodedAsString))
7771
}
7872
}

Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ Not attempting to open ParseLiveQuery socket anymore
233233
// Resubscribe to all subscriptions by moving them in front of pending
234234
var tempPendingSubscriptions = [(RequestId, SubscriptionRecord)]()
235235
let subscriptions = await self.subscriptions.getCurrent()
236-
subscriptions.forEach { (key, value) -> Void in
236+
subscriptions.forEach { (key, value) in
237237
tempPendingSubscriptions.append((key, value))
238238
}
239239
await self.subscriptions.removeAll()

Sources/ParseSwift/Objects/ParseObject.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -721,11 +721,10 @@ transactions for this call.
721721
// MARK: CustomDebugStringConvertible
722722
extension ParseObject {
723723
public var debugDescription: String {
724-
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
725-
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
724+
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
726725
return "\(className) ()"
727726
}
728-
727+
let descriptionString = String(decoding: descriptionData, as: UTF8.self)
729728
return "\(className) (\(descriptionString))"
730729
}
731730
}

Sources/ParseSwift/Protocols/Objectable.swift

+1-3
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ extension Objectable {
103103
let encoded = try ParseCoding.parseEncoder().encode(object,
104104
acl: nil,
105105
batching: false)
106-
guard let hashString = String(data: encoded, encoding: .utf8) else {
107-
throw ParseError(code: .otherCause, message: "Could not create hash")
108-
}
106+
let hashString = String(decoding: encoded, as: UTF8.self)
109107
return hashString
110108
}
111109

Sources/ParseSwift/Protocols/ParseEncodable.swift

+2-3
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@ public protocol ParseEncodable: Encodable {}
1717
// MARK: CustomDebugStringConvertible
1818
extension ParseEncodable {
1919
public var debugDescription: String {
20-
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
21-
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
20+
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
2221
return "()"
2322
}
24-
23+
let descriptionString = String(decoding: descriptionData, as: UTF8.self)
2524
return "\(descriptionString)"
2625
}
2726
}

Sources/ParseSwift/Protocols/ParseOperationable.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ public protocol ParseOperationable: Codable,
1919
// MARK: CustomDebugStringConvertible
2020
public extension ParseOperationable {
2121
var debugDescription: String {
22-
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
23-
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
24-
return "()"
22+
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
23+
return "()"
2524
}
26-
25+
let descriptionString = String(decoding: descriptionData, as: UTF8.self)
2726
return "\(descriptionString)"
2827
}
2928
}

Sources/ParseSwift/Protocols/ParseTypeable.swift

+3-4
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,10 @@ public protocol ParseTypeable: Codable,
1919
// MARK: CustomDebugStringConvertible
2020
extension ParseTypeable {
2121
public var debugDescription: String {
22-
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self),
23-
let descriptionString = String(data: descriptionData, encoding: .utf8) else {
24-
return "()"
22+
guard let descriptionData = try? ParseCoding.jsonEncoder().encode(self) else {
23+
return "()"
2524
}
26-
25+
let descriptionString = String(decoding: descriptionData, as: UTF8.self)
2726
return "\(descriptionString)"
2827
}
2928
}

Sources/ParseSwift/Types/ParseError.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -540,7 +540,7 @@ extension ParseError: LocalizedError {
540540
}
541541
}
542542

543-
// MARK:
543+
// MARK: Equatable
544544
extension ParseError: Equatable {
545545
public static func == (lhs: Self, rhs: Self) -> Bool {
546546
lhs.code == rhs.code &&

0 commit comments

Comments
 (0)