Commit Graph

181 Commits

Author SHA1 Message Date
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
Stephen Celis
19efcf62ce Update MigrationGuides.md 2024-09-09 12:40:56 -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
mino
3425878241 add comma (#3345) 2024-09-04 10:13:46 -04: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
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
Hyunjin
7d6feb385a Add missing isActive parameter (#3296) 2024-08-22 16:14:57 -07: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
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
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
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
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
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
Brandon Williams
4f06955ffa Fix some Docc references. (#3200) 2024-06-24 15:10:22 -04:00
Stephen Celis
1f952d8c69 Update MigratingTo1.11.md 2024-06-19 13:02:55 -07:00
Stephen Celis
31a7045b49 Disfavor shared optional dynamic member lookup (#3170)
* Disfavor shared optional dynamic member lookup

This makes the default work as expected, avoiding the issue brought up
in #3169.

Technically this breaks the following invocation:

```swift
if let wrapped = $shared.optional { /* ... */ }
```

And limits the warning to:

```swift
func share<T>(_: Shared<T>?) {}
share($shared.optional)
```

We consider this lookup to be a bug, though, which is already deprecated
in 1.11.0.

Since we encourage folks to migrate by one minor version at a time, we
should only merge this when we plan on releasing 1.12.0.

* wip
2024-06-18 16:01:46 -07:00
larryonoff
995888141b Update MigratingTo1.11.md (#3184)
Remove unnecessary await
2024-06-18 13:37:38 -04:00
Brandon Williams
ba82946434 Make withLock main actor. (#3178)
* Make withLock main actor.

* Correct backwards compat article.
2024-06-18 12:17:54 -04:00
Stephen Celis
889c27bc0f Note Swift bug in documentation (#3157)
It'd be good to have a place to point folks to when encountering the
issue.
2024-06-12 15:14:44 -07:00
David Furman
8631b5fbcc SyncUp tutorial fixes (#3139)
* Fixes for TestingSyncUpForm

* Typo, heirarchy -> hierarchy

* Typo: recursive -> recursively

* Typo: comes -> combines

* Further fixes for TestingSyncUpForm

* Typo: is -> to be

* Typo: add -> we added

* Typo: 3 -> 2

* Adding a note to avoid confusion

* Add more detail to step

* Remove stray whitespace causing a diff to incorrectly display

* Removed step documentation for unused code

* Typo: apart -> a part

* Fix App.Path Equatable conformance

* App -> AppReducer to avoid conflict with SwiftUI.App

* Fix code file link

* Typo: reducer -> reducers

* Add missing mock

* AppReducer -> AppFeature

* Standardize tutorial on `@Shared(.syncUps)`

* Fix mainactor placement

* Fix transcript param not compiling

* Add durationPerAttendee to be usable

* Add a minimal dismiss override to fit with the docs

* Fix commenting out of Tagged discussion

* Fix commenting out of TestingSyncUpDetail discussion

* Undo a whitespace change

* Partial revert of TestingSyncUpForm-02-code-0004.swift

* Undo unintentionally committed code

* Revert "Add missing mock"

This reverts commit 9672ecbd20.

* Revert "Fixes for TestingSyncUpForm"

This reverts commit 5bece14c2a.

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-06-07 11:35:19 -07:00
Stephen Celis
fea248b501 Fix unclosed DocC code block 2024-06-06 18:01:12 -07:00
Stephen Celis
52ee2bb5c7 Clean up DocC and link to new migration guide in README (#3153)
* Clean up DocC and link to new migration guide in README

* wip
2024-06-06 16:26:42 -07:00
Brandon Williams
1eeca17b21 Make Shared.wrappedValue setter unavailable from async and introduce Shared.withLock (#3136)
* Add withValue to Shared, deprecate direct mutation.

* updates

* wip

* wip

* wip

* wip

* Available noasync

* withLock

* clean up

* wip

* wip

* Update SyncUpsListTests.swift

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-06-06 15:16:34 -07:00
David Furman
63a0795524 Simple SyncUp tutorial fixes (#3141)
* Typo, heirarchy -> hierarchy

* Typo: recursive -> recursively

* Typo: comes -> combines

* Typo: is -> to be

* Typo: add -> we added

* Typo: 3 -> 2

* Adding a note to avoid confusion

* Add more detail to step

* Remove stray whitespace causing a diff to incorrectly display

* Removed step documentation for unused code

* Typo: apart -> a part

* Typo: reducer -> reducers

* Add missing mock

* Fix mainactor placement

* Fix transcript param not compiling

* Add durationPerAttendee to be usable

* Undo a whitespace change

* Delete commented-out code

* Update Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/06-SyncUpDetail/EditingAndDeletingSyncUp.tutorial

* Update Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/05-PersistingSyncUps/PersistingSyncUps.tutorial

* Update Sources/ComposableArchitecture/Documentation.docc/Tutorials/BuildingSyncUps/07-SyncUpDetailNavigation/MeetingNavigation-01-code-0003.swift

---------

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2024-06-05 09:38:30 -07:00
Brandon Williams
af38644542 Re-order FAQ and clean up links. 2024-06-04 09:13:34 -05:00
Brandon Williams
7cbde3b07f FAQ cleanup. 2024-06-03 21:52:15 -05:00
Brandon Williams
d2d79f37cf FAQ (#3138)
* Misconceptions

* wip

* wip

* wip

* Update FAQ.md

* Update FAQ.md

* wip

* Update FAQ.md

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-06-03 21:15:40 -05:00
woxtu
146aa87f60 Fix typos (#3119) 2024-05-28 07:47:30 -07:00
Stephen Celis
e37353ec33 Add ifLet SwiftUI integration warning (#3089)
* Add `ifLet` SwiftUI integration warning

We recently added a warning when we detect that `forEach` wasn't
integrated with a reducer when path elements are pushed or popped from
the stack, and I realized that we could do similarly for `ifLet` during
dismissal.

* docc
2024-05-14 16:29:47 -07:00
Stephen Celis
57526d83aa Add ViewStore.binding migration examples to guide (#3087)
* Add `ViewStore.binding` migration examples to guide

The 1.7 guide doesn't have examples of more complex bindings, so let's
add one.

* fix

* wip

* fix
2024-05-14 10:57:03 -07:00
Brandon Williams
0385ac4eb9 Fix a bunch of references. (#3085) 2024-05-14 09:37:45 -07:00
Stephen Celis
eda999e483 Have store.finish() assert no received actions (#3054)
* Have `store.finish()` assert no received actions

`store.finish()` should do much of the same work as `store.deinit`, but
asynchronously with a timeout. This PR updates things so that folks with
long-living test stores (_e.g._ held onto by the test case) have the
ability to assert that there are no unreceived actions.

* test

* Add docs about long-living stores
2024-05-07 12:16:07 -07:00
Stephen Celis
c0a694451f Add a note about nested enum reducers in docs (#3050)
* Add a note about nested enum reducers in docs

* wip
2024-05-06 13:02:51 -07:00
Stephen Celis
402346e297 Add @CasePathable @dynamicMemberLookup to 1.4 migration guide (#3043)
* Add `@CasePathable @dynamicMemberLookup` to 1.4 migration guide

This came up recently and I was hoping to point to a part of the
migration guide that explained it, but it didn't exist.

* wip

* wip
2024-05-02 14:51:01 -07:00
larryonoff
57cfcb6b92 Fix type in Reducers.md (#3034) 2024-04-30 09:25:24 -07:00
Stephen Celis
fb532be3de Organize DocC (#3022) 2024-04-29 09:46:46 -07:00
Brandon Williams
48a43b1b3c Improve docs for 'Navigating to non-reducer features' 2024-04-29 09:13:34 -07:00
Stephen Celis
e121b91fb4 Shared State (#2858)
* Shared State

* fix compiler errors in 5.7

* fixes and tests

* fix

* fix

* wip

* longer sleeps

* fix test

* fix tests

* Clean up some typos in SharingState.md (#2860)

* public inits

* wip

* wip

* add test for shared state and onChange

* Case study for sandboxing shared state

* tweaks to case study

* wip

* add tests to sandboxing case study

* rename files

* wip

* simplify sync up tests

* wip

* fix

* wip

* fix $shared.publisher non-determinism and write test that currently fails but ideally would not.

* more docs and a test for autoclosure

* more docs

* wip

* update todo with persistence

* wip

* wip

* support default `nil` optionals in `@Shared`

* Introduce unavailable overload for better diagnostics

* Fix autocomplete from `@Shared(.`

* Revert "Fix autocomplete from `@Shared(.`"

This reverts commit fd1798f9f5.

* Fix defaults

* wip

* Give persistence keys a synchronous update interface (#2880)

* Don't use async sequence for persistence

* wip

* wip

* wip

* Update Sources/ComposableArchitecture/SharedState/PersistenceKey.swift

Co-authored-by: Hal Lee <hal@lee.me>

---------

Co-authored-by: Hal Lee <hal@lee.me>

* Revert sharing in Todos for now

* wip

* wip

* Pass initial shared value to strategy / register app storage (#2904)

* Pass initial shared value to strategy / register app storage

This PR modifies the `PersistenceKey` protocol so that its `load` and
`subscribe` endpoints are handed the initial value and must return a
non-optional value. By feeding this value in, we can ensure that
`.appStorage` declared in a feature is registered outside the feature.

* wip

* wip

* wip

* wip

* wip

* wip

* swift-format

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/SharingState.md

Co-authored-by: Pyry Jahkola <pyry.jahkola@iki.fi>

* non-exhaustive fix

* wip

* remove decodable for now

* Fix app storage registration with `nil` values

* fix

* wip

* tutorial

* fixes

* lots of tutorial fixes

* more tutorial fixes

* more tutorial fixes

* more tutorial fixes

* tutorial fixes

* wip

* re-arrange test

* Remove store shared preview quarantine

* Add support for \.defaultInMemoryStorage (#2965)

* fix

* Added Privacy Manifest file (#2930)

* Added Privacy Manifest file

* Update Package@swift-5.9.swift

---------

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>

* remove warning overloads

* write default instead of register

this is more consistent with SwiftUI's property wrapper, and causes less
strangeness when multiple repeat properties have different defaults

* move privacy manifest

* wip

* wip

* EphemeralFileStorage -> InMemoryFileStorage

* documented gotcha

* add test

* Shared state beta task snaps (#2976)

* wip

* wip

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>

* wip

* Use notification center instead of KVO for user defaults observation. (#2978)

* Use notification center instead of KVO for user defaults observation.

* wip

* wip

* Introduce @SharedReader (#2979)

* wip

* wip

* wip

* wip

* wip

* wip

* Introduce @SharedReader.

* wip

* wip

* sendable

* wip

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Make Shared.Subscription.cancel public (#2983)

* added failing test

* Add convenience initializers

* Save to file storage when app is about to be terminated (#2992)

* Save file storage on termination too.

* wip

* Shared change tracking enhancements (#2989)

* wip

* wip

* wip

* wip

* Add unavailable conformance

* wip

* wip

* wip

* Don't need to check for previews.

* Add default providing persistence key (#2980)

* wip - default providing key

* warn on default access

* Revert "warn on default access"

This reverts commit 38706450bef44a50f94afeaddbc4628e383b52b3.

* wip

* wip

* wip - tests

* wip - reader key

* fix docs

* A few changes.

* A few more changes.

* docs

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>

* Fix optional shared defaults.

* undo last commit but keep test

* wip

* Better shared state change tracking and `TestStore` interactions (#2995)

* A fix for shared assertion.

* fixes

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>

* docs

* docs

* wip

* Throttle for 1 second.

* fix typo in examples: `let` -> `var` (#2999)

Co-authored-by: Andreas Tielmann <atielmann@deloitte.de>

* wip

* wip

* fix observing projection

* Ping `Shared.publisher` in `willSet` so prev/next values observable

* wip

* wip

* remove sandbox demo

* wip

* wip

* recover inlining

* wip

* wip

* fix docc

* wip

* wip

* re-entrant test

* wip

* Don’t assume CastableLookup (#3011)

* Don’t assume CastableLookup

If the observed value in `UserDefaults` is a `RawRepresentable` type, simply casting to `Value` might fail because the raw representing type could be different from `Value`.  Instead of querying `UserDefaults` directly here, we should call `loadValue()` which will do the right thing for raw representable types (esp. try to call `Value.init(rawValue:)` with the value obtained from `UserDefaults`).

* Add test

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Make `FileStorage` more opaque (#3010)

* Make `FileStorage` more opaque

Previously, we had a public protocol and conformances, but we don't
expect anyone to conform outside the library, so instead let's hide
things in a more opaque struct.

The downside of this PR is that it's a breaking API change pretty late
in the game:

```diff
-$0.defaultFileStorage = InMemoryFileStorage()
+$0.defaultFileStorage = .inMemory
```

We could add public deprecated functions that emulate the old
initializers if we think it's worth it...

* wip

* wip

* wip

* wip

* wip

* wip

* fix for 5.7.1

* sync ups clean up

* more docs

* more tests

* shared testing tiups

* wip

* wip

* Fix typo. (#3014)

* more shared state docs

* relax version of swift-dependencies.

* dep change

* fix == and hash on Shared and more tests

* revert == changes

* add test

* Remove hashable conformance from shared

* remove conditional encodability from shared

* wip

* remove syncups tutorial

* wip

* fix

* fix file storage deletion resubscription

* wip

* wip

* wip

* wip

* wip

* fix

* eager throttle

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: NF <4764329+NFulkerson@users.noreply.github.com>
Co-authored-by: Hal Lee <hal@lee.me>
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
Co-authored-by: Pyry Jahkola <pyry.jahkola@iki.fi>
Co-authored-by: Daniel Lyons <72824209+DandyLyons@users.noreply.github.com>
Co-authored-by: Hilton Campbell <github@crosswaterbridge.com>
Co-authored-by: Luke Redpath <lredpath@community.com>
Co-authored-by: andtie <andreas.tielmann@gmail.com>
Co-authored-by: Andreas Tielmann <atielmann@deloitte.de>
Co-authored-by: Alex Kovács <alex@kobachi.jp>
Co-authored-by: Zev Eisenberg <zev@zeveisenberg.com>
2024-04-28 17:53:12 -07:00
David Furman
83b2c1b4c9 Tutorial fixes and updates (#3003)
* Find-and-replace: Add `@testable import CounterApp`

* Typo Fix: "you" -> "your"

* Typo fix: It's -> its

* Typo: `CounterFeature` -> `ContactsFeature`

* Find-and-replace: Switch from deprecated `.navigationBarTitle()` to `navigationTitle()`

* Typo: `using` -> `uses`

* Add `@testable import CounterApp` to the Composing Feature section

* Typo: `closet` -> `closest`

* Remove mention of now-unused forward slash syntax for case paths
2024-04-19 16:52:54 -07:00
Brandon Williams
67f23771ac Improve docs for stack-based navigation (#2967)
* Improve docs for stack based navigation.

* wip

* Improve docs for stack based navigation

* wip

* Update Sources/ComposableArchitecture/Documentation.docc/Articles/StackBasedNavigation.md

Co-authored-by: Stephen Celis <stephen@stephencelis.com>

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-04-05 12:41:32 -07:00
Takehiro Kaneko
2722a3466b Fix StackBasedNavigation.md (#2944) 2024-03-25 11:10:36 -07:00
Stephen Celis
5ab136f5dc Test store tutorial/documentation fixes (#2912)
* Test store tutorial/documentation fixes

* wip
2024-03-11 19:03:17 -07:00
Daiki Matsudate
8f0b35056b Add StackActionOf (#2906)
Signed-off-by: Daiki Matsudate <d.matsudate@gmail.com>
2024-03-11 14:03:26 -07:00
Takehiro Kaneko
a0acf426f7 Fix typo in TreeBasedNavigation.md (#2898) 2024-03-07 11:11:07 -08:00
Stephen Celis
53af95ae3d Fix type-checking regression: remove dynamic case lookup on BindableAction (#2886) 2024-03-04 17:58:30 -08:00
Takehiro Kaneko
dfe8e576b7 Fixed document (#2882) 2024-03-03 09:13:06 -08:00
Takehiro Kaneko
687e27795a Fixed a small typo on migration guide 1.9 (#2876) 2024-02-29 20:41:49 -08:00