25 Commits

Author SHA1 Message Date
Brandon Williams
6574de2396 Make our use of SwiftSyntax APIs more resilient to precompiled SwiftSyntax (#3694)
* Make our use of SwiftSyntax APIs more resilient to precompiled SwiftSyntax

* support 600 and 601"

* wip

* Make store isolation tests more resillient.
2025-05-27 11:52:20 -07:00
John Szumski
a2944da218 Add a Foundation import to get access to String's capitalized (#3649) 2025-04-09 12:44:40 -07:00
Stephen Celis
08faf84fe3 MainActor Store Isolation (#3277)
* `@preconcurrency @MainActor` isolation of `Store`

* Remove unneeded `@MainActor`s

* Remove thread checking code

* Remove unneeded `@MainActor`s

* Swift 5.10 compatibility fixes

* wip

* More 5.10 fixes

* wip

* fixes

* wip

* wip

* up the timeout

* wip

* Fixes

* Remove mainActorASAP in favor of mainActorNow. (#3288)

* wip

* Run swift-format

* Update README.md

* Fix integration tests. (#3294)

* Fix integration tests.

* wip

* wip

* Run swift-format

* mainActorNow doesnt need escaping closure

* wip

* migration guide

* wip

* Update MigratingTo1.14.md

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
Co-authored-by: mbrandonw <mbrandonw@users.noreply.github.com>
2024-08-27 10:57:46 -07:00
stephencelis
a200f6ab38 Run swift-format 2024-07-16 23:39:54 +00:00
Stephen Celis
146218a595 Enum reducers: generate direct action cases for ephemeral state (#3240)
Currently, the following reducer enum:

```swift
@Reducer
enum Destination {
  case alert(AlertState<Never>)
}
```

Generates the following action:

```swift
@CasePathable
enum Action {
  case alert(AlertState<Never>.Action)
}
```

And this produces a warning in Case Paths 1.5 due to the nested `Never`
not being referenced directly.

This PR plucks the action type out and embeds it directly, instead:

```diff
-case alert(AlertState<Never>.Action)
+case alert(Never)
```

Which will allow us to better suppress warnings Swift emits for
uninhabited types.
2024-07-16 16:39:03 -07:00
Stephen Celis
bc8f27b1d0 Swift Language Support: Drop <5.9 (#3185)
* Swift Language Support: Drop <5.9

* wip

* wip

* wip

* wip

* wip
2024-06-19 07:40:15 -07:00
Stephen Celis
7ac630fe4c Support swift-syntax from 600.0.0-latest (#3160)
* Support swift-syntax from 600.0.0-latest

The Xcode 16 beta generates macro projects using these swift-syntax
snapshots. Luckily things seem to be backwards compatible, so we can
expand our supported range.

* wip
2024-06-12 16:02:02 -07:00
stephencelis
4680b5056d Run swift-format 2024-04-29 19:08:48 +00:00
Shoto Kobayashi
30334f971d Support nested enum reducer (#2813) (#2814)
* Support nested enum reducer (#2813)

* Support nested enum reducer without Macro (#2813)

* Support nested enum reducer without Macro (#2813)

* Support nested enum reducer with default initializer (#2813)

* Minor fixes (#2813)

* Minor fixes (#2813)

---------

Co-authored-by: kobayashi_shoto <kobayashi.shoto@colon.ne.jp>
2024-04-29 12:07:11 -07:00
Sam Rayner
4514a164f9 Add package access modifier support to @Reducer on enums (#2939) 2024-04-01 11:50:44 -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
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
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
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
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
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
stephencelis
5883f44f14 Run swift-format 2024-01-02 22:07:47 +00:00
George Scott
7b802ed4d6 No longer apply @CasePathable macro to State and Action enums if they have explicitly conformed to CasePathable. (#2685) 2024-01-02 13:52:01 -08:00
Stephen Celis
57e804f1cc Macro bonanza (#2553)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Silence test warnings

* wip

* wip

* wip

* update a bunch of docs

* wip

* wip

* fix

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Kill integration tests for now

* wip

* wip

* wip

* wip

* updating docs for @Reducer macro

* replaced more Reducer protocols with @Reducer

* Fixed some broken docc references

* wip

* Some @Reducer docs

* more docs

* convert some old styles to new style

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* bump

* update tutorials to use body

* update tutorials to use DML on destination state enum

* Add diagnostic

* wip

* updated a few more tests

* wip

* wip

* Add another gotcha

* wip

* wip

* wip

* fixes

* wip

* wip

* wip

* wip

* wip

* fix

* wip

* remove for now

* wip

* wip

* updated some docs

* migration guides

* more migration guide

* fix ci

* fix

* soft deprecate all apis using AnyCasePath

* wip

* Fix

* fix tests

* swift-format 509 compatibility

* wip

* wip

* Update Sources/ComposableArchitecture/Macros.swift

Co-authored-by: Mateusz Bąk <bakmatthew@icloud.com>

* wip

* wip

* update optional state case study

* remove initializer

* Don't use @State for BasicsView integration demo

* fix tests

* remove reduce diagnostics for now

* diagnose error not warning

* Update Sources/ComposableArchitecture/Macros.swift

Co-authored-by: Jesse Tipton <jesse@jessetipton.com>

* wip

* move integration tests to cron

* Revert "move integration tests to cron"

This reverts commit f9bdf2f04b.

* disable flakey tests on CI

* wip

* wip

* Revert "Revert "move integration tests to cron""

This reverts commit 66aafa7327.

* fix

* wip

* fix

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: Mateusz Bąk <bakmatthew@icloud.com>
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
Co-authored-by: Jesse Tipton <jesse@jessetipton.com>
2023-11-13 12:57:35 -08:00