Skip to content

Commit e35da90

Browse files
Upgrade to latest pointfreeco/main v0.36.0
0.36.0 release update
2 parents 79d4916 + b8dddaf commit e35da90

File tree

82 files changed

+2170
-998
lines changed

Some content is hidden

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

82 files changed

+2170
-998
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,37 +7,31 @@ on:
77
pull_request:
88
branches:
99
- '*'
10+
workflow_dispatch:
1011

1112
jobs:
1213
library:
13-
runs-on: macos-11.0
14+
runs-on: macos-12
1415
strategy:
1516
matrix:
16-
xcode:
17-
- '12.4'
18-
- '12.5.1'
19-
- '13.2.1'
17+
xcode: [13.2.1, 13.3]
2018
steps:
2119
- uses: actions/checkout@v2
2220
- name: Select Xcode ${{ matrix.xcode }}
2321
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
2422
- name: Run tests
2523
run: make test-library
2624
- name: Compile documentation
27-
if: ${{ matrix.xcode == '13.2' }}
25+
if: ${{ matrix.xcode == '13.3' }}
2826
run: make test-docs
2927
- name: Run benchmark
3028
run: make benchmark
3129

3230
examples:
33-
runs-on: macos-11.0
34-
strategy:
35-
matrix:
36-
xcode:
37-
- '13.2.1'
31+
runs-on: macos-12
3832
steps:
3933
- uses: actions/checkout@v2
4034
- name: Select Xcode ${{ matrix.xcode }}
41-
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
35+
run: sudo xcode-select -s /Applications/Xcode_13.3.app
4236
- name: Run tests
4337
run: make test-examples
Lines changed: 92 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,104 @@
1+
# Build and deploy DocC to GitHub pages. Based off of @karwa's work here:
2+
# https://github.com/karwa/swift-url/blob/main/.github/workflows/docs.yml
13
name: Documentation
4+
25
on:
36
release:
47
types:
58
- published
9+
push:
10+
branches:
11+
- main
612
workflow_dispatch:
713

814
jobs:
915
build:
10-
runs-on: ubuntu-latest
11-
16+
runs-on: macos-12
1217
steps:
13-
- uses: actions/checkout@v2
14-
- name: Generate Documentation
15-
uses: SwiftDocOrg/swift-doc@master
18+
- name: Checkout Package
19+
uses: actions/checkout@v2
20+
with:
21+
fetch-depth: 0
22+
23+
- name: Checkout swift-docc
24+
uses: actions/checkout@v2
25+
with:
26+
repository: apple/swift-docc
27+
ref: main
28+
path: swift-docc
29+
- name: Cache DocC
30+
id: cache-docc
31+
uses: actions/cache@v2
32+
with:
33+
key: swift-url-docc-build
34+
path: swift-docc/.build
35+
- name: Build swift-docc
36+
if: ${{ !steps.cache-docc.outputs.cache-hit }}
37+
run: |
38+
cd swift-docc; swift build --product docc -c release; cd ..
39+
40+
- name: Checkout swift-docc-render
41+
uses: actions/checkout@v2
1642
with:
17-
base-url: /swift-composable-architecture/
18-
format: html
19-
inputs: Sources/ComposableArchitecture
20-
module-name: ComposableArchitecture
21-
output: Documentation
22-
- name: Update Permissions
23-
run: 'sudo chown --recursive $USER Documentation'
24-
- name: Deploy to GitHub Pages
25-
uses: JamesIves/github-pages-deploy-action@releases/v3
43+
repository: apple/swift-docc-render
44+
ref: main
45+
path: swift-docc-render
46+
- name: Build swift-docc-render
47+
run: |
48+
cd swift-docc-render; npm install && npm run build; cd ..
49+
50+
- name: Checkout gh-pages Branch
51+
uses: actions/checkout@v2
52+
with:
53+
ref: gh-pages
54+
path: docs-out
55+
56+
- name: Build documentation
57+
run: >
58+
rm -rf docs-out/.git;
59+
rm -rf docs-out/main;
60+
61+
for tag in $(echo "main"; git tag);
62+
do
63+
echo "⏳ Generating documentation for "$tag" release.";
64+
65+
if [ -d "docs-out/$tag" ]
66+
then
67+
echo "✅ Documentation for "$tag" already exists.";
68+
else
69+
git checkout "$tag";
70+
mkdir -p Sources/ComposableArchitecture/Documentation.docc;
71+
export DOCC_HTML_DIR="$(pwd)/swift-docc-render/dist";
72+
73+
rm -rf .build/symbol-graphs;
74+
mkdir -p .build/symbol-graphs;
75+
swift build \
76+
--target ComposableArchitecture \
77+
-Xswiftc \
78+
-emit-symbol-graph \
79+
-Xswiftc \
80+
-emit-symbol-graph-dir \
81+
-Xswiftc \
82+
.build/symbol-graphs \
83+
&& swift-docc/.build/release/docc convert Sources/ComposableArchitecture/Documentation.docc \
84+
--fallback-display-name ComposableArchitecture \
85+
--fallback-bundle-identifier co.pointfree.ComposableArchitecture \
86+
--fallback-bundle-version 0.0.0 \
87+
--additional-symbol-graph-dir \
88+
.build/symbol-graphs \
89+
--transform-for-static-hosting \
90+
--hosting-base-path /swift-composable-architecture/"$tag" \
91+
--output-path docs-out/"$tag" \
92+
&& echo "✅ Documentation generated for "$tag" release." \
93+
|| echo "⚠️ Documentation skipped for "$tag".";
94+
fi;
95+
done
96+
97+
- name: Fix permissions
98+
run: 'sudo chown -R $USER docs-out'
99+
- name: Publish documentation to GitHub Pages
100+
uses: JamesIves/[email protected]
26101
with:
27-
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
28-
BRANCH: gh-pages
29-
FOLDER: Documentation
102+
branch: gh-pages
103+
folder: docs-out
104+
single-commit: true

