HomeRootView.swift 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. import SwiftUI
  2. extension Home {
  3. struct RootView: BaseView {
  4. @EnvironmentObject var viewModel: ViewModel<Provider>
  5. var body: some View {
  6. Form {
  7. GlucoseChartView(glucose: $viewModel.glucose, suggestion: $viewModel.suggestion).frame(height: 150)
  8. if let reason = viewModel.suggestion?.reason {
  9. Text(reason).font(.caption)
  10. }
  11. Button(action: viewModel.addCarbs) {
  12. Text("Add carbs")
  13. }
  14. Button(action: viewModel.addTempTarget) {
  15. Text("Add temp target")
  16. }
  17. Button(action: viewModel.bolus) {
  18. Text("Bolus")
  19. }
  20. Button(action: viewModel.manualTampBasal) {
  21. Text("Manual temp basal")
  22. }
  23. Button(action: viewModel.runLoop) {
  24. Text("Run loop now")
  25. }
  26. }
  27. .navigationTitle("Home")
  28. .navigationBarHidden(true)
  29. }
  30. }
  31. }