LoginView.swift 781 B

12345678910111213141516171819202122232425262728293031323334
  1. //
  2. // LoginView.swift
  3. // Chat
  4. //
  5. // Created by Sergey Tarasov on 25.07.2022.
  6. //
  7. import SwiftUI
  8. struct LoginView: View {
  9. @ObservedObject var store: LoginStore
  10. var body: some View {
  11. VStack(alignment: .center, spacing: 16) {
  12. TextField("Login", text: $store.login)
  13. .textFieldStyle(.roundedBorder)
  14. SecureField("Password", text: $store.password)
  15. .textFieldStyle(.roundedBorder)
  16. .textContentType(.password)
  17. Button(action: store.submit) {
  18. Text("Login")
  19. }
  20. }
  21. .padding()
  22. }
  23. }
  24. struct LoginView_Previews: PreviewProvider {
  25. static var store: LoginStore = LoginStore()
  26. static var previews: some View {
  27. LoginView(store: store)
  28. }
  29. }