Commit Graph

965 Commits

Author SHA1 Message Date
Brandon Williams
0b1f78250c update RecordMeetingTests 2024-09-26 13:32:58 -04:00
stephencelis
4c0866420f Run swift-format 2024-09-18 21:39:29 +00:00
Brandon Williams
d631d48c16 Added migration guide for 1.15 (#3390)
* Added migration guide for 1.15

* wip
2024-09-17 08:12:10 -04:00
Stephen Celis
dcecad3fe2 Soft-deprecate Store.ifLet (#3382)
* Soft-deprecate `Store.ifLet`

We can prefer `observe` and `if let store.scope` now.

* wip

* wip

* Update MigratingTo1.7.md

* wip
2024-09-13 13:51:00 -07:00
stephencelis
d750b2a96c Run swift-format 2024-09-12 21:30:41 +00:00
Stephen Celis
f1af33763e Swift 6 updates (#3379)
* Swift 6 updates

  - Soft-deprecate `_SynthesizedConformance` now that Xcode 16 has fixed
    this bug.
    - Update docs accordingly.

  - Document Xcode 16 macro gotcha around custom build configuration
    names.

* wip
2024-09-12 14:11:05 -07:00
Brandon Williams
03ad0cce2d Bucket effect cancel IDs. (#3374)
* Bucket effect cancel IDs.

* wip

* wip

* remove cache reset

* wip

* wip

* wip
2024-09-12 13:48:39 -04:00
Stephen Celis
912192b619 Remove unused perception branches (#3376) 2024-09-12 08:10:06 -07:00
stephencelis
e0367371e6 Run swift-format 2024-09-10 15:20:01 +00:00
Mason Kim
71cfb1ef2d Existential any to protocol for Swift 6 (#3370)
* 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>
2024-09-10 08:01:24 -07:00
Stephen Celis
19efcf62ce Update MigrationGuides.md 2024-09-09 12:40:56 -07:00
mbrandonw
12280a2253 Run swift-format 2024-09-06 20:47:24 +00:00
Brandon Williams
7c6fb26700 Address @Shared sendability. (#3329)
* Address @Shared sendability.

* Undo UncheckedSendable<UserDefaults>.

* clean up

* wip

* drop AnySendable.

* wip

* Address `Effect.throttle` sendability (#3325)

* Address effect cancellation sendability (#3326)

* Address effect cancellation sendability

* fix

* wip

* wip

* Separate SendableDefaultSubscript from DefaultSubscript.

* fix test

* drop escaping

* switch on swift 6 language mode

* xcode 16

* update test

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-09-06 16:28:23 -04:00
mbrandonw
83ed123041 Run swift-format 2024-09-06 16:12:40 +00:00
Brandon Williams
2c8b1c0cad Fix potential deadlock in Shared (#3356)
* Fixed shared deadlock.

* Fix deadlock>

* wip

* wip

* Improve test.
2024-09-06 12:11:40 -04:00
이동영
105bc0f34a fix typo - encapsulates (#3354) 2024-09-05 20:53:18 -07:00
Mason Kim
71f8291ee7 Replace deprecated viewStore with store (#3341)
* [FIX] Replace deprecated viewStore with store

* [FIX] Replace deprecated viewStore with store in Article

* [TEST] Match the changed view store message with the test message

* [TEST] Match the changed view store message with the test message
2024-09-05 14:41:59 -07:00
Pat Brown
5660c58164 Remove subscriptions from CurrentValueRelay when cancelled (#2699)
* Remove subscription on cancel

* Slight refactor

* Small refactor

Subscription keeps strong reference of `CurrentValueRelay` similar to `CurrentValueSubject`

* Add subscription lifetime tests

* Use weak subscriptions and remove inside send

* Change relay implementation

* For loop better

* Move tests to StoreTests.swift

* A few more locks and a Shared test.

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-09-05 17:04:54 -04:00
mino
64cf3e8509 fix typo (#3349) 2024-09-05 09:39:20 -04:00
Stephen Celis
d5c2d7679f Warn if bindable store binding action isn't processed (#3347)
* Warn if bindable store binding action isn't processed

Looks like the warnings we emit when we detect `BindingReducer` is
missing are only applied to view stores, and were not ported over to the
newer observable store bindings.

This PR fixes that, though the main caveat is the messages can't seem to
point to any good context. These bindings are derived from dynamic
member lookup, which can't include source context like file/line.

* wip

* Add test
2024-09-04 18:37:41 -07:00
mino
3425878241 add comma (#3345) 2024-09-04 10:13:46 -04:00
Stephen Celis
bb34f69141 Require main actor isolation in store collection (#3333)
* Require main actor isolation in store collection

* `preconditionIsolated` is not available in iOS <14

* Update Sources/ComposableArchitecture/Observation/IdentifiedArray+Observation.swift
2024-09-04 07:13:30 -07:00
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