Remove one tag

This commit is contained in:
Max Goedjen 2020-03-07 13:43:57 -08:00
parent 9a40c8ea7e
commit fb752240b5
No known key found for this signature in database
GPG Key ID: E58C21DD77B9B8E8

View File

@ -4,28 +4,27 @@ import SecretKit
struct ContentView: View { struct ContentView: View {
@ObservedObject var store: SecureEnclave.Store @ObservedObject var store: SecureEnclave.Store
@State var active: SecureEnclave.Secret? @State var active: SecureEnclave.Secret.ID?
@State var showingDeletion = false @State var showingDeletion = false
@State var deletingSecret: SecureEnclave.Secret? @State var deletingSecret: SecureEnclave.Secret?
var body: some View { var body: some View {
NavigationView { NavigationView {
List(selection: self.$active) { List(selection: $active) {
Section(header: Text(store.name)) { Section(header: Text(store.name)) {
ForEach(store.secrets) { secret in ForEach(store.secrets) { secret in
NavigationLink(destination: SecretDetailView(secret: secret), tag: secret, selection: self.$active) { NavigationLink(destination: SecretDetailView(secret: secret), tag: secret.id, selection: self.$active) {
Text(secret.name) Text(secret.name)
}.contextMenu { }.contextMenu {
Button(action: { self.delete(secret: secret) }) { Button(action: { self.delete(secret: secret) }) {
Text("Delete") Text("Delete")
} }
} }
.tag(secret)
} }
} }
}.onAppear { }.onAppear {
self.active = self.store.secrets.first self.active = self.store.secrets.first?.id
} }
.listStyle(SidebarListStyle()) .listStyle(SidebarListStyle())
.frame(minWidth: 100, idealWidth: 240) .frame(minWidth: 100, idealWidth: 240)