AppleHealthKitRootView.swift 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import SwiftUI
  2. import Swinject
  3. extension AppleHealthKit {
  4. struct RootView: BaseView {
  5. let resolver: Resolver
  6. @StateObject var state = StateModel()
  7. var body: some View {
  8. Form {
  9. Section {
  10. Toggle("Connect to Apple Health", isOn: $state.useAppleHealth)
  11. HStack {
  12. Image(systemName: "pencil.circle.fill")
  13. Text(
  14. "After you create glucose records in the Health app, please open FreeAPS X to help us guaranteed transfer changed data"
  15. )
  16. .font(.caption)
  17. }
  18. .foregroundColor(Color.secondary)
  19. if state.needShowInformationTextForSetPermissions {
  20. HStack {
  21. Image(systemName: "exclamationmark.circle.fill")
  22. Text("For write data to Apple Health you must give permissions in Settings > Health > Data Access")
  23. .font(.caption)
  24. }
  25. .foregroundColor(Color.secondary)
  26. }
  27. }
  28. }
  29. .onAppear(perform: configureView)
  30. .navigationTitle("Apple Health")
  31. .navigationBarTitleDisplayMode(.automatic)
  32. }
  33. }
  34. }