Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F13893300
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
View Options
diff --git a/Shared/PostCollection/CollectionSidebar.swift b/Shared/PostCollection/CollectionSidebar.swift
index 37d64ee..4cba6db 100644
--- a/Shared/PostCollection/CollectionSidebar.swift
+++ b/Shared/PostCollection/CollectionSidebar.swift
@@ -1,36 +1,30 @@
import SwiftUI
struct CollectionSidebar: View {
@EnvironmentObject var postStore: PostStore
@Binding var selectedCollection: PostCollection?
- private let collections = [
- allPostsCollection,
- defaultDraftCollection,
- testPostCollection1,
- testPostCollection2,
- testPostCollection3
- ]
+ private let collections = postCollections
var body: some View {
List {
ForEach(collections) { collection in
NavigationLink(
destination: PostList(title: collection.title, posts: showPosts(for: collection)).tag(collection)) {
Text(collection.title)
}
}
}
.listStyle(SidebarListStyle())
}
func showPosts(for collection: PostCollection) -> [Post] {
if collection == allPostsCollection {
return postStore.posts
} else {
return postStore.posts.filter {
$0.collection.title == collection.title
}
}
}
}
diff --git a/Shared/PostCollection/PostCollection.swift b/Shared/PostCollection/PostCollection.swift
index 0b2b57c..a55b395 100644
--- a/Shared/PostCollection/PostCollection.swift
+++ b/Shared/PostCollection/PostCollection.swift
@@ -1,12 +1,22 @@
import Foundation
struct PostCollection: Identifiable, Hashable {
let id = UUID()
let title: String
}
let allPostsCollection = PostCollection(title: "All Posts")
let defaultDraftCollection = PostCollection(title: "Drafts")
-let testPostCollection1 = PostCollection(title: "Collection 1")
-let testPostCollection2 = PostCollection(title: "Collection 2")
-let testPostCollection3 = PostCollection(title: "Collection 3")
+let userCollections = [
+ PostCollection(title: "Collection 1"),
+ PostCollection(title: "Collection 2"),
+ PostCollection(title: "Collection 3")
+]
+
+let postCollections = [
+ allPostsCollection,
+ defaultDraftCollection,
+ userCollections[0],
+ userCollections[1],
+ userCollections[2]
+]
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Mar 12, 2:52 PM (1 d, 13 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3653537
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment