AppleHealthKitRootView.swift 929 B

12345678910111213141516171819202122232425262728
  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. if state.needShowInformationTextForSetPermissions {
  12. HStack {
  13. Image(systemName: "exclamationmark.circle.fill")
  14. Text("For write data to Apple Health you must give permissions in Settings > Health > Data Access")
  15. .font(.caption)
  16. }
  17. }
  18. }
  19. }
  20. .onAppear(perform: configureView)
  21. .navigationTitle("Apple Health")
  22. .navigationBarTitleDisplayMode(.automatic)
  23. }
  24. }
  25. }