DexcomSettingsView.swift 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. // LoopFollow
  2. // DexcomSettingsView.swift
  3. import SwiftUI
  4. struct DexcomSettingsView: View {
  5. @ObservedObject var viewModel: DexcomSettingsViewModel
  6. var body: some View {
  7. NavigationView {
  8. Form {
  9. Section(header: Text("Dexcom Settings")) {
  10. HStack {
  11. Text("User Name")
  12. TextField("Enter User Name", text: $viewModel.userName)
  13. .autocapitalization(.none)
  14. .disableAutocorrection(true)
  15. .multilineTextAlignment(.trailing)
  16. }
  17. HStack {
  18. Text("Password")
  19. TogglableSecureInput(
  20. placeholder: "Enter Password",
  21. text: $viewModel.password,
  22. style: .singleLine
  23. )
  24. }
  25. Picker("Server", selection: $viewModel.server) {
  26. Text("US").tag("US")
  27. Text("NON-US").tag("NON-US")
  28. }
  29. .pickerStyle(SegmentedPickerStyle())
  30. }
  31. importSection
  32. }
  33. }
  34. .preferredColorScheme(Storage.shared.forceDarkMode.value ? .dark : nil)
  35. .navigationBarTitle("Dexcom Settings", displayMode: .inline)
  36. }
  37. private var importSection: some View {
  38. Section(header: Text("Import Settings")) {
  39. NavigationLink(destination: ImportExportSettingsView()) {
  40. HStack {
  41. Image(systemName: "square.and.arrow.down")
  42. .foregroundColor(.blue)
  43. Text("Import Settings from QR Code or iCloud")
  44. }
  45. }
  46. }
  47. }
  48. }