Dismiss view after adding account or canceling.

This commit is contained in:
Maurice Parker 2019-06-12 03:08:51 -05:00
parent 902304c723
commit 50ab15f2cc
1 changed files with 10 additions and 2 deletions

View File

@ -11,7 +11,8 @@ import Account
struct SettingsLocalAccountView : View {
@State var name: String
@Environment(\.isPresented) private var isPresented
var body: some View {
NavigationView {
List {
@ -36,13 +37,20 @@ struct SettingsLocalAccountView : View {
}
.listStyle(.grouped)
.navigationBarTitle(Text(""), displayMode: .inline)
.navigationBarItems(trailing: Button(action: { self.dismiss() }) { Text("Cancel") } )
}
}
func addAccount() {
private func addAccount() {
let account = AccountManager.shared.createAccount(type: .onMyMac)
account.name = name
dismiss()
}
private func dismiss() {
isPresented?.value = false
}
}
#if DEBUG