Skip to content

Commit f48c096

Browse files
authored
Swift Language Support: Drop <5.9, Add 6.0 (#121)
* Swift Language Support: Drop <5.9, Add 6.0 * wip * wip * wip * wip * wip
1 parent a918a38 commit f48c096

File tree

13 files changed

+66
-137
lines changed

13 files changed

+66
-137
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,27 +16,11 @@ concurrency:
1616
jobs:
1717
macos-14:
1818
name: macOS 14 (Xcode ${{ matrix.xcode }})
19-
runs-on: macOS-13
19+
runs-on: macOS-14
2020
strategy:
2121
matrix:
2222
xcode:
23-
- '15.2'
24-
steps:
25-
- uses: actions/checkout@v4
26-
- name: Select Xcode ${{ matrix.xcode }}
27-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
28-
- name: Print Swift version
29-
run: swift --version
30-
- name: Run tests (platforms)
31-
run: make test-platforms
32-
33-
macos-13:
34-
name: macOS 13 (Xcode ${{ matrix.xcode }})
35-
runs-on: macOS-13
36-
strategy:
37-
matrix:
38-
xcode:
39-
- '14.3.1'
23+
- '15.4'
4024
steps:
4125
- uses: actions/checkout@v4
4226
- name: Select Xcode ${{ matrix.xcode }}

Package.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.7
1+
// swift-tools-version: 5.9
22

33
import PackageDescription
44

@@ -24,6 +24,9 @@ let package = Package(
2424
name: "CustomDump",
2525
dependencies: [
2626
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay")
27+
],
28+
swiftSettings: [
29+
.enableExperimentalFeature("StrictConcurrency")
2730
]
2831
),
2932
.testTarget(
Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// swift-tools-version:5.9
1+
// swift-tools-version: 6.0
22

33
import PackageDescription
44

@@ -24,9 +24,6 @@ let package = Package(
2424
name: "CustomDump",
2525
dependencies: [
2626
.product(name: "XCTestDynamicOverlay", package: "xctest-dynamic-overlay")
27-
],
28-
swiftSettings: [
29-
.enableExperimentalFeature("StrictConcurrency")
3027
]
3128
),
3229
.testTarget(

Sources/CustomDump/Conformances/KeyPath.swift

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,9 @@ import Foundation
22

33
extension AnyKeyPath: CustomDumpStringConvertible {
44
public var customDumpDescription: String {
5-
// NB: We gate this to 5.9+ due to this crasher: https://github.com/apple/swift/issues/64865
6-
#if swift(>=5.9)
7-
if #available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *) {
8-
return self.debugDescription
9-
}
10-
#endif
5+
if #available(macOS 13.3, iOS 16.4, watchOS 9.4, tvOS 16.4, *) {
6+
return self.debugDescription
7+
}
118
return """
129
\(typeName(Self.self))<\
1310
\(typeName(Self.rootType, genericsAbbreviated: false)), \

Sources/CustomDump/Conformances/Swift.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ extension Character: CustomDumpRepresentable {
66
}
77
}
88

9-
#if (swift(>=5.7) && !targetEnvironment(macCatalyst) && (os(iOS) || os(tvOS) || os(watchOS))) || (swift(>=5.7.1) && os(macOS))
9+
#if os(iOS) || os(macOS) || os(tvOS) || os(watchOS)
1010
@available(macOS 13, iOS 16, watchOS 9, tvOS 16, *)
1111
extension Duration: CustomDumpStringConvertible {
1212
public var customDumpDescription: String {

Sources/CustomDump/Conformances/UserNotifications.swift

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
switch self.rawValue {
3030
case .alert:
3131
return "UNAuthorizationOptions.alert"
32-
#if (os(iOS) || os(watchOS)) && (swift(<5.9) || !canImport(CompositorServices))
32+
#if os(iOS) || os(watchOS)
3333
case .announcement:
3434
return "UNAuthorizationOptions.announcement"
3535
#endif
@@ -56,7 +56,7 @@
5656
var allCases: [UNAuthorizationOptions] = [
5757
.alert
5858
]
59-
#if (os(iOS) || os(watchOS)) && (swift(<5.9) || !canImport(CompositorServices))
59+
#if os(iOS) || os(watchOS)
6060
allCases.append(.announcement)
6161
#endif
6262
allCases.append(contentsOf: [
@@ -132,11 +132,9 @@
132132
struct Option: CustomDumpStringConvertible {
133133
var rawValue: UNNotificationPresentationOptions
134134
var customDumpDescription: String {
135-
#if swift(<5.9) || !canImport(CompositorServices)
136-
if self.rawValue == .alert {
137-
return "UNNotificationPresentationOptions.alert"
138-
}
139-
#endif
135+
if self.rawValue == .alert {
136+
return "UNNotificationPresentationOptions.alert"
137+
}
140138
if self.rawValue == .badge {
141139
return "UNNotificationPresentationOptions.badge"
142140
}
@@ -155,8 +153,10 @@
155153

156154
var options = self
157155
var children: [Option] = []
158-
var allCases: [UNNotificationPresentationOptions] = []
159-
appendBannerList(&allCases)
156+
var allCases: [UNNotificationPresentationOptions] = [.alert, .badge]
157+
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) {
158+
allCases.append(contentsOf: [.banner, .list])
159+
}
160160
allCases.append(.sound)
161161
for option in allCases {
162162
if options.contains(option) {
@@ -174,19 +174,6 @@
174174
displayStyle: .set
175175
)
176176
}
177-
178-
// NB: Workaround for Xcode 13.2's new, experimental build system.
179-
//
180-
// defaults write com.apple.dt.XCBuild EnableSwiftBuildSystemIntegration 1
181-
private func appendBannerList(_ allCases: inout [UNNotificationPresentationOptions]) {
182-
#if swift(<5.9) || !canImport(CompositorServices)
183-
allCases.append(.alert)
184-
#endif
185-
allCases.append(.badge)
186-
if #available(iOS 14, macOS 11, tvOS 14, watchOS 7, *) {
187-
allCases.append(contentsOf: [.banner, .list])
188-
}
189-
}
190177
}
191178

192179
@available(iOS 10, macOS 10.14, tvOS 10, watchOS 3, *)

Sources/CustomDump/Diff.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public func diff<T>(_ lhs: T, _ rhs: T, format: DiffFormat = .default) -> String
207207
to: &out
208208
)
209209

210-
if let areInIncreasingOrder = areInIncreasingOrder {
210+
if let areInIncreasingOrder {
211211
lhsChildren.sort(by: areInIncreasingOrder)
212212
rhsChildren.sort(by: areInIncreasingOrder)
213213
}
@@ -692,8 +692,8 @@ public func diff<T>(_ lhs: T, _ rhs: T, format: DiffFormat = .default) -> String
692692
)
693693

694694
default:
695-
if let lhs = stringFromStringProtocol(lhs),
696-
let rhs = stringFromStringProtocol(rhs),
695+
if let lhs = String(stringProtocol: lhs),
696+
let rhs = String(stringProtocol: rhs),
697697
lhs.contains(where: \.isNewline) || rhs.contains(where: \.isNewline)
698698
{
699699
let lhsMirror = Mirror(

Sources/CustomDump/Dump.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func _customDump<T, TargetStream>(
411411
)
412412

413413
default:
414-
if let value = stringFromStringProtocol(value) {
414+
if let value = String(stringProtocol: value) {
415415
if value.contains(where: \.isNewline) {
416416
if maxDepth <= 0 {
417417
out.write("\"\"")

Sources/CustomDump/Internal/Box.swift

Lines changed: 0 additions & 79 deletions
This file was deleted.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
func isIdentityEqual(_ lhs: Any, _ rhs: Any) -> Bool {
2+
guard let lhs = lhs as? any Identifiable else { return false }
3+
func open<LHS: Identifiable>(_ lhs: LHS) -> Bool {
4+
guard let rhs = rhs as? LHS else { return false }
5+
return lhs.id == rhs.id
6+
}
7+
return open(lhs)
8+
}

0 commit comments

Comments
 (0)