Move sheet modifier outside of NavigationView

This commit is contained in:
Angelo Stavrow 2020-09-11 13:55:29 -04:00
parent 322e9e9af5
commit 6ea10fb434
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 14 additions and 14 deletions

View File

@ -13,6 +13,18 @@ struct ContentView: View {
.foregroundColor(.secondary)
}
.environmentObject(model)
#if os(iOS)
EmptyView()
.sheet(
isPresented: $model.isPresentingSettingsView,
onDismiss: { model.isPresentingSettingsView = false },
content: {
SettingsView()
.environmentObject(model)
}
)
#endif
}
}

View File

@ -7,10 +7,6 @@ struct PostListView: View {
@State var selectedCollection: WFACollection?
@State var showAllPosts: Bool = false
#if os(iOS)
@State private var isPresentingSettings = false
#endif
var body: some View {
#if os(iOS)
GeometryReader { geometry in
@ -31,18 +27,10 @@ struct PostListView: View {
ToolbarItem(placement: .bottomBar) {
HStack {
Button(action: {
isPresentingSettings = true
model.isPresentingSettingsView = true
}, label: {
Image(systemName: "gear")
}).sheet(
isPresented: $isPresentingSettings,
onDismiss: {
isPresentingSettings = false
},
content: {
SettingsView(isPresented: $isPresentingSettings)
}
)
})
.padding(.leading)
Spacer()
Text(pluralizedPostCount(for: showPosts(for: selectedCollection)))