diff --git a/iOS/Settings/SettingsHeaderView.swift b/iOS/Settings/SettingsHeaderView.swift index 75121d7..9177ec4 100644 --- a/iOS/Settings/SettingsHeaderView.swift +++ b/iOS/Settings/SettingsHeaderView.swift @@ -1,26 +1,26 @@ import SwiftUI struct SettingsHeaderView: View { - @Binding var isPresented: Bool + @Environment(\.presentationMode) var presentationMode var body: some View { HStack { Text("Settings") .font(.largeTitle) .fontWeight(.bold) Spacer() Button(action: { - isPresented = false + presentationMode.wrappedValue.dismiss() }, label: { Image(systemName: "xmark.circle") }) } .padding() } } struct SettingsHeaderView_Previews: PreviewProvider { static var previews: some View { - SettingsHeaderView(isPresented: .constant(true)) + SettingsHeaderView() } } diff --git a/iOS/Settings/SettingsView.swift b/iOS/Settings/SettingsView.swift index c4718c5..f6b60fc 100644 --- a/iOS/Settings/SettingsView.swift +++ b/iOS/Settings/SettingsView.swift @@ -1,29 +1,27 @@ import SwiftUI struct SettingsView: View { @EnvironmentObject var model: WriteFreelyModel - @Binding var isPresented: Bool - var body: some View { VStack { - SettingsHeaderView(isPresented: $isPresented) + SettingsHeaderView() Form { Section(header: Text("Login Details")) { AccountView() } Section(header: Text("Appearance")) { PreferencesView(preferences: model.preferences) } } } // .preferredColorScheme(preferences.selectedColorScheme) // See PreferencesModel for info. } } struct SettingsView_Previews: PreviewProvider { static var previews: some View { - SettingsView(isPresented: .constant(true)) + SettingsView() .environmentObject(WriteFreelyModel()) } }