GarminConfigRootView.swift 856 B

12345678910111213141516171819202122232425262728293031
  1. import SwiftUI
  2. import Swinject
  3. extension GarminConfig {
  4. struct RootView: BaseView {
  5. let resolver: Resolver
  6. @StateObject var state = StateModel()
  7. var body: some View {
  8. Form {
  9. Section {
  10. Button("Select devices") {
  11. state.selectDevices()
  12. }
  13. }
  14. if state.devices.isNotEmpty {
  15. Section(header: Text("Connected devices")) {
  16. ForEach(state.devices, id: \.uuid) { device in
  17. Text(device.friendlyName)
  18. }
  19. }
  20. }
  21. }
  22. .onAppear(perform: configureView)
  23. .navigationTitle("Garmin Watch")
  24. .navigationBarTitleDisplayMode(.automatic)
  25. }
  26. }
  27. }