Commit Graph

34 Commits

Author SHA1 Message Date
Jesse Tipton
745bc10361 Fix commas that should be periods in docs (#2267) 2023-07-07 22:36:50 -07:00
Stephen Celis
daf41b3370 Add public Store.send and Store.withValue (#2222) 2023-06-28 09:32:32 -07:00
Stephen Celis
c432a76b5b Navigation (#1945)
* wip

* fix

* wip

* wip

* move

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Fix

* wip

* wip

* Renamed action to onTap in NavigationLinkStore (#2043)

Renamed the `action` parameter to mirror other inits and differentiate itself from `action fromDestinationAction`

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Tie view identity to stack element identity

* Tie item identity to case

* wip

* wip

* cleanup

* fix

* fix

* Add warning to nav link

* wip

* wip

* Rename FullscreenCover.swift to FullScreenCover.swift (#2062)

* wip

* fix isDetailLink on non-iOS platforms

* Correct some comments in Effect.swift (#2081)

* add integration tests for showing alert/dialog from alert/dialog.

* copy StackElementIDGenerator dependency before running TestStore receive closure.

* Removed some unneeded delegate actions.

* wip

* clean up

* lots of clean up

* Converted voice memos back to identified array

* update deps

* update docs for DismissEffect

* wip

* Add Sendable conformance to PresentationState (#2086)

* wip

* swift-format

* wip

* wip

* docs

* wip

* wip

* Catch some typos in Articles (#2088)

* wip

* wip

* wip

* wip

* wip

* docs

* wip

* wip

* docs

* wip

* wip

* wip

* wip

* docs

* docs

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Fix invalid states count for 3 optionals and typos (#2094)

* wip

* wip

* more dismisseffect docs

* fixed some references

* navigation doc corrections

* more nav docs

* fix cancellation tests in release mode

* wrap some tests in #if DEBUG since they are testing expected failures

* update UUIDs in tests to use shorter initializer

* fixed a todo

* wip

* fix merge errors

* wip

* fix

* wip

* wip

* fixing a bunch of todos

* get rid of rawvalue in StackElementID

* more todos

* NavLinkStore docs

* fix swift 5.6 stuff

* fix some standups tests

* fix

* clean up

* docs fix

* fixes

* wip

* 5.6 fix

* wip

* wip

* dont parallelize tests

* updated demo readmes

* wip

* Use ObservedObject instead of StateObject for alert/dialog modifiers.

* integration tests for bad dismissal behavior

* check for runtime warnings in every integration test

* wip

* wip

* fix

* wip

* wip

* wip

* wip

* wip

* Drop a bunch of Hashables.

* some nav bug fixes

* wip

* wip

* wip

* fix

* fix

* wip

* wip

* Simplify recording test.

* add concurrent async test

* fix

* wip

* Refact how detail dismisses itself.

* fix

* 5.6 fix

* wip

* wip

* Add TestStore.assert.

* Revert "Add TestStore.assert."

This reverts commit a892cccc66.

* add Ukrainian Readme.md (#2121)

* Add TestStore.assert. (#2123)

* Add TestStore.assert.

* wip

* Update Sources/ComposableArchitecture/TestStore.swift

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

* Update Sources/ComposableArchitecture/Documentation.docc/Extensions/TestStore.md

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

* fix tests

---------

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

* Run swift-format

* push for store.finish and presentation

* move docs around

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Add case subscripts

* wip

* wip

* 5.7-only

* wip

* wip

* wip

* wip

* revert store.finish task cancellation

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* add test for presentation scope

* wip

* wip

* wip

* wip

* wip

* cleanup

* updated presentation scope test

* sytnax update

* clean up

* fix test

* wip

* wip

* wip

* wip

* wip

---------

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
Co-authored-by: Martin Václavík <mvaclavik96@icloud.com>
Co-authored-by: 유재호 <y73447jh@gmail.com>
Co-authored-by: Jackson Utsch <jutechs@gmail.com>
Co-authored-by: Dmytro <barabashdmyto@gmail.com>
Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
Co-authored-by: mbrandonw <mbrandonw@users.noreply.github.com>
2023-05-30 12:22:00 -04:00
Stephen Celis
79307e939f Rename WithViewStore.debug to WithViewStore._printChanges (#2101) 2023-05-12 10:06:18 -07:00
Stephen Celis
da205c71ae Deprecate Store.scope(state:) for view store observe (#2097)
* Deprecate `Store.scope(state:)` for view store `observe`

Explicit scoping is most appropriate for transforming domains, which
almost always requires an action transform. In the rare case it doesn't,
we should prefer an explicit `{ $0 }`.

Scoping for the view has been deprecated for awhile for the `observe`
parameter when creating view stores, so let's lead folks that direction.

* wip

* wip
2023-05-11 08:17:54 -07:00
Brandon Williams
d73a3494bf Better type names in WithViewStore.debug. (#1973) 2023-03-15 08:25:47 -07:00
Matteo Girardi
016725483e Fix grammar in doc (#1963)
* Fix documentation

- improve grammar in doc

* Revert to previous sentence
2023-03-07 13:51:11 -08:00
Brandon Williams
df9284174a Force WithViewStore to be a view. (#1910) 2023-02-17 09:21:44 -08:00
stephencelis
bcae29f23d Run swift-format 2022-10-10 18:37:19 +00:00
Brandon Williams
b8294b89d5 ReducerProtocol (#1283)
* Add previewValue to DependencyKey, and fixed build errors on Xcode 13.

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Add Xcode 14 to CI (#1266)

* Add Xcode 14 to CI

* Update ci.yml

* wip

* wip

* Update Makefile

* Update Makefile

* wip

* runtime warning when no live dependency available for live app

* bring back live

* wip

* soft deprecate Reducer

* fusion test

* ternary clean up

* wip

* add some todos

* typealias Reducer inside AnyReducer

* Add `now` convenience property to date dependency (#1286)

* Remove type alias

* LiveDependencyKey: DependencyKey -> DependencyKey: TestDependencyKey (#1288)

* LiveDependencyKey: DependencyKey -> DependencyKey: TestDependencyKey

* wip

* wip

* wip

* wip

* wip

* fix

* wip

* fix navigate case studies

* wip

* fixes and docs

* more migration

* wip

* wip

* thread deps through ifLet and forEach examples.

* update

* clean up

* wip

* wip

* Update MigratingToReducerProtocols.md

* wip

* wip

* docs

* docs

* fix some docs

* Fix for CombineReducers compiler bug

* wip

* wip

* wip

* wip

* todos for docs

* Don't warn for overridden test dependencies (#1324)

* Don't warn while setting test dependencies

* wip

* fix conflict

* wip

* Docs and deprecations

* add binding info

* wip

* Add URL session

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* Don't run debug reducer in tests

* wip

* updated reducer debugging

* Update UUID.swift (#1374)

* wip

* optional

* added Self as default associatedtype value for TestDependencyKey.value (#1395)

* added Self as default associatedtype value for TestDependencyKey.value

* Update Tests/ComposableArchitectureTests/DependencyKeyTests.swift

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>

* Update example to set badge to the unread count (#1391)

* Add store.finish().

* Fix warnings introduced in Xcode 14.1 (#1388)

* Fix warnings introduced in Xcode 14.1

* wip

* Conform dependency values to DependencyKey where convenient

* fix

* Fail if testValue is invoked without providing implementation (#1399)

* Update example to set badge to the unread count (#1391)

* Add store.finish().

* Fix the CaseStudies (UIKit) (#1392)

* Fix warnings introduced in Xcode 14.1 (#1388)

* Fix warnings introduced in Xcode 14.1

* wip

* Fail when accessing testValue when one hasn't been provided.

* wip

* wip

* wip

* test

Co-authored-by: Mark Adams <hyperspacemark@users.noreply.github.com>
Co-authored-by: Maciek Czarnik <Czajnikowski@users.noreply.github.com>
Co-authored-by: Stephen Celis <stephen@stephencelis.com>

* Add DateGenerator.init(_ generate:)

* Start running some tests in release config. (#1405)

* Start running some tests in release config.

* wip

* wip

* wip

* wip

* wip

* Update Sources/ComposableArchitecture/Store.swift

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* wip

* wip

Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>

* added test that dependencies are transferred to effects

* wip

* self

* clean up

* simplify

* fix

* doc fixes

* wip

* fix

* wip

* wip

* wip

* fix

* Run dependencies tests on CI. (#1408)

* Run dependencies tests on CI.

* wip

* update makefile

* wtf

* more docs

* more docs

* wip

* docs

* wip

* docs

* wip

* message tweaks

* wip

* docs and clean up

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* typo fix

* docs clean up

* doc fixes

* cancel in progress

* cancel in progress

* no need to make recope release-only, and make more use of XCTAssert to get better release tests

* fix test

* Remove ActorIsolated from tests where it's not needed

* fix test

* wip

* wip

* Add a benchmark for dependency key writing.

* fix test

* make benchmark 5.7 compatible

* iflet docs

* more docs

* dependency docs

* rearrange

* @Dependency docs

* docs

* fix benchmark in 5.6

* doc fix

* wip

* wip

* wip

* wip

* more docs

* clean up

* fix

* wip

* Fixes compilation on watchOS (#1423)

Co-authored-by: Gunnar Herzog <gunnar.herzog@kf-interactive.com>

* move deprecation

* format

* wip

* Fix openURL

* wip

* wip

* wip

* wip

* fix

* Keep simple

* Reducer.debug -> Reducer._printChanges

We want to revisit some of these debugging APIs in the future, so let's
keep them around, but underscore them to allow for more flexible
evolution.

* `ReducerProtocol.debug` -> `ReducerProtocol._printChanges` (#1426)

* Reducer.debug -> Reducer._printChanges

We want to revisit some of these debugging APIs in the future, so let's
keep them around, but underscore them to allow for more flexible
evolution.

* Update DebugTests.swift

* OpenURL fix for macCatalyst (#1429)

* OpenURL fix for macCatalyst

Fixes #1428.

* Update Makefile

* Correct typo in "Designing dependencies" chapter (#1430)

protocol AudioPlayerClient should be a struct

* fix

* fix

* protocol docc

* docs

* Typos (#1439)

* remove unneeded internals

* wip

* Fix missing parameter in code sample (#1450)

* typo fix

* more docs for DependencyKeyWritingReducer

* wip

* wip

* update readme

* wip

* update image

* main actor

* Added withValue, added docs and tests

* public properties

* cleaned up overload

* changed reducer->feature in a bunch of spots of dependencies docs

* add articles to readme

* 6

* fix tests for swift 5.6

* tweak

* tweak

* Update ReducerProtocol.swift

* wip

* wip

* docs update

* docs for conforming dependency directly to DependencyKey

* typo fix

* performance article update

* fixes

* deprecate another effect timer API

* link to migration doc in deprecation messages

* make some tests that deal with line numbers less fragile

* package.swift clean up

* tweak to echos

* remove docs at root, not in docs-out

* remove todo

* update WithViewStore.init deprecation message to explain and link to performance doc

* Add back ReducerProtocolOf for 5.7.1 (#1444)

* Add back ReducerProtocolOf for 5.7.1

* wip

* Move scheme tests to matrix

* streamline

* try this

* store.finish

* wip

* dependencies -> transformDependency

* wip

* wip

* Compat

* fix

* preserve deps for combine publishers

* Remove dump calls (#1460)

* Fix compiler errors for library evolution. (#1443)

* Fix compiler errors for library evolution.

* wip

* wip

* work around ambiguous init

* Revert "work around ambiguous init"

This reverts commit 002a199d59.

* fix ambiguity errors

* remove _Observe for now

* wip

* wip

* wip

* longer timeout

* more waiting

* wip

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
Co-authored-by: Ken Grigsby <kgrigsby@mac.com>
Co-authored-by: Petr Sima <ptea.sima@gmail.com>
Co-authored-by: Mark Adams <hyperspacemark@users.noreply.github.com>
Co-authored-by: Maciek Czarnik <Czajnikowski@users.noreply.github.com>
Co-authored-by: Thomas Grapperon <35562418+tgrapperon@users.noreply.github.com>
Co-authored-by: Gunnar Herzog <github@trispo.de>
Co-authored-by: Gunnar Herzog <gunnar.herzog@kf-interactive.com>
Co-authored-by: Guttorm Aase <guttormaase@gmail.com>
Co-authored-by: Julien Sagot <contact@juliensagot.fr>
Co-authored-by: Jaanus Siim <jaanussiim+github@gmail.com>
2022-10-10 11:37:50 -04:00
Brandon Williams
764de879ef More docs for WithViewStore and new observe argument (#1368)
* wip

* wip

* Update Performance.md

* Update Performance.md

* wip

* wip

* Update Performance.md

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2022-09-10 10:20:35 -04:00
Stephen Celis
cbe013b42b Remove @StateObject shim for now (#1358)
* Remove `@StateObject` shim for now

* remove
2022-09-08 19:20:13 -04:00
Brandon Williams
046133ffd8 Move WithViewStore deprecations to Deprecations.swift (#1346) 2022-09-07 15:12:00 -04:00
Stephen Celis
bef2084cb2 Introduce WithViewStore.init(_:observe:send:...) (#1339)
* wip

* Introduce `WithViewStore.init(_:observe:send:...)`

* Update examples

* wip

* typo

* wip
2022-09-07 10:08:20 -04:00
Thomas Grapperon
b6ca93d0a3 Add _StateObject, an iOS 13 compatible substitute of StateObject (#1336)
* Add `_StateObject`

* wip

* `Storage` doesn't need to be `ObservableObject`

* Improve performance

Introduce a magic `@Published` that makes it much faster for some reason.

Both Storage and Observed have been merged into one type only, and properties/functions have been renamed like `StateObject` internals.

* wip

* wip

* wip

* wip

* wip

* Cleanup

* wip

* Remove `ObjectWillChangePublisher.Output` condition

This is not used anymore.

* Move `_StateObject` to "internal/"

* Typo

* wip

* wip

* wip

* Rollback `StateObjectViewStore` changes
2022-09-05 13:25:46 -04:00
Brandon Williams
1a53648704 Use @StateObject for WithViewStore in iOS 14 (#1325)
* wip

* Deprecate WithViewStore overloads

* wip

* wip

* wip

* wip

* draft of state object for withviewstore

* Revert "draft of state object for withviewstore"

This reverts commit bf00da23fd.

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix availabililty

* tryting to get debug

* fix printing

* wip

* wip

* fix flakey test

* release builds

* wip

* wip

* merge conflicts

* wip

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2022-09-01 16:36:16 -04:00
Stephen Celis
a6fc9a2ed5 Add deprecations to non-view WithViewStore initializers (#1323)
* wip

* Deprecate WithViewStore overloads

* wip

* wip

* wip

* wip

* wip

* wip

* docs on withviewstore performance

* wip

* wip

* wip

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2022-09-01 12:45:07 -04:00
Thomas Grapperon
37d05164c3 Conform WithViewStore to Commands (#1113)
* Conform `WithViewStore` to `Commands`

* Fix typo

* Add coverage for `Commands`

* Fix documentation

* Conform `WithViewStore` to `AccessibilityRotorContent` and `ToolbarContent`

* Conform `WithViewStore` to `TableColumnContent`

* Fix indentation

* Conform `WithViewStore` to `TableRowContent`

* Fix Typo

* Conform `WithViewStore` to `DynamicTableRowContent`

* Reorder declarations according to the protocol name

* Add coverage for `WithViewStore` new conformances

* Remove Table-related conformances

* Rearrange extensions for better autocomplete.

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2022-06-03 11:53:54 -04:00
Thomas Grapperon
85050a28a9 Fix WithViewStore issues with Views using escaping closures (#1015)
* Use a new instance of `ViewStore` in `WithViewStore`'s `body`

* Use explicit `self` for style coherence

* Remove `viewCancellable` additional reference in `newInstance()`

* Revert "Remove `viewCancellable` additional reference in `newInstance()`"

This reverts commit cb6a22ae4f.

* Change `viewCancellable` capture list

* Update `GeometryReader`'s workarounds
2022-03-11 15:23:42 -05:00
Brandon Williams
d165966898 Don't print to console when dumping state for ViewStore.debug (#829) 2021-09-24 10:22:22 -04:00
Stephen Celis
575d7c0d59 Use Custom Dump (#736)
* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* fix

* wip

* wip

* Model Tic-Tac-Toe board using proper type

* wip

* wip

* wip

* wip

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2021-08-22 22:45:27 -04:00
stephencelis
67ccab6bce Run swift-format 2021-08-11 16:13:31 +00:00
Stephen Celis
e73b36e2cb WithViewStore debug state diffs (#706)
* WithViewStore debug state diffs

* More debug checks

* fix

* wip
2021-08-11 11:55:08 -04:00
Wendy Liga
1a8bccc62e Support DocC Xcode 13 (#591)
* wip

* finish

* revert back code snippet identation to 5

* Update Sources/ComposableArchitecture/Effect.swift

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>

Co-authored-by: Brandon Williams <135203+mbrandonw@users.noreply.github.com>
2021-06-14 14:10:08 -04:00
Stephen Celis
f8608c7421 Breakpoint instead of assert in optional/forEach (#296)
* Breakpoint instead of assert in optional/forEach

* fix merge

Co-authored-by: Brandon Williams <mbw234@gmail.com>
Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2021-03-02 13:03:15 -05:00
Stephen Celis
e51fb00d1f Remove type alias for Xcode 12.5 compatibility (#371)
* Remove type alias

* Fix a few warnings
2021-02-01 14:55:29 -05:00
Stephen Celis
4c7bd31336 Format and coverage 2021-01-12 09:45:48 -05:00
stephencelis
b1e2dced5b Run swift-format 2021-01-12 00:51:35 +00:00
Max Desiatov
9fbd834664 Add Scene conformance to WithViewStore (#336)
* Add SceneWithViewStore for accessing stores in scenes

This would allow accessing `ViewStore` instances from a `body` definition of a type conforming to `Scene`. It could be useful for conditional rendering of scenes or sending actions from scene commands. Here's an example:

```swift
import ComposableArchitecture
import SwiftUI

@main
struct CommandsApp: App {
  private let store = Store(
    initialState: RootState(),
    reducer: rootReducer,
    environment: .live(rootEnvironment)
  )

  var body: some Scene {
    SceneWithViewStore(store) { viewStore in
      WindowGroup {
        WorkspaceView()
      }.commands {
        CommandGroup(after: CommandGroupPlacement.newItem) {
          Button("Open...") {
            viewStore.send(.open)
          }.keyboardShortcut("o", modifiers: [.command])
        }
      }
    }
  }
}
```

* Avoid building SceneWithViewStore with old Xcode

* Separate Catalina and Big Sur jobs

This allows testing APIs that are only available on Big Sur

* Unify `WithViewStore` and `SceneWithViewStore`
2021-01-11 19:38:09 -05:00
Stephen Celis
32acc6a859 Document ScrollViewReader problem (#268) 2020-08-26 13:02:59 -04:00
Stephen Celis
e8e272a7c0 Make Reducer.debug API more like Publisher.print (#111)
* Make Reducer.debug API more like Publisher.print

* Deprecations
2020-05-18 11:18:11 -04:00
Stephen Celis
a90c48924f Wrap WithViewStore debugging in compiler directive (#99) 2020-05-14 21:07:45 -04:00
Stephen Celis
b4779b36b1 Helpers for making stores stateless/actionless (#45) 2020-05-11 18:40:09 -04:00
Brandon Williams
d2240d0e76 The Composable Architecture
Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2020-05-03 22:26:28 -07:00