Commit Graph

1123 Commits

Author SHA1 Message Date
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
Brandon Williams
3d343f1fce Some improvements to throttling (#3079)
* Improvements to throttling.

* wip
2024-06-21 15:19:17 -04:00
Brandon Williams
476050cba2 Convert all ActorIsolated to LockIsolated. (#3198) 2024-06-21 15:18:47 -04:00
Ikko Eltociear Ashimine
c0d3ba84e4 Update PersistenceKeyDefault.swift (#3194)
deafult -> default
2024-06-21 10:06:58 -04:00
B Tirumala Rao
309e185d14 Fix typos in the Meet the Composable Architecture tutorial (#3193) 2024-06-21 10:06:33 -04:00
Stephen Celis
1f952d8c69 Update MigratingTo1.11.md 2024-06-19 13:02:55 -07:00
Brandon Williams
662fee0304 Restrict Shared.elements to IdentifiedArray only. (#3187)
* Restrict Shared.elements to IdentifiedArray only.

* wip

* wip

* wip

* fix test

---------

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2024-06-19 12:26:55 -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
stephencelis
53bc869b08 Run swift-format 2024-06-19 05:23:17 +00:00
Brandon Williams
32dadd496b Remove duplicates in app storage key. (#3186) 2024-06-18 22:08:25 -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
Sergio Fernández
964c9aa983 Share state appstorage nullable (#3174)
* failing AppStorageKey stored value and set to nil

* setting SharedAppStorageLocals when removing

* Clean up

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2024-06-17 13:25:12 -07:00
Stephen Celis
fd9ef56bb8 Don't pass embed functions directly to AnyCasePath.init (#3167)
`AnyCasePath` closures will be required to be `@Sendable` for Swift 6
data race checking, but `Enum.case` functions are not `@Sendable`
implicitly. As such we cannot pass `Enum.case` directly to functions
that expect sendable closures. Instead, we must explicitly write:

```swift
{ .case($0) }
```
2024-06-14 13:32:05 -07:00
Seokwoo Jang
3bc77de591 Fixed extension typos in the Building SyncUps tutorial (#3161) 2024-06-12 23:25:10 -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
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