Skip to content

Commit 69dd001

Browse files
authored
Swift 6.0 (#147)
1 parent c7fb8ae commit 69dd001

33 files changed

+222
-242
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ on:
88
workflow_dispatch:
99

1010
env:
11-
DEVELOPER_DIR: /Applications/Xcode_15.4.app
11+
DEVELOPER_DIR: /Applications/Xcode_16.0.app
1212

1313
jobs:
1414
publish-docs:

.github/workflows/test.yml

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,34 +10,40 @@ on:
1010
workflow_dispatch:
1111

1212
env:
13-
DEVELOPER_DIR: /Applications/Xcode_15.4.app
13+
DEVELOPER_DIR: /Applications/Xcode_16.app
1414

1515
jobs:
1616
test:
1717
name: Test
1818
runs-on: macos-14
1919
strategy:
2020
matrix:
21+
xcode_version:
22+
- 15.4
23+
- 16
2124
platform:
2225
- ios
2326
- macos
2427
- tvos
2528
- watchos
29+
env:
30+
DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app
2631
steps:
2732
- uses: actions/checkout@v4
2833
- name: Test library
2934
run: scripts/test.sh library ${{ matrix.platform }}
30-
- name: Test example cross platform
31-
if: matrix.platform == 'macos' || matrix.platform == 'tvos'
32-
run: scripts/test.sh example-cross-platform ${{ matrix.platform }}
3335

3436
test_examples:
35-
name: Test iOS examples
37+
name: Test examples
3638
runs-on: macos-14
3739
steps:
3840
- uses: actions/checkout@v4
3941
- name: Test example iOS
4042
run: scripts/test.sh example-ios ios
43+
- name: Test example macOS
44+
run: scripts/test.sh example-cross-platform macos
45+
- name: Test example tvOS
46+
run: scripts/test.sh example-cross-platform tvos
4147

4248
benchmark:
4349
name: Benchmark

Benchmarks/Project.xcodeproj/project.pbxproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,7 @@
251251
SDKROOT = iphoneos;
252252
SWIFT_COMPILATION_MODE = wholemodule;
253253
SWIFT_OPTIMIZATION_LEVEL = "-O";
254-
SWIFT_STRICT_CONCURRENCY = complete;
255-
SWIFT_VERSION = 5.0;
254+
SWIFT_VERSION = 6;
256255
};
257256
name = Release;
258257
};
@@ -383,8 +382,7 @@
383382
SDKROOT = iphoneos;
384383
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
385384
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
386-
SWIFT_STRICT_CONCURRENCY = complete;
387-
SWIFT_VERSION = 5.0;
385+
SWIFT_VERSION = 6;
388386
};
389387
name = Debug;
390388
};

Benchmarks/Tests/ViewTest.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import SwiftUI
22

