popover(...)
- ViewModel is passed to subviews using
@EnvironmentObject
- Add var with
@EnvironmentObject
property wrapper to the sub view and give@ObservedObject
ViewModel to it by adding.environmentObject(self.viewModel)
- Add var with
Navigate to another view by clicking an item
NavigationView { List { ForEach(store.documents) { document in NavigationLink(destination: EmojiArtDocumentView(document: document)) { Text(self.store.name(for: document)) } } } }
Delete items from list
List { ForEach(...) { ... } .onDelete { indexSet in indexSet.map { self.store.documents[$0] }.forEach { document in self.store.removeDocument(document) } } } .navigationBarItems( trailing: EditButton() )
Top comments (0)