Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
SwiftUI login page generated by ChatGPT
struct LoginPage: View {
@State private var username: String = ""
@State private var password: String = ""
var body: some View {
VStack {
Image("your_image_name_here")
.resizable()
.frame(width: 300, height: 300)
.padding(.top, 20)
.padding(.bottom, 20)
.offset(y: -20)
VStack(spacing: 20) {
TextField("Username", text: $username)
.padding(.horizontal, 20)
.frame(height: 44)
.background(Color.white)
.cornerRadius(8)
SecureField("Password", text: $password)
.padding(.horizontal, 20)
.frame(height: 44)
.background(Color.white)
.cornerRadius(8)
Spacer()
Button(action: {
// Your login action here
}) {
Text("Login")
.frame(maxWidth: .infinity)
.frame(height: 44)
.background(Color.blue)
.foregroundColor(.white)
.cornerRadius(8)
.padding(.horizontal, 20)
}
.padding(.bottom, 100)
}
.padding(.horizontal, 20)
Spacer()
}
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
LoginPage()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment