This repository has been archived by the owner on Apr 10, 2020. It is now read-only.
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
Stormacq, Sebastien
committed
Oct 28, 2019
1 parent
ad6b3ea
commit bf43285
Showing
3 changed files
with
76 additions
and
10 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
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,56 @@ | ||
import SwiftUI | ||
|
||
struct CustomLoginView : View { | ||
|
||
@State private var username: String = "" | ||
@State private var password: String = "" | ||
|
||
private let app = UIApplication.shared.delegate as! AppDelegate | ||
|
||
var body: some View { // The body of the screen view | ||
VStack { | ||
Image("turtlerock") | ||
.resizable() | ||
.aspectRatio(contentMode: ContentMode.fit) | ||
.padding(Edge.Set.bottom, 20) | ||
|
||
Text(verbatim: "Login").bold().font(.title) | ||
|
||
Text(verbatim: "Explore Landmarks of the world") | ||
.font(.subheadline) | ||
.padding(EdgeInsets(top: 0, leading: 0, bottom: 70, trailing: 0)) | ||
|
||
TextField("Username", text: $username) | ||
.autocapitalization(.none) //avoid autocapitalization of the first letter | ||
.padding() | ||
.cornerRadius(4.0) | ||
.background(Color(UIColor.systemFill)) | ||
.padding(EdgeInsets(top: 0, leading: 0, bottom: 15, trailing: 0)) | ||
|
||
SecureField("Password", text: $password) | ||
.padding() | ||
.cornerRadius(4.0) | ||
.background(Color(UIColor.systemFill)) | ||
.padding(.bottom, 10) | ||
|
||
Button(action: { self.app.signIn(username: self.username, password: self.password) }) { | ||
HStack() { | ||
Spacer() | ||
Text("Signin") | ||
.foregroundColor(Color.white) | ||
.bold() | ||
Spacer() | ||
} | ||
|
||
}.padding().background(Color.green).cornerRadius(4.0) | ||
}.padding() | ||
} | ||
} | ||
|
||
#if DEBUG | ||
struct ContentView_Previews : PreviewProvider { | ||
static var previews: some View { | ||
CustomLoginView() // Renders your UI View on the XCode preview | ||
} | ||
} | ||
#endif |
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