Created
October 13, 2022 15:20
-
-
Save brindy/75eba7b69e5bf49baa768aa8477cbf31 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct ContentView: View { | |
let items = [ | |
"Hello", | |
"World" | |
] | |
var body: some View { | |
NavigationView { | |
List { | |
ForEach(items, id: \.self) { item in | |
// In when "editMode" is active (ie delete and move of rows is possible) | |
// tapping the item does not go to the detail view. | |
NavigationLink(destination: Text("Detail \(item)")) { | |
Text(item) | |
} | |
} | |
.onMove { indexes, destination in | |
print("*** onMove", indexes, destination) | |
} | |
.onDelete { indexes in | |
print("*** onDelete", indexes) | |
} | |
} | |
} | |
.toolbar { | |
ToolbarItem(placement: .bottomBar) { | |
EditButton() | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment