Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ jobs:
- uses: actions/checkout@v2
- name: Select Xcode ${{ matrix.xcode }}
run: sudo xcode-select -s /Applications/Xcode_${{ matrix.xcode }}.app
- name: Compile documentation
run: make test-docs
- name: Run tests
run: make test-library
- name: Run benchmark
Expand Down
13 changes: 13 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ test-library:
-scheme ComposableArchitecture_watchOS \
-destination platform="$(PLATFORM_WATCHOS)"

DOC_WARNINGS := $(shell xcodebuild clean docbuild \
-scheme ComposableArchitecture \
-destination platform="$(PLATFORM_MACOS)" \
-quiet \
2>&1 \
| grep "couldn't be resolved to known documentation" \
| sed 's|$(PWD)|.|g' \
| tr '\n' '\1')
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't figure out how to make xcodebuild docbuild fail on warnings, so doing some gnarly Makefile stuff here to hold onto the warnings and print them. Doing a tr dance because of this: https://stackoverflow.com/questions/54067438/how-to-preserve-whitespace-when-saving-command-output-to-a-makefile-variable

test-docs:
@test "$(DOC_WARNINGS)" = "" \
|| (echo "xcodebuild docbuild failed:\n\n$(DOC_WARNINGS)" | tr '\1' '\n' \
&& exit 1)

test-examples:
xcodebuild test \
-scheme "CaseStudies (SwiftUI)" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import CasePaths
import Dispatch

/// Determines how the string description of an action should be printed when using the ``Reducer/debug(prefix:state:action:environment:)``
/// higher-order reducer.
/// Determines how the string description of an action should be printed when using the
/// ``Reducer/debug(_:state:action:actionFormat:environment:)`` higher-order reducer.
public enum ActionFormat {
/// Prints the action in a single line by only specifying the labels of the associated values:
///
Expand Down
39 changes: 22 additions & 17 deletions Sources/ComposableArchitecture/Reducer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,11 @@ public struct Reducer<State, Action, Environment> {
/// action.
///
/// Similar can be said for a
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer. If the
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducer. If the
/// parent domain modifies the child collection by moving, removing, or modifying an element
/// before the ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer
/// runs, the ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer may
/// before the ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573``
/// reducer runs, the
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducer may
/// perform its action against the wrong element, an element that no longer exists, or an element
/// in an unexpected state.
///
Expand Down Expand Up @@ -132,10 +133,11 @@ public struct Reducer<State, Action, Environment> {
/// action.
///
/// Similar can be said for a
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer. If the
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducer. If the
/// parent domain modifies the child collection by moving, removing, or modifying an element
/// before the ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer
/// runs, the ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer may
/// before the ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573``
/// reducer runs, the
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducer may
/// perform its action against the wrong element, an element that no longer exists, or an element
/// in an unexpected state.
///
Expand Down Expand Up @@ -191,10 +193,11 @@ public struct Reducer<State, Action, Environment> {
/// action.
///
/// Similar can be said for a
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer. If the
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducer. If the
/// parent domain modifies the child collection by moving, removing, or modifying an element
/// before the ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer
/// runs, the ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87`` reducer may
/// before the ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573``
/// reducer runs, the
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducer may
/// perform its action against the wrong element, an element that no longer exists, or an element
/// in an unexpected state.
///
Expand Down Expand Up @@ -305,7 +308,7 @@ public struct Reducer<State, Action, Environment> {
/// operator to pullback a reducer that operates on a single case of some state enum to work on
/// the entire state enum.
///
/// When used with the ``combine(_:)-994ake`` operator you can define many reducers that work each
/// When used with the ``combine(_:)-994ak`` operator you can define many reducers that work each
/// case of the state enum, and then _pull them back_ and _combine_ them into one big reducer that
/// works on a large domain.
///
Expand Down Expand Up @@ -736,10 +739,11 @@ public struct Reducer<State, Action, Environment> {
/// )
/// ```
///
/// Take care when combining ``forEach(state:action:environment:breakpointOnNil:_:_:)-90ox5``
/// reducers into parent domains, as order matters. Always combine
/// ``forEach(state:action:environment:breakpointOnNil:_:_:)-90ox5`` reducers _before_ parent
/// reducers that can modify the collection.
/// Take care when combining
/// ``forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducers into parent
/// domains, as order matters. Always combine
/// ``forEach(state:action:environment:breakpointOnNil:file:line:)-7h573`` reducers _before_
/// parent reducers that can modify the collection.
///
/// - Parameters:
/// - toLocalState: A key path that can get/set a collection of `State` elements inside
Expand Down Expand Up @@ -808,10 +812,11 @@ public struct Reducer<State, Action, Environment> {
/// A version of ``pullback(state:action:environment:)`` that transforms a reducer that works on
/// an element into one that works on a dictionary of element values.
///
/// Take care when combining ``forEach(state:action:environment:breakpointOnNil:_:_:)-xv1z``
/// Take care when combining
/// ``forEach(state:action:environment:breakpointOnNil:file:line:)-1h7qx``
/// reducers into parent domains, as order matters. Always combine
/// ``forEach(state:action:environment:breakpointOnNil:_:_:)-xv1z`` reducers _before_ parent
/// reducers that can modify the dictionary.
/// ``forEach(state:action:environment:breakpointOnNil:file:line:)-1h7qx`` reducers _before_
/// parent reducers that can modify the dictionary.
///
/// - Parameters:
/// - toLocalState: A key path that can get/set a dictionary of `State` values inside
Expand Down
2 changes: 1 addition & 1 deletion Sources/ComposableArchitecture/SwiftUI/ForEachStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ import SwiftUI
/// ```
///
/// Enhance its reducer using
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:_:_:)-3ic87``:
/// ``Reducer/forEach(state:action:environment:breakpointOnNil:file:line:)-7h573``:
///
/// ```swift
/// let appReducer = todoReducer.forEach(
Expand Down
7 changes: 3 additions & 4 deletions Sources/ComposableArchitecture/SwiftUI/SwitchStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,10 +47,9 @@ import SwiftUI
/// }
/// ```
///
/// - See also: ``Reducer/pullback(state:action:environment:breakpointOnNil:_:_:)``, a method that
/// aids in transforming reducers that operate on each case of an enum into reducers that operate
/// on the entire enum.
///
/// - See also: ``Reducer/pullback(state:action:environment:breakpointOnNil:file:line:)``, a method
/// that aids in transforming reducers that operate on each case of an enum into reducers that
/// operate on the entire enum.
public struct SwitchStore<State, Action, Content>: View where Content: View {
public let store: Store<State, Action>
public let content: () -> Content
Expand Down