Page Menu
Home
Musing Studio
Search
Configure Global Search
Log In
Files
F10494289
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
View Options
diff --git a/Shared/Navigation/ContentView.swift b/Shared/Navigation/ContentView.swift
index c67efba..7eeea9f 100644
--- a/Shared/Navigation/ContentView.swift
+++ b/Shared/Navigation/ContentView.swift
@@ -1,28 +1,28 @@
import SwiftUI
struct ContentView: View {
@ObservedObject var postStore: PostStore
var body: some View {
NavigationView {
- PostList(postStore: postStore)
+ PostList()
.frame(maxHeight: .infinity)
.navigationTitle("Posts")
.toolbar {
NavigationLink(destination: PostEditor(post: Post())) {
Image(systemName: "plus")
}
}
Text("Select a post, or create a new draft.")
.foregroundColor(.secondary)
}
- .environmentObject(self.postStore)
+ .environmentObject(postStore)
}
}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
ContentView(postStore: testPostStore)
}
}
diff --git a/Shared/Post/PostList.swift b/Shared/Post/PostList.swift
index 03d2b1c..277f21c 100644
--- a/Shared/Post/PostList.swift
+++ b/Shared/Post/PostList.swift
@@ -1,21 +1,22 @@
import SwiftUI
struct PostList: View {
- @ObservedObject var postStore: PostStore
-
+ @EnvironmentObject var postStore: PostStore
+
var body: some View {
List {
Text("\(postStore.posts.count) Posts")
.foregroundColor(.secondary)
ForEach(postStore.posts) { post in
PostCell(post: post)
}
}
}
}
struct PostList_Previews: PreviewProvider {
static var previews: some View {
- PostList(postStore: testPostStore)
+ PostList()
+ .environmentObject(testPostStore)
}
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Thu, Mar 6, 10:41 AM (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3168324
Attached To
rWFSUI WriteFreely SwiftUI
Event Timeline
Log In to Comment