.spi.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,8 @@ builder:
55
scheme: ComposableArchitecture
66
- platform: macos-xcodebuild
77
scheme: ComposableArchitecture
8-
- platform: macos-xcodebuild-arm
9-
scheme: ComposableArchitecture
108
- platform: tvos
119
scheme: ComposableArchitecture
1210
- platform: watchos
1311
scheme: ComposableArchitecture_watchOS
12+
- documentation_targets: [ComposableArchitecture]

Examples/CaseStudies/CaseStudies.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
DC25DC612450F2B000082E81 /* LoadThenNavigate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC25DC602450F2B000082E81 /* LoadThenNavigate.swift */; };
5050
DC25DC642450F2DF00082E81 /* ActivityIndicatorViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC25DC632450F2DF00082E81 /* ActivityIndicatorViewController.swift */; };
5151
DC27215625BF84FC00D9C8DB /* 01-GettingStarted-BindingBasicsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC27215525BF84FC00D9C8DB /* 01-GettingStarted-BindingBasicsTests.swift */; };
52-
DC2E370D24573ACB00B94699 /* 04-HigherOrderReducers-StrictReducers.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC2E370C24573ACB00B94699 /* 04-HigherOrderReducers-StrictReducers.swift */; };
5352
DC4C6EAC2450DD380066A05D /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4C6EAB2450DD380066A05D /* SceneDelegate.swift */; };
5453
DC4C6EAE2450DD380066A05D /* RootViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = DC4C6EAD2450DD380066A05D /* RootViewController.swift */; };
5554
DC4C6EB02450DD380066A05D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = DC4C6EAF2450DD380066A05D /* Assets.xcassets */; };
@@ -192,7 +191,6 @@
192191
DC25DC602450F2B000082E81 /* LoadThenNavigate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoadThenNavigate.swift; sourceTree = "<group>"; };
193192
DC25DC632450F2DF00082E81 /* ActivityIndicatorViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityIndicatorViewController.swift; sourceTree = "<group>"; };
194193
DC27215525BF84FC00D9C8DB /* 01-GettingStarted-BindingBasicsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "01-GettingStarted-BindingBasicsTests.swift"; sourceTree = "<group>"; };
195-
DC2E370C24573ACB00B94699 /* 04-HigherOrderReducers-StrictReducers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "04-HigherOrderReducers-StrictReducers.swift"; sourceTree = "<group>"; };
196194
DC4C6EA72450DD380066A05D /* UIKitCaseStudies.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = UIKitCaseStudies.app; sourceTree = BUILT_PRODUCTS_DIR; };
197195
DC4C6EAB2450DD380066A05D /* SceneDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SceneDelegate.swift; sourceTree = "<group>"; };
198196
DC4C6EAD2450DD380066A05D /* RootViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RootViewController.swift; sourceTree = "<group>"; };
@@ -419,7 +417,6 @@
419417
CA3E4C5A24B4FA0E00447C0B /* 04-HigherOrderReducers-Lifecycle.swift */,
420418
DCE63B70245CC0B90080A23D /* 04-HigherOrderReducers-Recursion.swift */,
421419
DCC68EE22447C8540037F998 /* 04-HigherOrderReducers-ReusableFavoriting.swift */,
422-
DC2E370C24573ACB00B94699 /* 04-HigherOrderReducers-StrictReducers.swift */,
423420
DCFE195F278DBF0600C14CCF /* CaseStudiesApp.swift */,
424421
CA5ECF91267A79F0002067FF /* FactClient.swift */,
425422
DC89C41C24460F96006900B9 /* Assets.xcassets */,
@@ -749,7 +746,6 @@
749746
DCAC2A4F2452352E0094DEF5 /* 04-HigherOrderReducers-ElmLikeSubscriptions.swift in Sources */,
750747
CA6AC2672451135C00C71CB3 /* DownloadClient.swift in Sources */,
751748
CAA9ADC624465C810003A984 /* 02-Effects-Cancellation.swift in Sources */,
752-
DC2E370D24573ACB00B94699 /* 04-HigherOrderReducers-StrictReducers.swift in Sources */,
753749
CA5ECF92267A79F0002067FF /* FactClient.swift in Sources */,
754750
DC9EB4172450CBD2005F413B /* UIViewRepresented.swift in Sources */,
755751
CA6AC2652451135C00C71CB3 /* CircularProgressView.swift in Sources */,

