AppleHealthKitRootView.swift 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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. HStack {
  11. Image(systemName: "exclamationmark.triangle")
  12. Text(
  13. "Connecting to Apple Health will use an excessive amount of storage and may cause Apple Health to lag. This will be improved in a future release."
  14. )
  15. .font(.caption)
  16. }
  17. .foregroundColor(Color.secondary)
  18. Toggle("Connect to Apple Health", isOn: $state.useAppleHealth)
  19. HStack {
  20. Image(systemName: "pencil.circle.fill")
  21. Text(
  22. "This allows Trio to read from and write to Apple Heath. You must also give permissions in Settings > Health > Data Access. If you enter a glucose value into Apple Health, open Trio to confirm it shows up."
  23. )
  24. .font(.caption)
  25. }
  26. .foregroundColor(Color.secondary)
  27. if state.needShowInformationTextForSetPermissions {
  28. HStack {
  29. Image(systemName: "exclamationmark.circle.fill")
  30. Text("For write data to Apple Health you must give permissions in Settings > Health > Data Access")
  31. .font(.caption)
  32. }
  33. .foregroundColor(Color.secondary)
  34. }
  35. }
  36. }
  37. .onAppear(perform: configureView)
  38. .navigationTitle("Apple Health")
  39. .navigationBarTitleDisplayMode(.automatic)
  40. }
  41. }
  42. }