Skip to content

Commit 6ea10fb

Browse files
committed
Move sheet modifier outside of NavigationView
1 parent 322e9e9 commit 6ea10fb

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

Shared/Navigation/ContentView.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ struct ContentView: View {
1313
.foregroundColor(.secondary)
1414
}
1515
.environmentObject(model)
16+
17+
#if os(iOS)
18+
EmptyView()
19+
.sheet(
20+
isPresented: $model.isPresentingSettingsView,
21+
onDismiss: { model.isPresentingSettingsView = false },
22+
content: {
23+
SettingsView()
24+
.environmentObject(model)
25+
}
26+
)
27+
#endif
1628
}
1729
}
1830

Shared/PostList/PostListView.swift

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ struct PostListView: View {
77
@State var selectedCollection: WFACollection?
88
@State var showAllPosts: Bool = false
99

10-
#if os(iOS)
11-
@State private var isPresentingSettings = false
12-
#endif
13-
1410
var body: some View {
1511
#if os(iOS)
1612
GeometryReader { geometry in
@@ -31,18 +27,10 @@ struct PostListView: View {
3127
ToolbarItem(placement: .bottomBar) {
3228
HStack {
3329
Button(action: {
34-
isPresentingSettings = true
30+
model.isPresentingSettingsView = true
3531
}, label: {
3632
Image(systemName: "gear")
37-
}).sheet(
38-
isPresented: $isPresentingSettings,
39-
onDismiss: {
40-
isPresentingSettings = false
41-
},
42-
content: {
43-
SettingsView(isPresented: $isPresentingSettings)
44-
}
45-
)
33+
})
4634
.padding(.leading)
4735
Spacer()
4836
Text(pluralizedPostCount(for: showPosts(for: selectedCollection)))

0 commit comments

Comments
 (0)