-
Notifications
You must be signed in to change notification settings - Fork 0
/
LoginView.swift
31 lines (28 loc) · 925 Bytes
/
LoginView.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import SwiftUI
struct LoginView: View {
@Binding var isShowingLogin: Bool
@ObservedObject var pandoraAPI: PandoraAPI
@State private var username = ""
@State private var password = ""
var body: some View {
VStack {
TextField("Username", text: $username)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
SecureField("Password", text: $password)
.textFieldStyle(RoundedBorderTextFieldStyle())
.padding()
Button("Log In") {
pandoraAPI.login(username: username, password: password) { success in
if success {
isShowingLogin = false
} else {
// Handle login failure
}
}
}
.padding()
}
.padding()
}
}