Page MenuHomeMusing Studio

No OneTemporary

diff --git a/Shared/Post/PostList.swift b/Shared/Post/PostList.swift
index 2682b9f..ab4102c 100644
--- a/Shared/Post/PostList.swift
+++ b/Shared/Post/PostList.swift
@@ -1,104 +1,107 @@
import SwiftUI
struct PostList: View {
@EnvironmentObject var postStore: PostStore
@State var selectedCollection: PostCollection
@State var isPresentingSettings = false
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)
List {
ForEach(showPosts(for: selectedCollection)) { post in
NavigationLink(
destination: PostEditor(post: post)
) {
PostCell(
post: post
)
}
}
}
.navigationTitle(selectedCollection.title)
.navigationSubtitle(pluralizedPostCount(for: showPosts(for: selectedCollection)))
.toolbar {
Button(action: {
let post = Post()
postStore.add(post)
}, label: {
Image(systemName: "square.and.pencil")
})
}
#endif
}
private func pluralizedPostCount(for posts: [Post]) -> String {
if posts.count == 1 {
return "1 post"
} else {
return "\(posts.count) posts"
}
}
private func showPosts(for collection: PostCollection) -> [Post] {
if collection == allPostsCollection {
return postStore.posts
} else {
return postStore.posts.filter {
$0.collection.title == collection.title
}
}
}
}
struct PostList_Previews: PreviewProvider {
static var previews: some View {
Group {
PostList(selectedCollection: allPostsCollection)
.environmentObject(testPostStore)
}
}
}
diff --git a/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist b/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
index 2723ebe..6cd8075 100644
--- a/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
+++ b/WriteFreely-MultiPlatform.xcodeproj/xcuserdata/angelo.xcuserdatad/xcschemes/xcschememanagement.plist
@@ -1,19 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>SchemeUserState</key>
<dict>
<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>
</plist>

File Metadata

Mime Type
text/x-diff
Expires
Fri, May 16, 10:24 AM (1 d, 11 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3240043

Event Timeline