mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Set new local post as selectedPost in WriteFreelyModel
This commit is contained in:
parent
a791f4f50e
commit
7fd7b43755
@ -1,6 +1,7 @@
|
||||
import SwiftUI
|
||||
|
||||
struct PostListFilteredView: View {
|
||||
@EnvironmentObject var model: WriteFreelyModel
|
||||
var fetchRequest: FetchRequest<WFAPost>
|
||||
|
||||
init(filter: String?, showAllPosts: Bool) {
|
||||
@ -28,7 +29,11 @@ struct PostListFilteredView: View {
|
||||
|
||||
var body: some View {
|
||||
List(fetchRequest.wrappedValue, id: \.self) { post in
|
||||
NavigationLink(destination: PostEditorView(post: post)) {
|
||||
NavigationLink(
|
||||
destination: PostEditorView(post: post),
|
||||
tag: post,
|
||||
selection: $model.selectedPost
|
||||
) {
|
||||
PostCellView(post: post)
|
||||
}
|
||||
}
|
||||
|
@ -111,6 +111,7 @@ struct PostListView: View {
|
||||
DispatchQueue.main.async {
|
||||
LocalStorageManager().saveContext()
|
||||
}
|
||||
model.selectedPost = managedPost
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -7,12 +7,12 @@
|
||||
<key>WriteFreely-MultiPlatform (iOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>1</integer>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
<key>WriteFreely-MultiPlatform (macOS).xcscheme_^#shared#^_</key>
|
||||
<dict>
|
||||
<key>orderHint</key>
|
||||
<integer>0</integer>
|
||||
<integer>1</integer>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
|
Loading…
Reference in New Issue
Block a user