SwiftUI load new view neue View anzeigen mit NavigationLink

VonTobias Stephan

SwiftUI load new view neue View anzeigen mit NavigationLink

Das ist ja wirklich mal einfach gelöst. Der NavigationLink umfasst hier die jeweils aus der Liste zu verlinkende Zeile.

struct ListoryListView: View {

        @ObservedObject var oListDatasource = ListDataSource()

        let oListoryParser = ListoryXMLParser()
        @State var selection = Set<UUID>()
        var body: some View {
            NavigationView {

                List(){
                    ForEach(oListDatasource.ListOfListEntries)
                    { item in
                        NavigationLink(destination: EditEntryView()) {
                            VStack(alignment: .leading){
                                Text(item.Caption)

                            }

                            .onTapGesture {
                                print("\(item.Caption)")
                            }
                        }

                        //.navigationBarItems(trailing: EditButton())

                    }.onDelete(perform: xdelete)
                }
                    
                .navigationBarTitle(Text(self.oListDatasource.ActiveListTitle))
            .navigationBarItems(trailing:

                           Button("Help") {
                               print("Help tapped!")
                           }
                       )
            }

        }

Über den Autor

Tobias Stephan administrator

Schreibe eine Antwort