Commit Graph

712 Commits

Author SHA1 Message Date
Paul
8d54102cce Add TestStoreOf typealias (#2277)
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2023-07-17 14:54:11 -07:00
Timur Guliamov
945ab055a8 Fixed tree-based navigation: dismiss action is not sent when navigating back (#2210)
* fixed dismiss action sending when navigating back

* Revert "fixed dismiss action sending when navigating back"

This reverts commit 52f7340406.

* added integration ui test

* fixed id for presentation with `isPresented` parameter

* fixed integration tests
2023-07-17 14:36:13 -07:00
stephencelis
b6d22ef222 Run swift-format 2023-07-16 22:31:04 +00:00
Stephen Celis
1595003d95 Clean up test store deprecation messages (#2294)
* Clean up test store deprecation messages

* wip

* wip
2023-07-16 15:27:28 -07:00
Stephen Celis
faadf6a780 Add named closure arguments (#2295)
* Add named closure arguments

Better for documentation and auto-fill.

* wip
2023-07-16 15:27:02 -07:00
Ben Lings
c113ba4f22 Fix for infinite loop when combining Stack and Tree navigation (#2289)
* Fix for https://github.com/pointfreeco/swift-composable-architecture/issues/2288

* Add navigation destination to NavigationStackTestCase

* Add UI test case

* clean up

---------

Co-authored-by: Ben Lings <ben.lings@bp.com>
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2023-07-16 15:24:03 -07:00
Stephen Celis
4feea763fd Deprecate TestStore scoping (#2292) 2023-07-16 15:22:25 -07:00
stephencelis
05cc9bd29e Run swift-format 2023-07-14 20:19:39 +00:00
Harshil Shah
0602a68941 Added the ability to specify an animation or transaction with Store.send (#2241)
* Added an internal initialiser for ViewStoreTask

This is done to allow returning a ViewStoreTask from Store.send(_:animation:)

* Added Store.send methods that allow specifying an animation or transaction

* Added StoreTask

* Made StoreTask.rawValue internal

This is to allow ViewStore to access the rawValue as it does currently

* Made ViewStoreTask a deprecated typealias of StoreTask

* Store.send methods now return a StoreTask instead of a ViewStoreTask

* Update ViewStore.swift

* Update Sources/ComposableArchitecture/Store.swift

---------

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2023-07-14 13:10:49 -07:00
Stephen Celis
c28311e351 Fix macOS dismissal (#2284)
Fixes #2182.

The `id` used for comparison appears to sometimes be `nil`, for example
on macOS when drilling out of a `navigationDestination`. This PR adds a
little nuance to the dismissal logic of `presentationModifier`:

  * It explicitly checks that something is presented
  * It always sends `dismiss` if the cached `id` was `nil`

We should maybe have some integration tests for macOS for this...
2023-07-14 10:31:18 -07:00
Stephen Celis
8455c5179f Fix cancellation ID existentials in iOS 14 (#2283)
* Fix cancellation ID existentials in iOS 14

Fixes #2233.

On iOS 14, `DismissEffect` is broken because effect cancellation uses
`AnyHashable` throughout, which can lead to nested
`AnyHashable(AnyHashable(...))` IDs, which can hash differently
depending on the level of nesting. By preserving the hashable ID up to
being stored in the internal cancellation token type, we can avoid a
hash lookup failure that prevents a dismissal from happening.

* wip
2023-07-14 10:26:03 -07:00
Stephen Celis
c0a9e1c3bd Make ViewStoreTask.cancel synchronous (#2282)
Currently, `ViewStoreTask.cancel` works like `TestStoreTask`, where
it'll cancel _and_ await cancellation to complete. This is needlessly
limiting, and probably not what you want when interacting with
cancellation.
2023-07-14 10:22:30 -07:00
Stephen Celis
d69b5db82c Fix view state binding equatability (#2255)
* Fix view state binding equatability

* wip

* wip

* wip

* wip

* wip
2023-07-12 16:25:55 -07:00
Stephen Celis
663a45f39d Fix WithViewStore initializer ambiguity (#2278)
* Test to show when ambiguous init of ViewStore happens

* Fix #2275

* wip

---------

Co-authored-by: Johan Kool <johankool@users.noreply.github.com>
2023-07-12 14:23:39 -07:00
Jesse Tipton
d2d3c149cc Add BindingViewStore initializers for ViewStore (#2274) 2023-07-12 14:09:40 -07:00
Brandon Williams
55029c286d Fix delegate equatability in tutorial. (#2280) 2023-07-12 19:07:07 +00:00
Jesse Tipton
745bc10361 Fix commas that should be periods in docs (#2267) 2023-07-07 22:36:50 -07:00
Jesse Tipton
af16494b9e Fix ViewStore.init that should be ViewState.init in Bindings.md (#2261) 2023-07-05 14:04:44 -07:00
Jesse Tipton
1d3c42aa39 Fix WithViewStore argument label in Bindings.md (#2256) 2023-07-04 15:38:22 -07:00
Martin List
93031bb1cc Update code examples of Tree-based navigation documentation (#2252) 2023-07-01 07:59:37 -07:00
bharath2020
d74930b494 Fixed BindingAction.set(keyPath:value:) causes equality test on value to fail (#2248)
* Fixed BindingAction.set(keyPath:value:) causes equality test on value to fail

* clean up

---------

Co-authored-by: Bharath Booshan <bbooshan@atlassian.com>
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2023-06-30 11:20:15 -04:00
Stephen Celis
f2de7e7f66 Weaken BindingViewStore's dynamic member lookup (#2243)
Right now it requires a writably, equatable property, but that prevents
accessing `let` constants on state.
2023-06-29 08:30:26 -07:00
Yoshinori Imajo
32f9659d8f Fix codes in DocC (#2242)
* Update Performance.md

* Update Performance.md
2023-06-29 07:09:55 -07:00
Stephen Celis
89f80fe240 Bump swiftui-navigation (#2239)
* Bump swiftui-navigation

* fix deprecation warning

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2023-06-28 12:30:52 -07:00
stephencelis
93c878441b Run swift-format 2023-06-28 18:57:06 +00:00
Stephen Celis
43e28a57f3 Update docs for next release (#2238)
* Update docs for next release

* wip

* fix deprecations

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2023-06-28 11:34:01 -07:00
Stephen Celis
b2f3ba5cdb Add EffectOf (#2237)
Joins `ReducerOf` and `StoreOf` for simplifying some call sites.
2023-06-28 11:06:22 -07:00
Stephen Celis
b6efb27f69 Test store changes (#2236)
* wip

* Minor test store improvements
2023-06-28 11:06:06 -07:00
Stephen Celis
bf6b735b77 Add Reducer.onChange (#2226)
* Add `Reducer.onChange`

* Inlining

* wip
2023-06-28 10:07:03 -07:00
stephencelis
461ee90b74 Run swift-format 2023-06-28 16:36:43 +00:00
Stephen Celis
daf41b3370 Add public Store.send and Store.withValue (#2222) 2023-06-28 09:32:32 -07:00
Stephen Celis
95d2bc701b Better Bindings Revisited (#2215)
* Simpler bindable view state

* wip

* wip

* wip

* wip

* wip

* wip

* simplify

* wip

* wip

* wip

* wip

* wip

* wip

* wip
2023-06-28 09:31:12 -07:00
Brandon Williams
b9defab12c Don't show 'expected state to change' error in non-exhaustive test stores. (#2227)
* Don't show 'expected state to change' error in non-exhaustive test stores.

* wip
2023-06-22 15:26:26 -04:00
Brandon Williams
522c0651c8 Add note to depend on library in first tutorial step. (#2225)
* Add note to depend on library in first tutorial step.

* wip
2023-06-22 11:42:40 -04:00
Daniel Peter
bd23264956 Avoid force-unwrapping cached value in ForEachStore (#1036)
* Avoid force-unwrapping cached value in ForEachStore

* ForEach closure based caching approach

* Uses unnamed closure parameters

* Define custom remove duplicates to only reevaluate when IDs change

* fix

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2023-06-21 17:36:00 -07:00
Stephen Celis
35c75b1721 Deprecate Effect.cancel(ids:) (#2221)
This API has been more problematic than not, especially when folks
accidentally type `.cancel(id:)` and pass a hashable array when they
expect to be passing multiple tokens along to each cancel. Let's avoid
the confusion by deprecating the functionality.

Cancelling multiple tokens at once should also be less common these days
now that navigation tools bakes cancellation into dismissal.
2023-06-21 12:33:16 -07:00
Stephen Celis
438a795511 Fix a few Swift 6 errors (#2213) 2023-06-20 10:24:43 -07:00
ccxla
c738afb57b Update tutorial for TestStore.receive() requirements (#2183)
* Add Action Equatable conformance to interactive tutorial code

* Add Equatable conformance note to YourFirstPresentation tutorial

* Small update

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2023-06-19 09:26:55 -04:00
Oron Ben Zvi
60cbe145d6 Fix Cannot find type 'UUID' in scope (#2173) 2023-06-19 09:24:20 -04:00
Alex Hunsley
42b01f284e Fix some swiftdoc and small tidy (#2204)
* Remove double word and a little grammar gardening

* Fix some swiftdoc parameters

* Tidy params to '_' in DataManager
2023-06-16 07:49:38 -07:00
Tomu Obata
861283f023 Fix Swift version comment for typealias (#2209) 2023-06-16 07:47:30 -07:00
ccxla
cffab60899 Fix shorthand argument name in 02-03-03-code-0010.swift (#2184) 2023-06-14 13:11:04 -07:00
ccxla
6d3096c8d6 Add missing actions in NavigationStacks tutorial sample code (#2185) 2023-06-14 13:10:26 -07:00
Brandon Williams
3fa456c046 Remove inlineable attributes to work around Swift compiler bug. (#2201)
* Remove inlineable attributes to work around Swift compiler bug.

* clean up

* wip
2023-06-14 12:53:45 -07:00
Thomas Tosoni
4f823d9341 Fix Typo in Navigation Documentation (#2190) 2023-06-11 10:00:43 -07:00
Dzianis Fileyeu
87acfff00b [fix] Typo in StackBasedNavigation.md (#2188) 2023-06-08 13:18:22 -07:00
ccxla
ced0be916e Fix noun instead of verb typo in MultipleDestinations tutorial (#2181) 2023-06-06 08:47:28 -07:00
Minseok Kang
830b60a433 fix 'Effect.run' deprecasted message (#2180) 2023-06-06 08:47:12 -07:00
Oron Ben Zvi
b4bebae8dd Fix state/action typo in NavigationStack tutorial (#2177) 2023-06-05 10:09:31 -04:00
Oron Ben Zvi
f6b71e1210 Fix a typo in NavigationStack tutorial (#2176) 2023-06-05 10:09:21 -04:00