| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import SwiftUI
- import Swinject
- extension CGM {
- struct RootView: BaseView {
- let resolver: Resolver
- @StateObject var state = StateModel()
- var body: some View {
- Form {
- Section {
- Picker("Type", selection: $state.cgm) {
- ForEach(CGMType.allCases) {
- Text($0.displayName).tag($0)
- }
- }
- }
- if [.dexcomG5, .dexcomG6].contains(state.cgm) {
- Section(header: Text("Transmitter ID")) {
- TextField("XXXXXX", text: $state.transmitterID, onCommit: {
- UIApplication.shared.endEditing()
- state.onChangeID()
- })
- .disableAutocorrection(true)
- .autocapitalization(.allCharacters)
- .keyboardType(.asciiCapable)
- }
- .onDisappear {
- state.onChangeID()
- }
- }
- Section(header: Text("Other")) {
- Toggle("Upload glucose to Nightscout", isOn: $state.uploadGlucose)
- }
- }
- .onAppear(perform: configureView)
- .navigationTitle("CGM")
- .navigationBarTitleDisplayMode(.automatic)
- }
- }
- }
|