Commit Graph

1039 Commits

Author SHA1 Message Date
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
Rui Peres
aa56697b63 state is not defined (#3159) 2024-06-11 17:11:16 -04: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
7461262608 Allow values to be returned from withLock (#3154) 2024-06-07 07:43:52 -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
Stephen Celis
9670a86b42 Clean up SyncUps tutorial with mock value (#3148) 2024-06-05 13:14:22 -07:00
stephencelis
3caaba502b Run swift-format 2024-06-05 16:44:37 +00:00
Brandon Williams
4167b3c0ce Add a SharedReader.constant helper. (#3127) 2024-06-05 09:43:19 -07:00
Stephen Celis
b529ff52d0 Deprecate Shared's optional dynamic member lookup overload (#3145)
* Deprecate `Shared`'s optional dynamic member lookup overload

Currently, `Shared`'s dynamic member lookup is overloaded for
convenience:

```swift
$shared                // Shared<Root>
$shared.value          // Shared<Value>
$shared.optionalValue  // Shared<Value>?
```

Unfortunately, this is also perhaps surprising, and goes against the
grain when folks might expect to be handed a `Shared<Value?>`.

Also, there are times when you have a `Shared<Value?>` already, and you
want to unwrap it. Dynamic member lookup doesn't help there (unless you
know you can call `$shared[dynamicMember: \.self]`), and so you need a
totally different operation to handle it:

```swift
if let unwrappedShared = Shared($optional) {
  // Do something with 'Shared<Value>'
}
```

So let's avoid this confusion in the future and focus on a single API
for unwrapping shared values, which is the failable initializer that
mirrors an API on `Binding`.

* wip

* Update SharedReader.swift

* Update Shared.swift

* Update SharedReader.swift
2024-06-05 09:38:41 -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
1d295222f5 Fix tuist builds. (#3140)
* Fix tuist builds.

* wip
2024-06-05 10:31:34 -05:00
Brandon Williams
af38644542 Re-order FAQ and clean up links. 2024-06-04 09:13:34 -05:00
Brandon Williams
1c133ced26 Add important note about delegate actions. (#3135) 2024-06-04 08:37:21 -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
fb5159e888 Add syntax highlighting (#3123) 2024-05-30 08:07:53 -06:00
woxtu
146aa87f60 Fix typos (#3119) 2024-05-28 07:47:30 -07:00
btr-better
7d54fdbc5e Fixed typos in the Building SyncUps tutorial (#3107)
Co-authored-by: B Tirumala Rao <btr@betterapps.studio>
2024-05-27 09:28:15 -07:00
아리
44a8f96276 chore: typo correction (#3110) 2024-05-23 07:56:58 -07:00
Tatsuyuki Kobayashi
8a40e932cf Fix BuildingSyncUps tutorial (#3099)
* Fix 05-PersistingSyncUps

* Fix 07-SyncUpDetailNavigation

* Fix 08-RecordMeeting
2024-05-18 07:43:13 -07:00
hmhv
9664c75816 fix TestingSyncUpForm.tutorial (#3091)
* fix TestingSyncUpForm.tutorial

* revert
2024-05-17 18:36:39 -07:00
Schultz Alexis
bac0d10c7c Add @_SPI(Internal) to some of navigation apis (#3097) 2024-05-17 10:44:28 -07:00
Paweł Wszeborowski
452155f129 Fix exception when using AppStorageKey with URL Value (#3098) 2024-05-16 15:00:32 -07:00
Joseph Kokenge
3a7766468c Fix ReducerCaseEphemeral Usage Documentation (#3092) 2024-05-15 17:12:38 -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
mbrandonw
a7daa9fb90 Run swift-format 2024-05-14 16:38:40 +00:00
Brandon Williams
0385ac4eb9 Fix a bunch of references. (#3085) 2024-05-14 09:37:45 -07:00
Brandon Williams
dd145a13c5 Fix focus in tutorial (#3072)
* Fix focus logic in tutorial.

* wip

* wip

* wip

* wip

* remove extra alert enum

* wip
2024-05-13 14:07:39 -07:00
Martin Moizard
48b57d4502 SyncUps: typos fixes (#3078) 2024-05-13 09:45:52 -07:00
Brandon Williams
1001325640 Clarify that tagged is not assumed in the tutorial. (#3076) 2024-05-13 08:54:02 -07:00
Brandon Williams
433a23118f Fix for throttle logic. (#3075) 2024-05-11 14:57:32 -07:00
seanmrich
f248eff583 Shared initializers modified to lazy load the initial value (#3060)
Co-authored-by: Sean <sean@snowfort.software>
2024-05-09 14:17:28 -07:00
Won Heo (Woody)
179240217d Enable customDump only in debug mode (#3058)
* Enable customDump only in debug mode

* Change customDump to customDumping String init
2024-05-09 13:24:50 -07:00
Brandon Williams
307c851709 New tutorial: Building SyncUps. (#3039)
* New tutorial: Building SyncUps.

* fix

* clean up

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-05-08 11:15:50 -07:00
seanmrich
4c36b18568 Make PersistenceKeyDefault load its default value lazily (#3057)
* Added autoclosure around default value for `PersistenceKeyDefault`

* Added autoclosure around default value for `PersistenceKeyDefault`

---------

Co-authored-by: Sean <sean@snowfort.software>
2024-05-08 11:15:14 -07:00
Stephen Celis
c0d10e2366 Precondition: persistence keys must match value (#3051)
* Precondition: persistence keys must match value

We currently soft-fail if a persistence key is reused across different
types. At runtime a persistence key will write over the other's value,
and vice versa, and data is lost.

Reusing the same file storage URL or app storage key with conflicting
types is a programmer error and ideally should crash over data
corruption.

* wip

* wip
2024-05-07 12:46:22 -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
stephencelis
5cb7526485 Run swift-format 2024-05-06 19:23:41 +00:00
Stephen Celis
c76914ee09 Runtime warn when stack integration is missing from store's reducer (#3048)
* Runtime warn when reducer is missing stack integration

If SwiftUI writes to a binding and the state is invalid (it is not
inserting or removing elements from the stack), then the most likely
cause is a missing `forEach` in the reducer (or a missing integration in
some parent reducer).

This commit adds a runtime warning to detect this issue.

* wip
2024-05-06 12:18:36 -07:00
Brandon Williams
096c5546ac Propagate dependencies to reducer all the time. (#3049) 2024-05-06 11:44:06 -07:00
Stephen Celis
5d73967c3e Cancel TestStore effects when root feature is dismissed (#3044)
* Cancel `TestStore` effects when root feature is dismissed

Right now, if a leaf feature is tested and it dismisses itself while
effects are in-flight, the only way to get tests passing is to
explicitly tell the store or any tasks returned by `store.send` to
cancel. Further, you must use an expectation in such tests to assert
that `dismiss` was called in the first place.

This PR changes this behavior to automatically cancel a test store's
effects if it is dismissed, and it prohibits sending more actions to it
after dismiss has been called.

* wip

* wip
2024-05-02 17:59:13 -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
Stephen Celis
e6c0959044 Revert perception availability changes (#3036) 2024-04-30 11:43:39 -07:00
Stephen Celis
b5f3786d23 Don't warn when dismissing two layers of tree nav (#3037)
Currently, popping two layers in a nav tree will cause intermediate,
invalid stores to send `dismiss` actions when they shouldn't. This
branch avoids this by checking the store's validity before sending the
action along.

Fixes #3031.
2024-04-30 11:31:33 -07:00
Brandon Williams
9de16b3e96 Fix @Shared initializer with default nil. (#3035)
* Fix @Shared initializer with default nil.

* wip
2024-04-30 11:03:50 -07:00
larryonoff
57cfcb6b92 Fix type in Reducers.md (#3034) 2024-04-30 09:25:24 -07:00