Commit Graph

1027 Commits

Author SHA1 Message Date
Stephen Celis
899a68ce3c Runtime warn for nested observe calls (#2996)
* Runtime warning when we detect nested observe.

* finesse

* wip

* add some tests

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-04-17 15:31:31 -07:00
Brandon Williams
7e90901bac Make Effect.publisher eager (#2968)
* Make Effect.publisher eager.

* wip
2024-04-08 19:43:49 -07:00
Brandon Williams
67f23771ac Improve docs for stack-based navigation (#2967)
* Improve docs for stack based navigation.

* wip

* Improve docs for stack based navigation

* wip

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

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

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-04-05 12:41:32 -07:00
Sam Rayner
4514a164f9 Add package access modifier support to @Reducer on enums (#2939) 2024-04-01 11:50:44 -07:00
Takehiro Kaneko
2722a3466b Fix StackBasedNavigation.md (#2944) 2024-03-25 11:10:36 -07:00
Stephen Celis
aa4115145b Enum reducers: generate Never actions for non-features (#2943)
This adjusts the `@Reducer` macro to expand extra `case feature(Never)`
for actions that aren't TCA features.

This allows folks to scope down to stores of non-features for sheets,
etc.:

```swift
.sheet(
  item: $store.scope(state: \.meeting, action: \.meeting)
) { meetingStore in
  // Must use 'Store.withState' here for non-observed feature.
  MeetingView(meeting: meetingStore.withState(\.meeting))
}
```
2024-03-25 11:16:22 +09:00
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
stephencelis
e34b65e6e9 Run swift-format 2024-03-12 01:28:50 +00:00
Stephen Celis
c383ce6e94 Fix SwiftSyntax 510 / Xcode 15.3 warnings (#2909)
* Fix SwiftSyntax 510 / Xcode 15.3 warnings

* fix

* wip

* wip
2024-03-11 18:27:52 -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
Brandon Williams
115fe5af41 Update SwiftSyntax. (#2884)
* Update SwiftSyntax.

* wip

* fix

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-03-04 22:18:31 -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
stephencelis
3346f12001 Run swift-format 2024-02-26 21:03:34 +00:00
Stephen Celis
656fa9ce2e Support #if branching in enum reducers/state (#2800)
* Support `#if` branching in enum reducers/state

This adds support for `#if` branching across enum cases in observable
state and reducer enums.

* wip

* add tests

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-02-26 13:02:33 -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
mbrandonw
a8ee97414e Run swift-format 2024-02-19 18:30:19 +00:00
Brandon Williams
856f9b8d82 More fixes for @Reducer macro. (#2834)
* More fixes for @Reducer macro.

* wip
2024-02-19 10:29:28 -08:00
Brandon Williams
ad7223a69c Add more namespacing. 2024-02-19 08:35:50 -08:00
stefancodinglands
09aab16626 Added missing namespace for Scope when in ReducerMacro (#2832)
* Added missing namespace to Scope when generating Reducer with macro

* Update ReducerMacroTests.swift
2024-02-19 08:34:39 -08:00
Brandon Williams
da1cd105cc Fix macro compiler bug in release mode. (#2827)
* Fix macro compiler bug in release mode.

* few more tests
2024-02-18 17:05:40 -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
Shai Mishali
5394686397 [macro] Make _$id and _$willModify() public (#2789) 2024-02-12 12:27:26 -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