Examples/CaseStudies/SwiftUICaseStudies/00-Core.swift

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ struct RootState {
1212
#endif
1313
var clock = ClockState()
1414
var counter = CounterState()
15-
var dieRoll = DieRollState()
1615
var effectsBasics = EffectsBasicsState()
1716
var effectsCancellation = EffectsCancellationState()
1817
var effectsTimers = TimersState()
@@ -48,7 +47,6 @@ enum RootAction {
4847
#endif
4948
case clock(ClockAction)
5049
case counter(CounterAction)
51-
case dieRoll(DieRollAction)
5250
case effectsBasics(EffectsBasicsAction)
5351
case effectsCancellation(EffectsCancellationAction)
5452
case episodes(EpisodesAction)
@@ -82,7 +80,7 @@ struct RootEnvironment {
8280
var favorite: (UUID, Bool) -> Effect<Bool, Error>
8381
var fetchNumber: () -> Effect<Int, Never>
8482
var mainQueue: AnySchedulerOf<DispatchQueue>
85-
var userDidTakeScreenshot: Effect<Void, Never>
83+
var notificationCenter: NotificationCenter
8684
var uuid: () -> UUID
8785
var webSocket: WebSocketClient
8886

@@ -93,7 +91,7 @@ struct RootEnvironment {
9391
favorite: favorite(id:isFavorite:),
9492
fetchNumber: liveFetchNumber,
9593
mainQueue: .main,
96-
userDidTakeScreenshot: liveUserDidTakeScreenshot,
94+
notificationCenter: .default,
9795
uuid: UUID.init,
9896
webSocket: .live
9997
)
@@ -154,12 +152,6 @@ let rootReducer = Reducer<RootState, RootAction, RootEnvironment>.combine(
154152
action: /RootAction.counter,
155153
environment: { _ in .init() }
156154
),
157-
dieRollReducer
158-
.pullback(
159-
state: \.dieRoll,
160-
action: /RootAction.dieRoll,
161-
environment: { _ in .init(rollDie: { .random(in: 1...6) }) }
162-
),
163155
effectsBasicsReducer
164156
.pullback(
165157
state: \.effectsBasics,
@@ -220,7 +212,7 @@ let rootReducer = Reducer<RootState, RootAction, RootEnvironment>.combine(
220212
.pullback(
221213
state: \.longLivingEffects,
222214
action: /RootAction.longLivingEffects,
223-
environment: { .init(userDidTakeScreenshot: $0.userDidTakeScreenshot) }
215+
environment: { .init(notificationCenter: $0.notificationCenter) }
224216
),
225217
mapAppReducer
226218
.pullback(
@@ -312,8 +304,3 @@ private func liveFetchNumber() -> Effect<Int, Never> {
312304
.delay(for: 1, scheduler: DispatchQueue.main)
313305
.eraseToEffect()
314306
}
315-
316-
private let liveUserDidTakeScreenshot = NotificationCenter.default
317-
.publisher(for: UIApplication.userDidTakeScreenshotNotification)
318-
.map { _ in () }
319-
.eraseToEffect()

Examples/CaseStudies/SwiftUICaseStudies/00-RootView.swift

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -271,16 +271,6 @@ struct RootView: View {
271271
)
272272
)
273273

274-
NavigationLink(
275-
"Strict reducers",
276-
destination: DieRollView(
277-
store: self.store.scope(
278-
state: \.dieRoll,
279-
action: RootAction.dieRoll
280-
)
281-
)
282-
)
283-
284274
NavigationLink(
285275
"Elm-like subscriptions",
286276
destination: ClockView(

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-Animations.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ private let readMe = """
2020
"""
2121

2222
extension Effect where Failure == Never {
23-
public static func keyFrames<S>(
23+
public static func keyFrames<S: Scheduler>(
2424
values: [(output: Output, duration: S.SchedulerTimeType.Stride)],
2525
scheduler: S
26-
) -> Effect where S: Scheduler {
26+
) -> Self {
2727
.concatenate(
2828
values
2929
.enumerated()

Examples/CaseStudies/SwiftUICaseStudies/01-GettingStarted-FocusState.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
}
7676

7777
extension View {
78-
func synchronize<Value: Equatable>(
78+
func synchronize<Value>(
7979
_ first: Binding<Value>,
8080
_ second: FocusState<Value>.Binding
8181
) -> some View {

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-Cancellation.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,18 @@ let effectsCancellationReducer = Reducer<
3939
EffectsCancellationState, EffectsCancellationAction, EffectsCancellationEnvironment
4040
> { state, action, environment in
4141

42-
struct TriviaRequestId: Hashable {}
42+
enum TriviaRequestId {}
4343

4444
switch action {
4545
case .cancelButtonTapped:
4646
state.isTriviaRequestInFlight = false
47-
return .cancel(id: TriviaRequestId())
47+
return .cancel(id: TriviaRequestId.self)
4848

4949
case let .stepperChanged(value):
5050
state.count = value
5151
state.currentTrivia = nil
5252
state.isTriviaRequestInFlight = false
53-
return .cancel(id: TriviaRequestId())
53+
return .cancel(id: TriviaRequestId.self)
5454

5555
case .triviaButtonTapped:
5656
state.currentTrivia = nil
@@ -59,7 +59,7 @@ let effectsCancellationReducer = Reducer<
5959
return environment.fact.fetch(state.count)
6060
.receive(on: environment.mainQueue)
6161
.catchToEffect(EffectsCancellationAction.triviaResponse)
62-
.cancellable(id: TriviaRequestId())
62+
.cancellable(id: TriviaRequestId.self)
6363

6464
case let .triviaResponse(.success(response)):
6565
state.isTriviaRequestInFlight = false

Examples/CaseStudies/SwiftUICaseStudies/02-Effects-LongLiving.swift

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ enum LongLivingEffectsAction {
2727
}
2828

2929
struct LongLivingEffectsEnvironment {
30-
// An effect that emits Void whenever the user takes a screenshot of the device. We use this
31-
// instead of `NotificationCenter.default.publisher` directly in the reducer so that we can test
32-
// it.
33-
var userDidTakeScreenshot: Effect<Void, Never>
30+
var notificationCenter: NotificationCenter
3431
}
3532

3633
// MARK: - Business logic
@@ -39,7 +36,7 @@ let longLivingEffectsReducer = Reducer<
3936
LongLivingEffectsState, LongLivingEffectsAction, LongLivingEffectsEnvironment
4037
> { state, action, environment in
4138

42-
struct UserDidTakeScreenshotNotificationId: Hashable {}
39+
enum UserDidTakeScreenshotNotificationId {}
4340

4441
switch action {
4542
case .userDidTakeScreenshotNotification:
@@ -48,13 +45,14 @@ let longLivingEffectsReducer = Reducer<
4845

4946
case .onAppear:
5047
// When the view appears, start the effect that emits when screenshots are taken.
51-
return environment.userDidTakeScreenshot
52-
.map { LongLivingEffectsAction.userDidTakeScreenshotNotification }
53-
.cancellable(id: UserDidTakeScreenshotNotificationId())
48+
return environment.notificationCenter
49+
.publisher(for: UIApplication.userDidTakeScreenshotNotification)
50+
.eraseToEffect { _ in LongLivingEffectsAction.userDidTakeScreenshotNotification }
51+
.cancellable(id: UserDidTakeScreenshotNotificationId.self)
5452

5553
case .onDisappear:
5654
// When view disappears, stop the effect.
57-
return .cancel(id: UserDidTakeScreenshotNotificationId())
55+
return .cancel(id: UserDidTakeScreenshotNotificationId.self)
5856
}
5957
}
6058

@@ -103,7 +101,7 @@ struct EffectsLongLiving_Previews: PreviewProvider {
103101
initialState: LongLivingEffectsState(),
104102
reducer: longLivingEffectsReducer,
105103
environment: LongLivingEffectsEnvironment(
106-
userDidTakeScreenshot: .none
104+
notificationCenter: .default
107105
)
108106
)
109107
)

0 commit comments

Comments
 (0)