Skip to content
Discussion options

You must be logged in to vote

Hey @wtruppel. Because of the "modifier" style approach that was selected, there is no "convenient" way to scope into optional enums right now (wrong, see @stephencelis answer below). One solution is to open the optional, and then open the enum's case using an EmptyReducer as a support:

Reduce { state, action in
  switch action {
      
  }
}
.ifLet(\.route, action: /Action.route) {            // Route? -> Route
  EmptyReducer()
    .ifCaseLet(/Route.chat, action: /Action.chat) { // Route -> Route.case
      ChatFeature()
    }
    .ifCaseLet(/Route.participants, action: /Action.participants) {
      ParticipantsFeature()
    }
}

Once this is working, you can try to make it work with your

Replies: 1 comment 13 replies

Comment options

You must be logged in to vote
13 replies
@ghost
Comment options

@stephencelis
Comment options

@stephencelis
Comment options

@ghost
Comment options

@tgrapperon
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants