Skip to content

Instantly share code, notes, and snippets.

@mitchtabian
Last active May 12, 2021 18:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchtabian/71eb95338fc8ca58dc2185c512f15da4 to your computer and use it in GitHub Desktop.
Save mitchtabian/71eb95338fc8ca58dc2185c512f15da4 to your computer and use it in GitHub Desktop.
struct RecipeListScreen: View {
@ObservedObject var viewModel: RecipeListViewModel
init(){
self.viewModel = RecipeListViewModel()
}
var body: some View {
List {
ForEach(viewModel.state.recipes, id: \.self.id){ recipe in
RecipeCard(recipe: recipe)
.onAppear(perform: {
viewModel.onTriggerEvent(
stateEvent: RecipeListEvents.NextPage()
)
})
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment