* Apply existential any to protocol for Swift 6
* Update Package@swift-6.0.swift
* Update Package.swift
* Apply any to Macro.Type
* Apply any for the rest
* Applying the any keyword internally for typealias in a _KeyPath
* Undoing accidental syntax
---------
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
* 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
* bring back view store performance
* wip
* Allow chaining of store bindings
* wip
* Localize ignoring bindings to text field resignation/dismissal
* wip
* fix DiagnosticsError message (#2597)
* store collection
* wip
* wip
* update migration guide
* Add `@Presents` macro for observable presentation
While it would be nice for the `@PresentationState` property wrapper to
"just work" with TCA's upcoming observable tools, sadly that does not
seem to be the case. Adding observation directly to
`@PresentationState`, as we have done with the beta so far, can break
existing projects due to the additional observation. This primarily
manifests itself in projects that present navigation stacks, where the
`@PresentationState` observation can cause the navigation hierarchy to
recompute and trigger SwiftUI bugs.
The best we've come up with so far is introducing a brand new macro that
automatically wraps a property with `@PresentationState` _and_
instruments it with observation.
We're open to other ideas, and we do have future plans to eliminate the
need for a property wrapper or macro at all, but till then this offers a
non-breaking upgrade path!
* fixes
* Observe child store changes
* wip
* wip
* wip
* Fix typo in MigratingTo1.6.md (#2608)
* Rename bindingViewStore argument to store in MigratingTo1.6.md (#2611)
* wip
* Revert "wip"
This reverts commit f221ed0e1a.
* Add `@Presents` macro for observable presentation (#2604)
* Add `@Presents` macro for observable presentation
While it would be nice for the `@PresentationState` property wrapper to
"just work" with TCA's upcoming observable tools, sadly that does not
seem to be the case. Adding observation directly to
`@PresentationState`, as we have done with the beta so far, can break
existing projects due to the additional observation. This primarily
manifests itself in projects that present navigation stacks, where the
`@PresentationState` observation can cause the navigation hierarchy to
recompute and trigger SwiftUI bugs.
The best we've come up with so far is introducing a brand new macro that
automatically wraps a property with `@PresentationState` _and_
instruments it with observation.
We're open to other ideas, and we do have future plans to eliminate the
need for a property wrapper or macro at all, but till then this offers a
non-breaking upgrade path!
* wip
* Fix perception bindings (#2609)
* Fix runtime warning when binding accesses perceptible state.
* Fix runtime warning in SwiftUI bindings.
* wip
* wip
* wip
* wip
* wip
* wip
* wip
* wip
---------
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* wip
* wip
* fix
* wip
* wip
* wip
* Check observable state identity for presentation state.
* Add willSset/didSet to registrar types.
* clean up @Presents
* clean up
* fix
* Emit observation warnings in escaping contexts like `ForEach` and `sheet` (#2613)
* Fix perception warning in ForEach.
* fix
---------
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
* Introduce @ViewAction(for:) macro. (#2612)
* Add back @ViewAction macro.
* wip
* wip
* wip
* wip
* wip
* clean up
* wip
* wip
* fix migration guide'
* ViewActionable
* wip
* rename
* wip
* wip
---------
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* Introduce @BindableStore for bindings in pre-iOS 17 (#2610)
* Introduce @BindableStore.
* docs
* wip
* wip
* fixc
* wip
* wip
* wip
* wip
---------
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* re-record intergration logs
* wip
* wip
* localize invalid stores to store collection
* Deprecate closure-based `store.scope` operations (#2618)
These uncached operations can be problematic, especially when working
with observation, which often depends on the stable identity of stores.
* document
* Update warning message
* Performance Improvement: Skip perception checks when calling reducers. (#2622)
* Skip perception checks when calling reducers.
* inline withoutPerceptionChecking() for RELEASE
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
---------
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
* Don't show perception warnings in action closures. (#2614)
* Don't show perception warnings in action closures.
* wip
* wip
* wip
* clean up
* wip
---------
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* fix BindableStore + release
* Add docs
* Change associated type names of ViewActionSending (#2629)
* Fix some @ViewAction annoyances.
* wip
* wip
* wip
* wip
* wip
* wip
* fix
* wip
* fixed merge
* Add new view modifiers for observing alerts/dialogs (#2628)
* Add new view modifiers for observing alerts/dialogs
Instead of:
```swift
.alert(store: store.scope(state: \.$alert, action: \.alert))
```
You can now do:
```swift
.alert($store.scope(state: \.alert, action: \.alert))
```
This new modifier is powered by the same store binding scope operation
that can power `sheet(item:)`, etc., and is much lighter weight than the
previous view modifier, which spun up view stores and `WithViewStore`
views.
* wip
* wip
* wip
---------
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
* Fix uncached warning when using Store.ifLet (#2625)
* Fix uncached warning when using Store.ifLet
* wip
* wip
* wip
* wip
* wip
* wip
---------
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
* Resolve packages
* Updated scopes
* wip
* wip
* 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
* docs for observe function for uikit
* Add cancellation to observation'
* re-record integration test snapshots
* fixed some todos
* update test
* remove 5.9.2 checks
* wip
* improve docs
* update docs
* updates
* lots of fixes
* more docs
* remove unneeded file;
* wip
* wip
* wip
* update readme and getting started
* 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>
---------
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: hmhv <admin@hmhv.info>
Co-authored-by: Jimmy Prime <jimmylevelup@gmail.com>
Co-authored-by: Michael Pohl <15653162+Mika5652@users.noreply.github.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>
* Add `TestStore.bindings` for testing bindable view state
Because `@BindingViewState` is populated by a live store, there is no
way to easily test `ViewState` structs that use `@BindingViewState`.
This adds a `bindings` property on `TestStore` (`bindings(action:)`
method when using view actions) that makes it possible to write
assertions against view state.
* Update Tests/ComposableArchitectureTests/BindableStoreTests.swift
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
* Update Tests/ComposableArchitectureTests/BindableStoreTests.swift
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
* wip
---------
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
* Deprecate `Store.scope(state:)` for view store `observe`
Explicit scoping is most appropriate for transforming domains, which
almost always requires an action transform. In the rare case it doesn't,
we should prefer an explicit `{ $0 }`.
Scoping for the view has been deprecated for awhile for the `observe`
parameter when creating view stores, so let's lead folks that direction.
* wip
* wip
* Pass state to `SwitchStore.init` view builder
Rather than rely on many, many overloads of `SwitchStore.init` to
strictly accept only `CaseLet`s and an optional, final `Default` view,
let's introduce a single initializer without constraints that is passed
the current state whenever the case changes. This state can be switched
on and route to the appropriate view via `CaseLet`.
The pros:
* We get exhaustive switching at compile time.
* We get more flexibility in the view layer. Previously, any
customization needed to be pushed into the `CaseLet` builder, but
now `CaseLet` can freely apply view modifiers.
* We can deprecate and eventually remove the many, many initializer
overloads, and hopefully slim down binary size in the process, and
improve view builder compile times when dealing with `SwitchStore`.
We can also deprecate and eventually remove `Default`.
The cons:
* It's slightly more verbose and repetitive. You have a `SwitchStore`
and then a `switch` inside it with many `case`s with `CaseLet`s
inside them, and the `case .screen:` is followed by
`CaseLet(/State.screen, ...)`.
* One is free to extract the state's associated value(s) and use it to
render a view, but this view will be inert and will not re-render if
the value it depends on changes in the store. This can lead to some
surprises, but we can document against the pattern, and maybe in the
future we can use something like macros to prevent this from being
possible.
* You can still get things wrong if you're not careful: there's
nothing enforcing that the `case` you switch on is the same case you
send to `CaseLet`, so `case .screenA: CaseLet(/State.screenB, ...)`
is possible. While unlikely, it's still a copy-paste error in
waiting.
* wip
* wip
* wip
* Bump
* fix test
* clean up
* clean up
* clean up
* wip
---------
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
* Add `Effect.send`
With the `Effect<Action, Failure>` -> `Effect<Action>` migration,
`Effect.init(value:)` and `Effect.init(error:)` no longer make sense. We
will be retiring the latter some time in the future, so let's also get a
head start and rename the former to `Effect.send`.
For now it will call `Effect.init(value:)` under the hood, but in the
future we will want a non-Combine-driven way of running synchronous
effects.
* format fix
* wip
* fix
* wip
* wip
* Add `prepareDependencies` to `Store.init`:wq
* wip
* test and doc
* update TTT previews to use new trailing closure style"
* wip
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
* bump navigation
* bump swiftui-navigation
* Add SearchView preview
* make login sendable
* use button state builder
* format
* bump swift and platform version
* remove unused test clock
* Add quotes to scheme
* Avoid failure when setting test dependency values
It's currently possible to emit XCTest failures when testing reducers
that access dependency values that emit failure upon access, which
includes the calendar, locale, time zone, and URL session dependencies.
We may need a more holistic solution for folks that define these kinds
of dependencies outside the library, but this will make the
library-level failures a bit more lenient.
* wip
* a few more tests
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
* Remove unnecessary dependencies in SwiftUI-CaseStudies
* Remove unnecessary dependencies in other-CaseStudies
* Add MARK headers to every SwiftUI-CaseStudies