Skip to content

Instantly share code, notes, and snippets.

@CastIrony
Last active July 15, 2020 22:50
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 CastIrony/bd3907d5eb22d51fd814187f5d4ec6a4 to your computer and use it in GitHub Desktop.
Save CastIrony/bd3907d5eb22d51fd814187f5d4ec6a4 to your computer and use it in GitHub Desktop.
//
// ContentView.swift
// Shared
//
// Created by Bernstein, Joel on 7/15/20.
//
import SwiftUI
struct ContentView: View {
@State private var items = ["Lorem", "ipsum", "dolor", "sit", "amet", "consectetur",
"adipiscing", "elit", "sed", "do", "eiusmod", "tempor",
"incididunt", "ut", "labore", "et", "dolore", "magna", "aliqua"]
@State private var selectedItems = Set<String>()
var body: some View
{
NavigationView
{
List(selection: $selectedItems)
{
ForEach(items, id: \.self)
{
Text($0)
}
.onDelete { items.remove(atOffsets: $0) }
}
.listStyle(PlainListStyle())
.navigationTitle("Lipsum")
.navigationBarItems(trailing: EditButton())
}
}
}
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