Skip to content

Commit bef3861

Browse files
committed
Merge remote-tracking branch 'origin/main' into core
2 parents c70426f + 61e3809 commit bef3861

File tree

233 files changed

+2030
-1756
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

233 files changed

+2030
-1756
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -20,26 +20,35 @@ jobs:
2020
strategy:
2121
matrix:
2222
command: [test, '']
23-
platform: [iOS, macOS, tvOS, watchOS, visionOS, macCatalyst]
23+
platform: [IOS, MAC_CATALYST, MACOS, TVOS, VISIONOS, WATCHOS]
2424
xcode: [15.2, 15.4, '16.0']
2525
exclude:
2626
- {xcode: 15.2, command: test}
2727
- {xcode: 15.4, command: ''}
28-
- {xcode: 15.2, platform: macCatalyst}
29-
- {xcode: 15.2, platform: tvOS}
30-
- {xcode: 15.2, platform: visionOS}
31-
- {xcode: 15.2, platform: watchOS}
28+
- {xcode: 15.2, platform: MAC_CATALYST}
29+
- {xcode: 15.2, platform: TVOS}
30+
- {xcode: 15.2, platform: VISIONOS}
31+
- {xcode: 15.2, platform: WATCHOS}
3232
- {xcode: '16.0', command: ''}
33-
- {xcode: '16.0', platform: macCatalyst}
34-
- {xcode: '16.0', platform: tvOS}
35-
- {xcode: '16.0', platform: visionOS}
36-
- {xcode: '16.0', platform: watchOS}
33+
- {xcode: '16.0', platform: MAC_CATALYST}
34+
- {xcode: '16.0', platform: TVOS}
35+
- {xcode: '16.0', platform: VISIONOS}
36+
- {xcode: '16.0', platform: WATCHOS}
3737
include:
3838
- {xcode: 15.2, skip_release: 1}
3939
steps:
4040
- uses: actions/checkout@v4
4141
- name: Select Xcode ${{ matrix.xcode }}
4242
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
43+
- name: Install visionOS runtime
44+
if: matrix.platform == 'visionOS'
45+
run: |
46+
sudo xcodebuild -runFirstLaunch
47+
sudo xcrun simctl list
48+
sudo xcodebuild -downloadPlatform visionOS
49+
sudo xcodebuild -runFirstLaunch
50+
- name: List available devices
51+
run: xcrun simctl list devices available
4352
- name: Cache derived data
4453
uses: actions/cache@v3
4554
with:
@@ -49,15 +58,15 @@ jobs:
4958
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-${{ hashFiles('**/Sources/**/*.swift', '**/Tests/**/*.swift') }}
5059
restore-keys: |
5160
deriveddata-xcodebuild-${{ matrix.platform }}-${{ matrix.xcode }}-${{ matrix.command }}-
52-
- name: Set IgnoreFileSystemDeviceInodeChanges flag
61+
- name: Set IgnoreFileSystemDeviceInodeChanges flag
5362
run: defaults write com.apple.dt.XCBuild IgnoreFileSystemDeviceInodeChanges -bool YES
54-
- name: Update mtime for incremental builds
63+
- name: Update mtime for incremental builds
5564
uses: chetan/git-restore-mtime-action@v2
5665
- name: Debug
57-
run: make COMMAND="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" xcodebuild
66+
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Debug PLATFORM="${{ matrix.platform }}" WORKSPACE=.github/package.xcworkspace xcodebuild
5867
- name: Release
5968
if: matrix.skip_release != '1'
60-
run: make COMMAND="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" xcodebuild
69+
run: make XCODEBUILD_ARGUMENT="${{ matrix.command }}" CONFIG=Release PLATFORM="${{ matrix.platform }}" WORKSPACE=.github/package.xcworkspace xcodebuild
6170

6271
library-evolution:
6372
name: Library (evolution)
@@ -89,18 +98,30 @@ jobs:
8998
- name: Update mtime for incremental builds
9099
uses: chetan/git-restore-mtime-action@v2
91100
- name: CaseStudies (SwiftUI)
92-
run: make SCHEME="CaseStudies (SwiftUI)" test-example
101+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="CaseStudies (SwiftUI)" xcodebuild-raw
93102
- name: CaseStudies (UIKit)
94-
run: make SCHEME="CaseStudies (UIKit)" test-example
103+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="CaseStudies (UIKit)" xcodebuild-raw
95104
- name: Search
96-
run: make SCHEME="Search" test-example
105+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="Search" xcodebuild-raw
97106
- name: SyncUps
98-
run: make SCHEME="SyncUps" test-example
107+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="SyncUps" xcodebuild-raw
99108
- name: SpeechRecognition
100-
run: make SCHEME="SpeechRecognition" test-example
109+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="SpeechRecognition" xcodebuild-raw
101110
- name: TicTacToe
102-
run: make SCHEME="TicTacToe" test-example
111+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="TicTacToe" xcodebuild-raw
103112
- name: Todos
104-
run: make SCHEME="Todos" test-example
113+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="Todos" xcodebuild-raw
105114
- name: VoiceMemos
106-
run: make SCHEME="VoiceMemos" test-example
115+
run: make DERIVED_DATA_PATH=~/.derivedData SCHEME="VoiceMemos" xcodebuild-raw
116+
117+
check-macro-compatibility:
118+
name: Check Macro Compatibility
119+
runs-on: macos-latest
120+
steps:
121+
- name: Checkout repository
122+
uses: actions/checkout@v4
123+
- name: Run Swift Macro Compatibility Check
124+
uses: Matejkob/swift-macro-compatibility-check@v1
125+
with:
126+
run-tests: false
127+
major-versions-only: true

.github/workflows/documentation.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@ concurrency:
1717

1818
jobs:
1919
build:
20-
runs-on: macos-13
20+
runs-on: macos-14
2121
steps:
22-
- name: Select Xcode 15.1
23-
run: sudo xcode-select -s /Applications/Xcode_15.1.app
22+
- name: Select Xcode 16.0
23+
run: sudo xcode-select -s /Applications/Xcode_16.0.app
2424

2525
- name: Checkout Package
2626
uses: actions/checkout@v4

.github/workflows/scheduled-ci.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.DS_Store
2-
/.build
3-
/.swiftpm
2+
.build
3+
.swiftpm
44
/Packages
55
/*.swiftinterface
66
/*.xcodeproj
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
import Benchmark
2+
import ComposableArchitecture
3+
import Foundation
4+
5+
private func initialState(for nesting: Int) -> Feature.State {
6+
(1..<nesting).reduce(into: Feature.State()) { state, _ in state = Feature.State(child: state) }
7+
}
8+
9+
@MainActor
10+
private func rootStore(for nesting: Int) -> StoreOf<Feature> {
11+
Store(initialState: initialState(for: nesting)) { Feature() }
12+
}
13+
14+
@MainActor
15+
private func scopedStore(for nesting: Int, from root: StoreOf<Feature>? = nil) -> StoreOf<Feature> {
16+
(1..<nesting).reduce(into: root ?? rootStore(for: nesting)) { store, _ in
17+
store = store.scope(state: \.child, action: \.child.presented)!
18+
}
19+
}
20+
21+
let benchmarks = { @Sendable in
22+
Benchmark("Store.Scope") { @MainActor benchmark async in
23+
benchmark.startMeasurement()
24+
_ = scopedStore(for: 1)
25+
}
26+
27+
Benchmark("Store.Send") { @MainActor benchmark async in
28+
let store = scopedStore(for: 1)
29+
benchmark.startMeasurement()
30+
blackHole(store.send(.incrementButtonTapped))
31+
}
32+
33+
Benchmark("Store.Access") { @MainActor benchmark async in
34+
let store = scopedStore(for: 1)
35+
benchmark.startMeasurement()
36+
blackHole(store.state)
37+
}
38+
39+
Benchmark("NestedStore.Scope") { @MainActor benchmark async in
40+
benchmark.startMeasurement()
41+
_ = scopedStore(for: 10)
42+
}
43+
44+
Benchmark("NestedStore.Send") { @MainActor benchmark async in
45+
let store = scopedStore(for: 10)
46+
benchmark.startMeasurement()
47+
blackHole(store.send(.incrementButtonTapped))
48+
}
49+
50+
Benchmark("NestedStore.RootSend") { @MainActor benchmark async in
51+
let root = rootStore(for: 10)
52+
let store = scopedStore(for: 10, from: root)
53+
benchmark.startMeasurement()
54+
blackHole(root.send(.incrementButtonTapped))
55+
}
56+
57+
Benchmark("NestedStore.NestedSend(1)") { @MainActor benchmark async in
58+
let root = rootStore(for: 10)
59+
let store = scopedStore(for: 10, from: root)
60+
benchmark.startMeasurement()
61+
blackHole(root.send(.child(.presented(.incrementButtonTapped))))
62+
}
63+
64+
Benchmark("NestedStore.Access") { @MainActor benchmark async in
65+
let store = scopedStore(for: 10)
66+
benchmark.startMeasurement()
67+
blackHole(store.state)
68+
}
69+
}
70+
71+
@Reducer
72+
private struct Feature {
73+
@ObservableState
74+
struct State {
75+
var count = 0
76+
@Presents var child: Feature.State?
77+
}
78+
enum Action {
79+
indirect case child(PresentationAction<Feature.Action>)
80+
case incrementButtonTapped
81+
}
82+
var body: some ReducerOf<Self> {
83+
Reduce { state, action in
84+
switch action {
85+
case .child:
86+
return .none
87+
case .incrementButtonTapped:
88+
state.count += 1
89+
return .none
90+
}
91+
}
92+
.ifLet(\.$child, action: \.child) {
93+
Feature()
94+
}
95+
}
96+
}

0 commit comments

Comments
 (0)