Make adding and deleting posts more reliable/crashproof

This commit is contained in:
Angelo Stavrow 2020-11-26 15:52:00 -05:00
parent 5ca32ddcfc
commit 8ff1de188b
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 6 additions and 2 deletions

View File

@ -42,7 +42,9 @@ struct ContentView: View {
managedPost.rtl = Locale.characterDirection(forLanguage: languageCode) == .rightToLeft
}
withAnimation {
self.model.selectedPost = managedPost
DispatchQueue.main.async {
self.model.selectedPost = managedPost
}
}
}, label: { Image(systemName: "square.and.pencil") })
}

View File

@ -103,7 +103,9 @@ struct PostListFilteredView: View {
}
func delete(_ post: WFAPost) {
model.posts.remove(post)
DispatchQueue.main.async {
model.posts.remove(post)
}
}
}