Skip to content

Instantly share code, notes, and snippets.

@christianselig
Created July 20, 2022 19:44
Show Gist options
  • Save christianselig/3de70edb24496cea4b3f19413ec73f61 to your computer and use it in GitHub Desktop.
Save christianselig/3de70edb24496cea4b3f19413ec73f61 to your computer and use it in GitHub Desktop.
import SwiftUI
struct ContentView: View {
var body: some View {
List {
ForEach(0 ..< 5, id: \.self) { index in
Button {
print("Tapped index \(index)")
} label: {
HStack {
Image(systemName: "plus.circle.fill")
Text("Drag to Reorder or Tap to Add")
.foregroundColor(.primary)
}
}
}
.onMove(perform: { _, _ in })
.listRowInsets(.init(top: 0.0, leading: -25.0, bottom: 0.0, trailing: 0.0))
}
.environment(\.editMode, .constant(.active))
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment