HomeRootView.swift 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import SwiftUI
  2. extension Home {
  3. struct RootView: BaseView {
  4. @EnvironmentObject var viewModel: ViewModel<Provider>
  5. var body: some View {
  6. VStack {
  7. Spacer()
  8. Button(action: viewModel.addCarbs) {
  9. Text("Add carbs")
  10. .frame(maxWidth: .infinity)
  11. .foregroundColor(.white)
  12. .buttonBackground()
  13. }
  14. Button(action: viewModel.addHighTempTarget) {
  15. Text("Temp target 7.0 mmol/L for 10 min")
  16. .frame(maxWidth: .infinity)
  17. .foregroundColor(.white)
  18. .buttonBackground()
  19. }
  20. Button(action: viewModel.addLowTempTarget) {
  21. Text("Temp target 4.5 mmol/L for 10 min")
  22. .frame(maxWidth: .infinity)
  23. .foregroundColor(.white)
  24. .buttonBackground()
  25. }
  26. Button(action: viewModel.runLoop) {
  27. Text("Run loop")
  28. .frame(maxWidth: .infinity)
  29. .foregroundColor(.white)
  30. .buttonBackground()
  31. }
  32. Spacer()
  33. }
  34. .padding()
  35. .navigationTitle("Home")
  36. .navigationBarTitleDisplayMode(.automatic)
  37. }
  38. }
  39. }