Started AddAccountDialog

This commit is contained in:
dankito 2020-07-06 23:55:33 +02:00
parent c443cd184b
commit afc8ce9ee9
7 changed files with 110 additions and 3 deletions

View File

@ -0,0 +1,9 @@
"Add" = "Add";
"Accounts" = "Accounts";
"Add account" = "Add account";
"Bank code" = "Bank code";
"Customer ID" = "Online banking login name";
"Password" = "Online banking password";

View File

@ -6,12 +6,11 @@ struct ContentView: View {
var body: some View { var body: some View {
TabView(selection: $selection){ TabView(selection: $selection){
Text("First View") AccountsTab()
.font(.title)
.tabItem { .tabItem {
VStack { VStack {
Image("first") Image("first")
Text("First") Text("Accounts")
} }
} }
.tag(0) .tag(0)

View File

@ -66,5 +66,9 @@
<string>UIInterfaceOrientationLandscapeLeft</string> <string>UIInterfaceOrientationLandscapeLeft</string>
<string>UIInterfaceOrientationLandscapeRight</string> <string>UIInterfaceOrientationLandscapeRight</string>
</array> </array>
<key>UTImportedTypeDeclarations</key>
<array>
<dict/>
</array>
</dict> </dict>
</plist> </plist>

View File

@ -0,0 +1,9 @@
"Add" = "Hinzufügen";
"Accounts" = "Konten";
"Add account" = "Konto hinzufügen";
"Bank code" = "Bankleitzahl";
"Customer ID" = "Onlinebanking Login Name";
"Password" = "Online banking password";

View File

@ -0,0 +1,13 @@
import SwiftUI
extension View {
func hideNavigationBar() -> some View {
return self
.navigationBarHidden(true)
.navigationBarTitle("Title")
}
}

View File

@ -0,0 +1,20 @@
import SwiftUI
struct AccountsTab: View {
var body: some View {
NavigationView {
NavigationLink(destination: AddAccountDialog()) {
Text("Add account")
}
}
.navigationBarHidden(true)
}
}
struct AccountsTab_Previews: PreviewProvider {
static var previews: some View {
AccountsTab()
}
}

View File

@ -0,0 +1,53 @@
import SwiftUI
struct AddAccountDialog: View {
@State private var bankCode = ""
@State private var customerId = ""
@State private var password = ""
var body: some View {
NavigationView {
Form {
Section {
TextField("Bank code", text: $bankCode)
}
Section {
TextField("Customer ID", text: $customerId)
SecureField("Password", text: $password)
}
Section {
HStack {
Spacer()
Button(action: { self.addAccount() },
label: { Text("Add") })
.disabled(!self.isRequiredDataEntered())
Spacer()
}
}
}
.hideNavigationBar()
}
}
func isRequiredDataEntered() -> Bool {
return bankCode.isEmpty == false
&& customerId.isEmpty == false
&& password.isEmpty == false
}
func addAccount() {
}
}
struct AddAccountDialog_Previews: PreviewProvider {
static var previews: some View {
AddAccountDialog()
}
}