Commit Graph

203 Commits

Author SHA1 Message Date
Stephen Celis
37537a5248 Fix ForEachStore (#528) 2021-05-05 07:57:37 -07:00
Brandon Williams
468ffaa9ea Fix typo in AlertState docs (#520) 2021-04-29 08:09:33 -05:00
Stephen Celis
0f026d395d Update Store.ifLet docs (#500)
* Update `Store.ifLet` docs

* More docs

* Update syntax for old CI

* fix
2021-04-20 11:36:14 -04:00
Stephen Celis
c53a961920 Add @ViewBuilder to ForEachStore and IfLetStore (#501)
* Add @ViewBuilder to ForEachStore and IfLetStore

* Update IfLetStore else branch to take view builder
2021-04-20 11:10:30 -04:00
stephencelis
dcf6b8f469 Run swift-format 2021-04-05 18:30:47 +00:00
Stephen Celis
4e2b27b492 Safely unwrap ForEachStore rows (#471)
* Safely unwrap ForEachStore rows

* Add feedback link
2021-04-05 14:15:36 -04:00
Stephen Celis
f1faccc3a2 Updated TestStore DSL (#454)
* Update TestStore to support imperative DSL

This gives us better XCTIssue-based error messaging since each line is
captured in the stack.

* Update examples to new testing DSL

* Fix

* Update README.md

* 11.3

* fix

* fix
2021-03-22 13:27:51 -04:00
stephencelis
9e50df4427 Run swift-format 2021-03-10 23:02:03 +00:00
Stephen Celis
cb080b7478 TextState: DebugOutputConvertible (#421)
* Fix debug text

* XML

* wip

* wip

* wip
2021-03-10 17:56:13 -05:00
Steven Sherry
a116fff6d4 Addresses a couple of documentation issues for IdentifiedArray (#414)
* Addresses a couple of documentation issues for IdentifiedArray:
1. The AppState example is missing a generic. Based on the context of the documentation, I filled that into what I thought would be appropriate.
2. The ForEachStore example was missing a colon and comma.

* Update Sources/ComposableArchitecture/SwiftUI/IdentifiedArray.swift

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2021-03-06 12:16:32 -05: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
caebd33686 Add ViewStore.send(_:animation:). (#392) 2021-02-22 15:31:25 -05:00
Stephen Celis
97c3dab5c3 Improve performance of ForEachStore (#386)
* Improve performance of ForEachStore

* fix

* Fix

* Cleanup

* Basic docs

* Update ForEachStore.swift
2021-02-15 13:43:56 -05:00
Stephen Celis
5bdf0bc904 FormAction → BindingAction (#372)
* Rename FormAction to BindingAction

* Deprecations

* Fix test

* Update 01-GettingStarted-Bindings-Forms.swift
2021-02-01 16:41:36 -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
b07596068f Fatal error replacing identified elements with invalid ids (#368)
* Fatal error replacing identified elements with invalid ids

Fixes #366.

* cleanup

* fix
2021-02-01 14:45:44 -05:00
stephencelis
adf5024ceb Run swift-format 2021-02-01 18:44:48 +00:00
Stephen Celis
ff57565322 Forms (#367)
* Forms

* wip

* wip

* Basics

* Fix

* Apply .textCase(.none) to section headeres.

* Small tweaks do docs and case study readme.

* Update Forms.swift

* Fix warnings

* Revert "Apply .textCase(.none) to section headeres."

This reverts commit f535a75eb9.

* fix

Co-authored-by: Brandon Williams <mbrandonw@hey.com>
2021-02-01 13:34:55 -05:00
Stephen Celis
a8a5bcec1d Re-publicize AlertState.Button.type (#361)
* Re-publicize `AlertState.Button.type`

* Update Alert.swift
2021-01-22 10:24:31 -05:00
stephencelis
37c6312ba4 Run swift-format 2021-01-21 23:12:17 +00:00
Stephen Celis
4449bc2e24 Add TextState (for AlertState, ActionSheetState, etc.) (#359)
* Use SwiftUI.Text with {Alert,ActionSheet}State

Fix #293, #318.

* Use public interface

* Availability

* TextState

* Note

* Simplify

* Update LocalizedStringTests.swift

* Fix warnings

* Fix docs
2021-01-21 17:50:34 -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
Jefferson Setiawan
59216205cf add reverse implementation (#276) 2020-09-03 19:28:23 -04:00
Stephen Celis
5171335620 Localizable Alerts and Action Sheets (#275)
* Localizable Alerts and Action Sheets

Fixes #237.

* Tests/fixes

* Update LocalizedStringKey.swift

* Fix
2020-08-31 16:31:34 -04:00
Stephen Celis
32acc6a859 Document ScrollViewReader problem (#268) 2020-08-26 13:02:59 -04:00
stephencelis
083a4a8cec Run swift-format 2020-08-13 23:53:57 +00:00
Jefferson Setiawan
fffefb9c22 Add implementation of shuffle on IdentifiedArray (#254)
* add shuffle

* Update Tests/ComposableArchitectureTests/IdentifiedArrayTests.swift

* Update IdentifiedArrayTests.swift

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2020-08-13 19:52:14 -04:00
Stephen Celis
7f482acbf4 Alert bug exploration (#249)
* wip

* Fix

* revert

* Fix tests

* Better debug output

* organize

* alphabetize

* Fix mac

Co-authored-by: Brandon Williams <mbw234@gmail.com>
2020-08-10 12:47:36 -04:00
Jasdev Singh
576d0f9b0d Fixes small viewStoreself.store typo in AlertState’s docs. (#208) 2020-07-03 18:16:42 -04:00
Brandon Williams
a905fbf5ec Generic alerts and action sheets (#201)
* alerts

* wip

* wip

* wip

* clean up

* wip

* wip

* wip

* wip

* format

* clean up

* clean up

* docs

* wip

* tests

* API tweaks

* Fix

* More API changes

* More API changes

* More

* Fix

* Fix docs

* Generic alerts optionality (#202)

* Use Optional to model generic alerts

* Xcode 12

* Refinement

* update docs

* Fix

* Fix

* doc fixes

* rename

* fixes

* fixes

Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2020-06-30 09:48:36 -05:00
Danny Hertz
fc42693ac3 Move ViewStore into root ComposableArchitecture directory (#189) 2020-06-18 07:07:33 -05:00
Stephen Celis
1e91f34bbb Optimize IfLetStore ViewBuilder code (#167)
* Optimize IfLetStore ViewBuilder code

* Infer
2020-06-03 21:36:03 -04:00
Brandon Williams
f25878c01f Clarify assertion failure for incorrect send usage (#151)
* Clarify assertion failure for incorrect send usage

* Update ViewStore.swift

* Update Sources/ComposableArchitecture/Store.swift

Co-authored-by: Dante Broggi <34220985+Dante-Broggi@users.noreply.github.com>

* Update Sources/ComposableArchitecture/Store.swift

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

Co-authored-by: Dante Broggi <34220985+Dante-Broggi@users.noreply.github.com>
Co-authored-by: Stephen Celis <stephen@stephencelis.com>
2020-05-29 09:30:56 -07:00
Peter Kovacs
11be1b66a1 Implement sort() and sort(by:) for IdentifiedArray. (#128) 2020-05-22 16:14:36 -04:00
Stephen Celis
c77bb6ceaf Update Format Workflow (#127)
* Update Format Workflow

* Update IdentifiedArrayTests.swift
2020-05-22 13:08:00 -04:00
Peter Kovacs
6001603856 Implement IdentifiedArray.replaceSubrange (#126)
* Implement IdentifiedArray.replaceSubrange

* Use callback instead of key path.

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

* Remove Self from where clause

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

Co-authored-by: Stephen Celis <stephen.celis@gmail.com>
2020-05-22 12:28:46 -04:00
Stephen Celis
05670ca75d Move documentation inside compiler directive (#118)
* Duplicate docs for compiler directive

* Remove RELEASE doc
2020-05-19 17:03:39 -04:00
Brandon Williams
6f3749bfbb Update ViewStore.swift (#116) 2020-05-19 10:09:27 -07: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
f4d81601af Fatal error for identified array subscript misuse (#95)
* Fatal error for identified array subscript misuse

* More docs

* Remove file/line to support Swift 5.1
2020-05-14 16:43:06 -04:00
Jasdev Singh
90126dc066 Typo fix in IfLetStore’s docs. (#93)
(Looking out 📝)
2020-05-13 20:21:23 -07:00
Stephen Celis
27915d6524 Identified Array Updates (#80)
* Identifier-based subscript should get direct `modify` access, with
    caveats.
  * Add `remove(id:)` method.
2020-05-12 11:21:22 -04:00
Stephen Celis
b4779b36b1 Helpers for making stores stateless/actionless (#45) 2020-05-11 18:40:09 -04:00
stephencelis
3504634da3 Run swift-format 2020-05-08 14:00:36 +00:00
Brandon Williams
4df9a2e17e Don't use Group in IfLetStore. (#41) 2020-05-07 17:27:21 -07:00
Stephen Celis
bcb10ae768 Fix Xcode previews crash (#31)
* Fix Xcode previews crash

* Format
2020-05-07 09:39:25 -04:00
Stephen Celis
4016008d87 Assorted fixes for collections of state (#25)
* Assorted fixes for collections of state

Fixes #21.

* Update IdentifiedArrayTests.swift

* Update case studies

* Run swift-format on _push_ to master

* Format
2020-05-06 11:57:20 -04:00