ProfileHost.swift


  1. import SwiftUI
  2. struct ProfileHost: View {
  3. @Environment(\.editMode) var editMode
  4. @EnvironmentObject var modelData: ModelData
  5. @State private var draftProfile = Profile.default
  6. var body: some View {
  7. VStack(alignment: .leading, spacing: 20) {
  8. HStack {
  9. Spacer()
  10. EditButton()
  11. }
  12. EditButton()
  13. }
  14. if editMode?.wrappedValue == .inactive {
  15. ProfileSummary(profile: modelData.profile)
  16. } else {
  17. Text("Profile Editor")
  18. }
  19. }
  20. .padding()
  21. }
  22. }
  23. struct ProfileHost_Previews: PreviewProvider {
  24. static var previews: some View {
  25. ProfileHost()
  26. .environmentObject(ModelData())
  27. }
  28. }