3-
struct ViewTest<Content: View>: _ViewTest {
3+
struct ViewTest<Content: View & Sendable>: _ViewTest {
44
let rootView: @MainActor () -> Content
55

66
func initRootView() -> some View {

Benchmarks/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ settings:
88
CODE_SIGNING_REQUIRED: NO
99
CODE_SIGN_IDENTITY: "-"
1010
CODE_SIGN_STYLE: Manual
11-
SWIFT_STRICT_CONCURRENCY: complete
11+
SWIFT_VERSION: 6
1212

1313
packages:
1414
swiftui-atom-properties:
Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22

33
import PackageDescription
44

5-
let swiftSettings: [SwiftSetting] = [
6-
.enableExperimentalFeature("StrictConcurrency")
7-
]
8-
9-
func target(name: String, dependencies: [Target.Dependency] = []) -> Target {
10-
.target(
11-
name: name,
12-
dependencies: [.product(name: "Atoms", package: "swiftui-atom-properties")] + dependencies,
13-
swiftSettings: swiftSettings
14-
)
15-
}
16-
17-
func testTarget(name: String, dependencies: [Target.Dependency]) -> Target {
18-
.testTarget(
19-
name: name,
20-
dependencies: dependencies,
21-
swiftSettings: swiftSettings
22-
)
23-
}
5+
let atoms = Target.Dependency.product(name: "Atoms", package: "swiftui-atom-properties")
246

257
let package = Package(
268
name: "CrossPlatformExamples",
@@ -37,16 +19,17 @@ let package = Package(
3719
.package(path: "../../..")
3820
],
3921
targets: [
40-
target(
22+
.target(
4123
name: "CrossPlatformApp",
4224
dependencies: [
25+
atoms,
4326
"ExampleCounter",
4427
"ExampleTodo",
4528
]
4629
),
47-
target(name: "ExampleCounter"),
48-
testTarget(name: "ExampleCounterTests", dependencies: ["ExampleCounter"]),
49-
target(name: "ExampleTodo"),
50-
testTarget(name: "ExampleTodoTests", dependencies: ["ExampleTodo"]),
30+
.target(name: "ExampleCounter", dependencies: [atoms]),
31+
.testTarget(name: "ExampleCounterTests", dependencies: ["ExampleCounter"]),
32+
.target(name: "ExampleTodo", dependencies: [atoms]),
33+
.testTarget(name: "ExampleTodoTests", dependencies: ["ExampleTodo"]),
5134
]
5235
)
Lines changed: 12 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
1-
// swift-tools-version:5.10
1+
// swift-tools-version:6.0
22

33
import PackageDescription
44

5-
let swiftSettings: [SwiftSetting] = [
6-
.enableExperimentalFeature("StrictConcurrency")
7-
]
8-
9-
func target(name: String, dependencies: [Target.Dependency] = []) -> Target {
10-
.target(
11-
name: name,
12-
dependencies: [.product(name: "Atoms", package: "swiftui-atom-properties")] + dependencies,
13-
swiftSettings: swiftSettings
14-
)
15-
}
16-
17-
func testTarget(name: String, dependencies: [Target.Dependency]) -> Target {
18-
.testTarget(
19-
name: name,
20-
dependencies: dependencies,
21-
swiftSettings: swiftSettings
22-
)
23-
}
5+
let atoms = Target.Dependency.product(name: "Atoms", package: "swiftui-atom-properties")
246

257
let package = Package(
268
name: "iOSExamples",
@@ -35,23 +17,24 @@ let package = Package(
3517
.package(path: "../CrossPlatform"),
3618
],
3719
targets: [
38-
target(
20+
.target(
3921
name: "iOSApp",
4022
dependencies: [
23+
atoms,
4124
.product(name: "CrossPlatformApp", package: "CrossPlatform"),
4225
"ExampleMovieDB",
4326
"ExampleMap",
4427
"ExampleVoiceMemo",
4528
"ExampleTimeTravel",
4629
]
4730
),
48-
target(name: "ExampleMovieDB"),
49-
testTarget(name: "ExampleMovieDBTests", dependencies: ["ExampleMovieDB"]),
50-
target(name: "ExampleMap"),
51-
testTarget(name: "ExampleMapTests", dependencies: ["ExampleMap"]),
52-
target(name: "ExampleVoiceMemo"),
53-
testTarget(name: "ExampleVoiceMemoTests", dependencies: ["ExampleVoiceMemo"]),
54-
target(name: "ExampleTimeTravel"),
55-
testTarget(name: "ExampleTimeTravelTests", dependencies: ["ExampleTimeTravel"]),
31+
.target(name: "ExampleMovieDB", dependencies: [atoms]),
32+
.testTarget(name: "ExampleMovieDBTests", dependencies: ["ExampleMovieDB"]),
33+
.target(name: "ExampleMap", dependencies: [atoms]),
34+
.testTarget(name: "ExampleMapTests", dependencies: ["ExampleMap"]),
35+
.target(name: "ExampleVoiceMemo", dependencies: [atoms]),
36+
.testTarget(name: "ExampleVoiceMemoTests", dependencies: ["ExampleVoiceMemo"]),
37+
.target(name: "ExampleTimeTravel", dependencies: [atoms]),
38+
.testTarget(name: "ExampleTimeTravelTests", dependencies: ["ExampleTimeTravel"]),
5639
]
5740
)

Examples/Packages/iOS/Sources/ExampleVoiceMemo/Dependency/AudioRecorder.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ protocol AudioRecorderProtocol {
77
func stop()
88
}
99

10-
final class AudioRecorder: NSObject, AVAudioRecorderDelegate, AudioRecorderProtocol {
10+
final class AudioRecorder: NSObject, AVAudioRecorderDelegate, AudioRecorderProtocol, @unchecked Sendable {
1111
private var recorder: AVAudioRecorder?
1212
private let onFail: () -> Void
1313

Examples/Project.xcodeproj/project.pbxproj

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,8 +276,7 @@
276276
PRODUCT_NAME = "$(TARGET_NAME)";
277277
SWIFT_COMPILATION_MODE = wholemodule;
278278
SWIFT_OPTIMIZATION_LEVEL = "-O";
279-
SWIFT_STRICT_CONCURRENCY = complete;
280-
SWIFT_VERSION = 5.0;
279+
SWIFT_VERSION = 6;
281280
TVOS_DEPLOYMENT_TARGET = 16.0;
282281
};
283282
name = Release;
@@ -408,8 +407,7 @@
408407
PRODUCT_NAME = "$(TARGET_NAME)";
409408
SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG;
410409
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
411-
SWIFT_STRICT_CONCURRENCY = complete;
412-
SWIFT_VERSION = 5.0;
410+
SWIFT_VERSION = 6;
413411
TVOS_DEPLOYMENT_TARGET = 16.0;
414412
};
415413
name = Debug;

Examples/project.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ settings:
1212
CODE_SIGNING_REQUIRED: NO
1313
CODE_SIGN_IDENTITY: "-"
1414
CODE_SIGN_STYLE: Manual
15-
SWIFT_STRICT_CONCURRENCY: complete
15+
SWIFT_VERSION: 6
1616

1717
targetTemplates:
1818
App:

0 commit comments

Comments
 (0)