Skip to content

0.53.0

Compare
Choose a tag to compare
@stephencelis stephencelis released this 12 May 17:19
· 456 commits to main since this release
79307e9

What's Changed

  • Added: Store.init and TestStore.init now take reducer builders (#2087).

    // Before:
    Store(
      initialState: Feature.State(),
      reducer: Feature()
    )
    
    // After:
    Store(initialState: Feature.State()) {
      Feature()
    }
  • Changed: SwitchStore has gotten some quality-of-life improvements (#2029).

    • SwitchStore.init can now take the initial enum state so that it can be switched over exhaustively. This initializer also relaxes certain compile-time constraints previously requiring only CaseLet views and an optional, trailing Default view.

    • CaseLet can now omit the state parameter label, making it more consistent with other APIs, like Reducer.ifCaseLet.

    • The older SwitchStore and CaseLet initializers have been soft-deprecated along with the Default view.

      // Before:
      SwitchStore(self.store) {
        CaseLet(state: /App.State.loggedIn, action: App.Action.loggedIn) { loggedInStore in
          LoggedInView(store: loggedInStore)
        }
        CaseLet(state: /App.State.loggedOut, action: App.Action.loggedOut) { loggedOutStore in
          LoggedOutView(store: loggedOutStore)
        }
      }
      
      // After:
      SwitchStore(self.store) {
        switch $0 {  // Can now switch over initial state for exhaustivity at compile time
        case .loggedIn:
          CaseLet(/App.State.loggedIn, action: App.Action.loggedIn) { loggedInStore in
            LoggedInView(store: loggedInStore)
          }
          .buttonStyle(.plain) // Can now render arbitrary views/modifiers in the view builder
        case .loggedOut:
          CaseLet(/App.State.loggedOut, action: App.Action.loggedOut) { loggedOutStore in
            LoggedOutView(store: loggedOutStore)
          }
        }
      }
  • Changed: WithViewStore.debug has been renamed to WithViewStore._printChanges for consistency with Reducer._printChanges (#2101).

  • Fixed: EffectTask.publisher now properly escapes dependencies accessed within it (#1988).

  • Fixed: Reducer._printChanges() is no longer disabled in tests (#1995). This allows it to be used for debugging purposes during test runs.

  • Changed: The internal Task.megaYield tool, for more predictably testing concurrent code, is now configurable via the TASK_MEGA_YIELD_COUNT environment variable (#2064).

  • Improved: The output format of WithViewStore._printChanges() has been improved (#1973).

  • Improved: Runtime warnings will now emit XCTest failures in test code rather than in app code (#2059).

  • Deprecated: Type-based cancel IDs have been deprecated (#2091). Use hashable values, instead.

  • Deprecated: The actionless overload of Store.scope(state:) has been deprecated in favor of the observe parameter on view stores (#2097).

  • Deprecated: Effect.task and Effect.fireAndForget have been soft-deprecated in favor of Effect.run (#2099).

  • Infrastructure: Added test coverage for child/parent effect cancellation behavior (#1970).

  • Infrastructure: Clean up effect cancellation logic (#1977).

  • Infrastructure: Miscellaneous documentation/formatting fixes:

    Fixed missing action parameter in ForEachStore documentation (thanks @m-housh, #1998).

    Number fact tutorial fix (thanks @siliconsorcery, #1962).

    BindingAction fix (thanks @Ryu0118, #2019).

    withTaskCancellation(id:) fix (thanks @bjford, #2049).

    Formatting fix (thanks @mooyoung2309, #2056).

    Update 'bindable state' to 'binding state' (thanks @Jager-yoo, #2054).

  • Infrastructure: Added Russian README translation (thanks @artyom-ivanov, #2014).

  • Infrastructure: Added Polish README translation (thanks @MarcelStarczyk, #2040).

  • Infrastructure: Bump dependencies.

  • Infrastructure: Bump Xcode demo project settings (#2042).

  • Infrastructure: Clean up and test TestStore.skipInFlightEffects (#2057).

  • Infrastructure: CI updates (#2060).

  • Infrastructure: Document how exhaustive vs. non-exhaustive test stores work (#2096).

New Contributors

Full Changelog: 0.52.0...0.53.0