Commit Graph

965 Commits

Author SHA1 Message Date
Stephen Celis
0c22607ba4 Swift bug workaround for TestStore completion (#2923)
* Swift bug workaround for `TestStore` completion

* fix
2024-03-18 13:18:46 -07:00
Stephen Celis
5ab136f5dc Test store tutorial/documentation fixes (#2912)
* Test store tutorial/documentation fixes

* wip
2024-03-11 19:03:17 -07:00
LR.Snow
c90604418c fix (#2808)
'init(initialState:reducer:withDependencies:file:line:)' is deprecated: State must be equatable to perform assertions.
2024-03-11 14:51:26 -07:00
Brandon Williams
ed7a36651f Change "inert" state to have an ever-changing ID (#2910)
* re-record tests before inert change

* record after inert id change

* remove _$inert
2024-03-11 14:44:57 -07:00
Daiki Matsudate
8f0b35056b Add StackActionOf (#2906)
Signed-off-by: Daiki Matsudate <d.matsudate@gmail.com>
2024-03-11 14:03:26 -07:00
Luke Redpath
8907f4f8c3 fix: Give internal store an id. (#2908) 2024-03-11 11:53:13 -07:00
Takehiro Kaneko
a0acf426f7 Fix typo in TreeBasedNavigation.md (#2898) 2024-03-07 11:11:07 -08:00
Stephen Celis
53af95ae3d Fix type-checking regression: remove dynamic case lookup on BindableAction (#2886) 2024-03-04 17:58:30 -08:00
Stephen Celis
9f849e748d Leverage dynamic case writability in example code (#2885)
* Support chainable writability for dynamic case lookup

* wip

* wip

* wip

* wip
2024-03-04 16:17:51 -08:00
Takehiro Kaneko
dfe8e576b7 Fixed document (#2882) 2024-03-03 09:13:06 -08:00
Takehiro Kaneko
687e27795a Fixed a small typo on migration guide 1.9 (#2876) 2024-02-29 20:41:49 -08:00
Brandon Williams
2ddf47f87b Disfavor new subscript (#2875)
* Disfavor case key path for binding actions.

* wip

* fix

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-02-29 14:25:40 -08:00
Brandon Williams
9dcbfd91bd Make enum reducer state equatable in tutorial. (#2873) 2024-02-29 14:25:31 -08:00
Stephen Celis
59f5eec0ff Update docs/examples to leverage TestStore.send(\.path) (#2868) 2024-02-28 17:57:35 -08:00
stephencelis
b070b765e1 Run swift-format 2024-02-28 23:07:18 +00:00
George Scott
b4a3d04267 Add overloads of TestStore.send that accept CaseKeyPaths (#2681)
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-02-28 15:06:27 -08:00
Stephen Celis
591f1a48fb Fix perception warnings (#2849) 2024-02-26 12:01:59 -08:00
Stephen Celis
b8b726c27e Add Reducer.dependency(value) (#2863)
This new reducer operator can be used to directly assign a dependency
key value to the reducer's dependencies.

```swift
// Before;

@Dependency(\.apiClient) var apiClient
// ...
.dependency(\.apiClient, apiClient)

// After:

@Dependency(APIClient.self) var apiClient
// ...
.dependency(apiClient)
```
2024-02-26 12:01:47 -08:00
Stephen Celis
434c648d54 Undisfavor some Store[dynamicMember:] overloads (#2793)
Came up on Slack.

These current disfavored overloads can lead to more difficult to debug
error messages, like when trying to form a binding over bindable actions
with state that isn't equatable.
2024-02-26 12:01:35 -08:00
Brandon Williams
b832aa4d45 Add bindings section to ObservationBackport.md 2024-02-25 19:05:22 -08:00
Brandon Williams
91aed560f7 Document gotcha with macros and previews. (#2855)
* Doucment gotcha with macros and previews.

* wip

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Reducers.md

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Reducers.md

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/Reducers.md
2024-02-25 18:38:43 -08:00
Brandon Williams
3492dab5f3 Remove DEBUG in tests to get more coverage in release (#2856)
* Remove a bunch of DEBUG checks to get more test coverage in release.

* wip

* bring back some debugs

* fixes

* wip
2024-02-25 18:32:10 -08:00
Mizuo Nagayama
604988d15e fix document in PresentationReducer.swift (#2853)
* fix comment in PresentationReducer.swift

* Update Sources/ComposableArchitecture/Reducer/Reducers/PresentationReducer.swift

---------

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
2024-02-25 09:27:15 -08:00
oka yuji
b31317fb78 fix unnecessary diff (#2844) 2024-02-21 21:20:12 -05:00
Brandon Williams
7cf6409cc4 Update MigratingTo1.7.md 2024-02-20 12:40:45 -08:00
Imajin Kawabe
60f63cc798 Add missing opening brace in a TreeBasedNavigation example (#2837) 2024-02-20 10:24:02 -08:00
Takehiro Kaneko
57bedee12a A small change on migration guide 1.8 (#2799) 2024-02-13 22:10:21 -08:00
hmhv
3f682e4f96 Fix typo (#2797)
* fix typo

* fix typo for tutorial
2024-02-13 09:19:56 -08:00
Stephen Celis
5668566d1c Document @Reducer(state: .equatable) in the migration guide (#2796) 2024-02-12 12:21:10 -08:00
stephencelis
cf967a28a8 Run swift-format 2024-02-12 15:11:58 +00:00
Stephen Celis
f75f9380b1 @Reducer macro enhancements (#2795)
* updated binding docs

* adding docs

* clean up

* wip

* wip

* wip

* clean up

* clean up

* clean up

* wip;

* lots of fixes

* update more docs

* fix

* wip

* wip

* Remove ObservationRegistrarWrapper. (#2634)

* Remove ObservationRegistrarWrapper.

* Delete Sources/ComposableArchitecture/Internal/ObservationRegistrarWrapper.swift

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* more docs

* update docs

* a few more tests

* fix

* wip

* wip

* wip

* Cache data in store collections (#2635)

* fix tutorial highlighting

* wip

* wip

* wip

* wip

* tests for observation of special domain types

* another test

* fix

* wip

* Implement memoization for perception checks (#2630)

* Implement memoization for isInSwiftUIBody

* tidy up

* Perception caching updates (#2649)

* Small updates to perception caching.

* wip

* debug

* some more macro tests

* syncups tutorial beginnings

* wip

* wip

* wip

* wip

* wip

* merge fixes

* wip

* update tests

* fix

* fix

* fix perception checking in store

* rename task local

* delete old test

* deprecate test using old apis

* fix test

* perception tests for store

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Opt out of key path for Store.ifLet

* sync ups

* lots more sync up tutorial

* more sync ups tutorial

* wip

* wip

* wio

* wip

* wip

* wip

* updated references of 1.6 to 1.7

* wip

* no need to force unwrap here

* fixed crash in ForEach with bindings

* more sync ups tutorial

* more sync ups tutorial

* wip

* more sync ups

* wip

* wip

* Better support for observing copies of values (#2650)

* Explore using _modify

* wip

* wip

* wip

* wip

* wip

* wip

* more tests

* wip

* get another failing test for an edge case

* wip

* tests all passing

* flag for determining when new state was created

* wip

* clean up

* wip

* wip

* wip;

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* New test that currently fails.

* wip

* wip

* Update Sources/ComposableArchitectureMacros/PresentsMacro.swift

* wip

* remove redundant attached member attribute

* storage

* cleanup

* more benchmarks and tests

* wip

* wip

* wip

* wip

* update tests

* wip

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>

* wip

* wip

* wip

* swift-format

* fix

* wip

* wip

* wip

* wip

* Perception

* wip

* wip

* clean up shared state

* fix shared state tests

* wip

* add alert test

* wip

* wip

* wip

* wip

* Use transaction in binding

* wip

* wip

* wip

* wip

* wip

* wip

* uikit

* keep references to controllers when presenting so that we can properly dismiss

* change order of features in shared state demo

* wip

* cleanup

* cleanup

* wip

* wip

* wip

* Fix perception checking for effect actions.

* wip

* wip

* wip

* Fix perception checking for effect actions.

* wip

* wip

* remove sync ups tutorial

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* @Reducer macro will insert protocol requirements if missing

* wip

* fixes

* fix

* wip

* wip

* wip

* docs for observe function for uikit

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Add cancellation to observation'

* re-record integration test snapshots

* fixed some todos

* update test

* remove 5.9.2 checks

* wip

* wip

* improve docs

* update docs

* updates

* lots of fixes

* more docs

* remove unneeded file;

* wip

* wip

* wip

* update readme and getting started

* wip

* wip

* simplify

* migration stuff

* wip

* Update Models.swift

* wip

* wip

* wip

* Update Bindings.md

* wip

* wip

* wip

* wip

* fix

* wip

* wip

* wip

* wip

* wip

Co-authored-by: Kabir Oberai <oberai.kabir@gmail.com>

* lots of docs and some fixes

* more docs

* more docs

* wip

* upate integration tests to use enum destination macro

* re-org migration guide

* wip

* wip

* docs for other enum reducer macros

* update ephemeral state docs

* wip

* move docs for reducer protocol and macro into single article

* mention observable state

* wip

* updated docs and some macro tests

* wip

* wip

* cleanup

* wip

* wip

* wip

* revert 16

* wip

* clean up

* Revert "clean up"

This reverts commit 49e73081ac.

* Availability fixes

* comment out tests crashing the compiler

* wip

* fix ttt tests

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
Co-authored-by: George Scott <gscott@gekkoto.com>
Co-authored-by: Kabir Oberai <oberai.kabir@gmail.com>
2024-02-12 07:11:05 -08:00
Ryu
08c7c6b422 fix (#2790) 2024-02-11 11:54:52 -08:00
Stephen Celis
87b77a8bae Fix typo 2024-02-09 11:27:49 -08:00
Stephen Celis
71c82d7e83 Properly tag observable enums (#2786)
* Failing test and a simple solution.

* another failing test

* wip

* wip

* Fix

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-02-08 14:54:20 -08:00
Yasuhiro Hatta
4ae34cad32 Fix typo in the 1.7 migration guide (#2780) 2024-02-08 14:26:29 -08:00
Stephen Celis
d9a3cfb5fa Better document explicit id with scoped ForEach (#2784)
`ForEachStore` implicitly used `id: \.state.id` under the hood, so a
naive migration to `ForEach` might miss this detail. Let's be more
explicit in our documentation and migration guide to avoid this issue.

In the future it might be possible to address better in the library
itself, but for now the requirement for stores to be identifiable for
other forms of navigation means allowing for this.
2024-02-08 12:33:54 -08:00
Takehiro Kaneko
1e7942c9d1 fix typo in migration guide 1.6 (#2779) 2024-02-07 19:12:18 -08:00
Brandon Williams
7551bb8dc3 Fix navigationDestinationWrapper in docs. (#2765)
* Fix navigationDestinationWrapper in docs.

* Update TreeBasedNavigation.md

* Update TreeBasedNavigation.md

* wip

* update some presentation states

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-02-02 14:13:30 -08:00
Brandon Williams
412a896976 Update warning for uncached stores. (#2764)
* Update warning for uncached stores.

* update warnings

* Update tests'

* Update Store+Observation.swift

* Update ScopeCacheTests.swift

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-02-02 13:38:32 -08:00
hmhv
1f5985a359 remove invalid newlines (#2763) 2024-02-02 10:18:52 -08:00
Stephen Celis
2c3453cb79 Some cleanup (#2759)
* Some cleanup

  - `if/guard let x = x` -> `if/guard let x`
  - Remove unneeded `self` from a few demos
  - Fix up some presentation logic in TicTacToe

* Update Examples/TicTacToe/tic-tac-toe/Sources/LoginUIKit/LoginViewController.swift

* wip

* wip

* wip
2024-02-01 15:43:52 -08:00
mbrandonw
83ec5d3c5f Run swift-format 2024-01-31 18:39:19 +00:00
Brandon Williams
b1a0c88516 Fix visionOS and Xcode project warnings (#2752)
* Fix deprecation warnings for visionOS

* update project settings

* use negated visionOS check

* fix ttt alert dismissl

* formatting
2024-01-31 10:38:24 -08:00
peter bohac
94faadf363 Workaround for the build break on visionOS (#2746)
This is likely not the proper solution, but it does get my projects building.
2024-01-30 15:48:38 -08:00
Stephen Celis
63e29b311e Deprecate Reducer.onChange(of:removeDuplicates:) (#2744)
The `removeDuplicates` overload is just too tough on the compiler to
resolve, so we don't think it's worth shipping in the library in the
long run. SwiftUI's `View.onChange` doesn't have such an option, and
adding such a signature results in the same compiler issues. Let's stick
with the interface that most closely matches SwiftUI's and avoid
interfaces that are problematic for the compiler.
2024-01-30 10:43:04 -08:00
Stephen Celis
efc79f94a6 Move binding warning suppression to dynamic member lookup (#2740)
* Move binding warning suppression to dynamic member lookup

In TCA it is considered a bug to send an action to a child feature when
it is dismissed.

In SwiftUI, a focused text field binding will write to itself when the
view it is presented in is dismissed.

So if you derive a TCA binding to a text field in a dismissable child
feature, dismissing said feature will write to the text field and cause
a warning to be emitted.

To work around this, we set a task local, and are currently setting it
in debug-only methods that construct a binding from scratch. Creating
bindings from scratch unfortunately leads to issues with animations, so
we should avoid doing so.

Instead, we can leverage properties on store that bindings are derived
from and suppress the warnings from there.

* wip

* wip

* wip

* wip

* wip

* wip
2024-01-30 10:30:34 -08:00
Gleb Shevchenko
4d9f1713a0 Add missing var keyword (#2743) 2024-01-30 10:09:33 -08:00
Zvonimir Pavlović
4c6b617f88 Documentation: Fix a small typo in the 1.7 migration guide (#2738) 2024-01-29 12:58:32 -08:00
Shinichiro Oba
da028ac6a7 Fix Navigation tutorial (#2736)
* Add missing case

* `destination` property should be `nil`

* Change `store` property to `Bindable` to show alert

* Fix filename

* Fix indentation diffs
2024-01-29 09:03:47 -08:00
Cosmic Flamingo
9443607ab8 Fix @Presentation typo in Migrating to 1.7 docs (#2732) 2024-01-28 13:52:07 -08:00