mirror of
https://github.com/maxgoedjen/secretive.git
synced 2024-11-24 22:47:06 +00:00
Select default
This commit is contained in:
parent
f60e7c79f2
commit
b1091904ed
@ -4,13 +4,14 @@ import SecretKit
|
|||||||
struct ContentView<StoreType: SecretStore>: View {
|
struct ContentView<StoreType: SecretStore>: View {
|
||||||
|
|
||||||
@ObservedObject var store: StoreType
|
@ObservedObject var store: StoreType
|
||||||
|
@State var active: StoreType.SecretType?
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
NavigationView {
|
NavigationView {
|
||||||
List {
|
List {
|
||||||
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)) {
|
NavigationLink(destination: SecretDetailView(secret: secret), tag: secret, selection: self.$active) {
|
||||||
Text(secret.name)
|
Text(secret.name)
|
||||||
}.contextMenu {
|
}.contextMenu {
|
||||||
Button(action: { self.delete(secret: secret) }) {
|
Button(action: { self.delete(secret: secret) }) {
|
||||||
@ -19,10 +20,14 @@ struct ContentView<StoreType: SecretStore>: View {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}.onAppear {
|
||||||
|
self.active = self.store.secrets.first
|
||||||
}
|
}
|
||||||
.listStyle(SidebarListStyle())
|
.listStyle(SidebarListStyle())
|
||||||
.frame(minWidth: 100, idealWidth: 240)
|
.frame(minWidth: 100, idealWidth: 240)
|
||||||
}.navigationViewStyle(DoubleColumnNavigationViewStyle())
|
}
|
||||||
|
.navigationViewStyle(DoubleColumnNavigationViewStyle())
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user