PostList count should be text, not a button, in iOS bottom toolbar

This commit is contained in:
Angelo Stavrow 2020-08-11 10:51:50 -04:00
parent 275dd91e9c
commit f646cf9eae
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 43 additions and 40 deletions

View File

@ -7,47 +7,50 @@ struct PostList: View {
var body: some View {
#if os(iOS)
List {
ForEach(showPosts(for: selectedCollection)) { post in
NavigationLink(
destination: PostEditor(post: post)
) {
PostCell(
post: post
)
GeometryReader { geometry in
List {
ForEach(showPosts(for: selectedCollection)) { post in
NavigationLink(
destination: PostEditor(post: post)
) {
PostCell(
post: post
)
}
}
}
}
.navigationTitle(selectedCollection.title)
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button(action: {
let post = Post()
postStore.add(post)
}, label: {
Image(systemName: "square.and.pencil")
})
}
ToolbarItem(placement: .bottomBar) {
Button(action: {
isPresentingSettings = true
}, label: {
Image(systemName: "gear")
}).sheet(
isPresented: $isPresentingSettings,
onDismiss: {
isPresentingSettings = false
},
content: {
SettingsView(isPresented: $isPresentingSettings)
.navigationTitle(selectedCollection.title)
.toolbar {
ToolbarItem(placement: .primaryAction) {
Button(action: {
let post = Post()
postStore.add(post)
}, label: {
Image(systemName: "square.and.pencil")
})
}
ToolbarItem(placement: .bottomBar) {
HStack {
Button(action: {
isPresentingSettings = true
}, label: {
Image(systemName: "gear")
}).sheet(
isPresented: $isPresentingSettings,
onDismiss: {
isPresentingSettings = false
},
content: {
SettingsView(isPresented: $isPresentingSettings)
}
)
Spacer()
Text(pluralizedPostCount(for: showPosts(for: selectedCollection)))
.foregroundColor(.secondary)
}
)
}
ToolbarItem(placement: .bottomBar) {
Spacer()
}
ToolbarItem(placement: .bottomBar) {
Text(pluralizedPostCount(for: showPosts(for: selectedCollection)))
.padding()
.frame(width: geometry.size.width)
}
}
}
#else //if os(macOS)

View File

@ -7,12 +7,12 @@
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>0</integer>
<integer>1</integer>
</dict>
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
<dict>
<key>orderHint</key>
<integer>1</integer>
<integer>0</integer>
</dict>
</dict>
</dict>