diff --git a/Shared/Navigation/ContentView.swift b/Shared/Navigation/ContentView.swift index aff477e..04223a3 100644 --- a/Shared/Navigation/ContentView.swift +++ b/Shared/Navigation/ContentView.swift @@ -1,27 +1,27 @@ import SwiftUI struct ContentView: View { @ObservedObject var postStore: PostStore @State private var selectedCollection: PostCollection? = allPostsCollection var body: some View { NavigationView { - CollectionSidebar(selectedCollection: $selectedCollection) + CollectionSidebar() PostList( title: selectedCollection?.title ?? allPostsCollection.title, posts: showPosts(for: selectedCollection ?? allPostsCollection) ) Text("Select a post, or create a new draft.") .foregroundColor(.secondary) } .environmentObject(postStore) } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView(postStore: testPostStore) } } diff --git a/Shared/PostCollection/CollectionSidebar.swift b/Shared/PostCollection/CollectionSidebar.swift index faaf62f..e3808d7 100644 --- a/Shared/PostCollection/CollectionSidebar.swift +++ b/Shared/PostCollection/CollectionSidebar.swift @@ -1,24 +1,22 @@ import SwiftUI struct CollectionSidebar: View { - @Binding var selectedCollection: PostCollection? - 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()) } struct CollectionSidebar_Previews: PreviewProvider { static var previews: some View { CollectionSidebar() } }