DexcomSettingsView.swift 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. //
  2. // DexcomSettingsView.swift
  3. // LoopFollow
  4. //
  5. // Created by Jonas Björkert on 2025-01-18.
  6. // Copyright © 2025 Jon Fawcett. All rights reserved.
  7. //
  8. import SwiftUI
  9. struct DexcomSettingsView: View {
  10. @ObservedObject var viewModel: DexcomSettingsViewModel
  11. @Environment(\.presentationMode) var presentationMode
  12. var body: some View {
  13. NavigationView {
  14. Form {
  15. Section(header: Text("Dexcom Settings")) {
  16. TextField("User Name", text: $viewModel.userName)
  17. .autocapitalization(.none)
  18. .disableAutocorrection(true)
  19. TextField("Password", text: $viewModel.password)
  20. .autocapitalization(.none)
  21. .disableAutocorrection(true)
  22. Picker("Server", selection: $viewModel.server) {
  23. Text("US").tag("US")
  24. Text("NON-US").tag("NON-US")
  25. }
  26. .pickerStyle(SegmentedPickerStyle())
  27. }
  28. }
  29. .navigationBarTitle("Dexcom Settings", displayMode: .inline)
  30. .toolbar {
  31. ToolbarItem(placement: .navigationBarTrailing) {
  32. Button("Done") {
  33. presentationMode.wrappedValue.dismiss()
  34. }
  35. }
  36. }
  37. }
  38. }
  39. }