Commit Graph

1055 Commits

Author SHA1 Message Date
stephencelis
5e3f42070f Run swift-format 2024-08-30 17:30:02 +00:00
Stephen Celis
40c5fb4eb0 Address Reducer._printChanges() sendability (#3320)
* Address `Reducer._printChanges()` sendability

Because printing is done on a queue, both `State` and `Action` must be
sendable. While `State` is easy enough to make sendable, it might be a
pain to do so in a large, modularized application. Actions are not
always so easy, but are in simple cases.

Alternately, since this is a debugging affordance:

1. We could forego sendability since all we're doing is hitting it with
   a `Mirror` at the end of the day, and traffic the state/action along
   in a `nonisolated(unsafe)`.

2. We could ditch the queue...but that could affect the performance
   pretty negatively in some cases.

* Unchecked send the debug printing
2024-08-30 10:24:54 -07:00
stephencelis
39268ea604 Run swift-format 2024-08-30 16:28:09 +00:00
Stephen Celis
890d2ee96f Address effect cancellation sendability (#3326)
* Address effect cancellation sendability

* fix

* wip

* wip
2024-08-30 09:15:35 -07:00
Stephen Celis
63b078029a Address Effect.throttle sendability (#3325) 2024-08-30 09:14:08 -07:00
stephencelis
f02d8f6650 Run swift-format 2024-08-29 21:09:34 +00:00
Stephen Celis
051e5bd653 Address RootStore sendability warnings (#3321) 2024-08-29 13:47:45 -07:00
Stephen Celis
cad094a6b2 Sendable miscellany: effects, publishers, etc. (#3317)
* `@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

* wip

* wip

* wip

* wip

* wip

* Fix binding action sendability

* Address more binding action sendability

* more bindable action sendability

* more bindable action warnings

* fix

* Make `Effect.map` sendable

* Make `Effect.actions` sendable

Also moves it to the test target, since it's only really used there.

* Make `AnyPublisher.create` sendable

* Make `_SynthesizedConformance` sendable

* Avoid non-sendable captures of `self` in reducers

We can capture the sendable case path instead.

* Make `ViewStore.yield` sendable

* Address internal sendability warning

* fix

* Another small warning

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-08-29 13:47:32 -07:00
Stephen Celis
b8277a0244 Require sendable IDs in cancellation/reducers (#3318)
* Require sendable IDs in cancellation/reducers

Many of our APIs warn that we are passing hashable identifiers across
concurrency boundaries, so we should require that they're sendable.

* fix

* fix

* Fix
2024-08-29 13:46:48 -07:00
Stephen Celis
a7e2e73f83 Swift 6: Key path sendability (#3282)
* `@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

* wip

* wip

* wip

* wip

* wip

* Fix binding action sendability

* Address more binding action sendability

* more bindable action sendability

* more bindable action warnings

* fix

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-08-29 13:46:39 -07:00
MaraMincho
c1a5c59cc7 Fix typo and deprecated content in Performance.md (#3323)
* fix Typo

* delete deprecated content
2024-08-29 09:07:20 -07:00
Stephen Celis
ddf72666da Remove disfavored NSObject.observe overload (#3316)
Now that we've locked to Swift Navigation >=2.2, we get this method for free.
2024-08-27 18:08:40 -07:00
stephencelis
97b7ebb018 Run swift-format 2024-08-27 19:39:04 +00:00
Stephen Celis
0d8980f5bc Swift 6: Main actor isolated store view helpers (#3283)
* `@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

* wip

* wip

* wip

* wip

* wip

* wip

* Main actor logger

* wip

* wip

* wip

* fix

* fix

* fix

* fix compilation error

* wip

* wip

* bring back yield

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-08-27 12:31:43 -07:00
stephencelis
dfa29e0203 Run swift-format 2024-08-27 18:28:03 +00: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
Stephen Celis
f02fab5000 Allow an alert to present another alert (#3309)
* Allow an alert to present another alert

When we added support for vanilla SwiftUI modifiers, we lost the ability
to present one alert after another because `nil` writes to the alert
bindings unconditionally dismissed the feature, even if the feature was
freshly presented.

This fixes things by suppressing dismissal when the identity of a
presented item has changed.

Fix #3272.

* wip
2024-08-26 15:19:08 -07:00
Mason Kim
8821d58ea1 [DOCS] fix minor typo in FileStorageKey (#3305) 2024-08-26 08:47:38 -04:00
MaraMincho
07e5b3340a Edit Effect.swift annotations (#3299) 2024-08-23 08:41:45 -07:00
Hyunjin
7d6feb385a Add missing isActive parameter (#3296) 2024-08-22 16:14:57 -07:00
Brandon Williams
121b608069 Bring back 'observe' for non-UIKit targets. (#3295) 2024-08-22 09:35:20 -07:00
mbrandonw
b432441cbc Run swift-format 2024-08-15 17:43:58 +00:00
Brandon Williams
3a02c5e9fe Fix a bunch of DocC references. (#3287)
* Fix a bunch of DocC references.

* wip

* doc fix

* issue message fix

* swift-navigation 2.0.5
2024-08-15 13:02:49 -04:00
larryonoff
833792ec0f Fix: Crash when writing to user defaults in background thread (#3285)
* Fix: Crash when writing to user defaults in background thread

* Update tests

* Update Tests/ComposableArchitectureTests/AppStorageTests.swift

---------

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
2024-08-15 12:59:31 -04:00
Stephen Celis
2c17a936ef Fix ephemeral dismissal (#3286)
* Fix ephemeral dismissal

This regression was introduced to fix a UIKit warning, but it causes
state to not be `nil`'d out in SwiftUI. Luckily we caught it before a
release.

* wip
2024-08-15 09:53:00 -07:00
mbrandonw
27adbdc1e6 Run swift-format 2024-08-13 20:16:24 +00:00
Stephen Celis
dae1b9aafb Leverage UIKitNavigation (#3180)
* wip

* wip

* wip

* Update

* Remove duplicate UIAlertAction convenience initializers (#3188)

* wip

* wip

* wip

* fixes

* wip

* Add nav stack helper

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* watch fix

---------

Co-authored-by: Cosmic Flamingo <67525430+acosmicflamingo@users.noreply.github.com>
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-08-13 16:01:24 -04:00
stephencelis
b5c2a3d7c8 Run swift-format 2024-08-12 15:26:08 +00:00
Stephen Celis
e1f07facd9 Fix some warnings (#3279)
We have a few warnings, mostly in the test suite, that have cropped up
with deprecations and Xcode 16 strict concurrency, so let's address
them.
2024-08-12 08:24:30 -07:00
Stephen Celis
85415973b2 Fix typo 2024-08-05 09:59:28 -07:00
Malte Bünz
3f16c6c927 fix typo (#3268) 2024-08-02 09:31:29 -04:00
hmhv
4864af029d fix some fypo (#3267) 2024-08-02 09:31:06 -04:00
Stephen Celis
8343030d8d Shared: Update XCTFail to reportIssue (#3258) 2024-07-24 16:33:32 -07:00
Stephen Celis
5b6fbc50ba Reference IssueReporting symbols instead of XCTestDynamicOverlay (#3256)
While we should get both dependencies picked up from
swift-dependencies' exports, we've heard reports from folks that they're
getting linker/symbol errors here. We should update these uses
regardless!
2024-07-24 12:37:46 -07:00
Stephen Celis
37241eaf00 Add 1.12 migration guide (#3251)
* Add 1.12 migration guide

* Update MigratingTo1.12.md
2024-07-23 13:25:32 -07:00
aladdin
dc8638af06 docs: fix minor typo (#3252) 2024-07-23 07:19:55 -05:00
Yasuhiro Hatta
379e5f6302 Fix a typo in Tutorial (#3250) 2024-07-23 07:19:36 -05:00
stephencelis
d65f3c1b93 Run swift-format 2024-07-23 00:53:08 +00:00
Stephen Celis
3e830b575a Swift Testing support (#3229)
* wip

* wip

* Update Testing.md

* wip

* wip

* wip

* wip

* wip:

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* disable library evolution

* bump

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-07-22 17:52:04 -07:00
Oskar Ek
1b627dcdaa Add support for custom decoding/encoding to fileStorage (#3225)
* Add support for custom decoding/encoding to `fileStorage`

* Update FileStorageKey.swift

---------

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2024-07-22 08:41:01 -07:00
Brandon Williams
54eb417336 Make 'didSet' main actor. (#3206)
* Make 'didSet' main actor.

* tests for AppStorageKey

* wip

* tests

* clean up

* Update Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKey.swift

* Update Sources/ComposableArchitecture/SharedState/PersistenceKey/AppStorageKeyPathKey.swift

* try working around CI problem

* Added NB

* wip

* Update MigratingTo1.11.md

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-07-17 08:57:43 -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
aladdin
ce15c88f42 Fixed minor typos in Shared State documentation (#3237)
* docs: fix typo in Explicit shared state documentation

* docs: fix minor typo
2024-07-14 10:51:42 -04:00
Daichi Hayashi
a996565d22 Fix variable naming in StackBasedNavigation.md (#3210) 2024-07-12 14:59:03 -07:00
aladdin
d4757e3ce2 docs: fix typo in ifCaseLet documentation (#3216) 2024-07-02 09:21:35 -04:00
aladdin
4bbed368b0 docs: fix typo in Scope documentation (#3217) 2024-07-02 09:21:00 -04:00
larryonoff
b5828b231e Fix Shared publisher docs (#3201) 2024-06-24 15:22:23 -04:00
Brandon Williams
4f06955ffa Fix some Docc references. (#3200) 2024-06-24 15:10:22 -04:00
mbrandonw
15d2b12c84 Run swift-format 2024-06-21 19:23:42 +00:00