-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
81 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,5 @@ | |
.externalNativeBuild | ||
.cxx | ||
local.properties | ||
Pods/ | ||
Pods/ | ||
*.xcuserdatad/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
iosApp/iosApp.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>IDEDidComputeMac32BitWarning</key> | ||
<true/> | ||
</dict> | ||
</plist> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// | ||
// LoginScreen.swift | ||
// iosApp | ||
// | ||
// Created by Aleksey Mikhailov on 30.04.2022. | ||
// Copyright © 2022 orgName. All rights reserved. | ||
// | ||
|
||
import SwiftUI | ||
|
||
struct LoginScreen: View { | ||
@State private var login: String = "" | ||
@State private var password: String = "" | ||
@State private var isLoading: Bool = false | ||
@State private var isSuccessfulAlertShowed: Bool = false | ||
|
||
private var isButtonEnabled: Bool { | ||
get { | ||
!isLoading && !login.isEmpty && !password.isEmpty | ||
} | ||
} | ||
|
||
var body: some View { | ||
Group { | ||
VStack(spacing: 8.0) { | ||
TextField("Login", text: $login) | ||
.textFieldStyle(.roundedBorder) | ||
.disabled(isLoading) | ||
|
||
SecureField("Password", text: $password) | ||
.textFieldStyle(.roundedBorder) | ||
.disabled(isLoading) | ||
|
||
Button( | ||
action: { | ||
isLoading = true | ||
DispatchQueue.main.asyncAfter(deadline: .now() + 1) { | ||
isLoading = false | ||
isSuccessfulAlertShowed = true | ||
} | ||
}, label: { | ||
if isLoading { | ||
ProgressView() | ||
} else { | ||
Text("Login") | ||
} | ||
} | ||
).disabled(!isButtonEnabled) | ||
}.padding() | ||
}.alert( | ||
"Login successful", | ||
isPresented: $isSuccessfulAlertShowed | ||
) { | ||
Button("Close", action: { isSuccessfulAlertShowed = false }) | ||
} | ||
} | ||
} | ||
|
||
struct LoginScreen_Previews: PreviewProvider { | ||
static var previews: some View { | ||
LoginScreen() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import SwiftUI | |
struct iOSApp: App { | ||
var body: some Scene { | ||
WindowGroup { | ||
ContentView() | ||
LoginScreen() | ||
} | ||
} | ||
} | ||
} |