Skip to content

Communication Path between two States of the App #555

Answered by jmgawecki
jmgawecki asked this question in Q&A
Discussion options

You must be logged in to vote

Thanks to Thomas and Brandon.
Solution for that issue:

AppState and AppAction

struct AppState: Equatable {
   var frameworks: [Framework] = MockData.frameworks
   var selectedFramework: Framework?
}

enum AppAction: Equatable {
   case framework(index: Int, frameworkAction: FrameworkAction)
   case selectedFramework(Framework?)
   case dismissFrameworkDetailView
   case frameworkDetailView(FrameworkAction)
}

Piece of the appReducer taking part in .sheet( method

case .selectedFramework(let framework):
         state.selectedFramework = framework
         return .none
         
      case .dismissFrameworkDetailView:
         state.selectedFramework = nil
         return .none
         
  …

Replies: 2 comments 8 replies

Comment options

You must be logged in to vote
8 replies
@jmgawecki
Comment options

@tgrapperon
Comment options

@jmgawecki
Comment options

@tgrapperon
Comment options

@jmgawecki
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by jmgawecki
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