Disable swipe-to-delete for non-local posts

This commit is contained in:
Angelo Stavrow 2020-09-17 10:55:08 -04:00
parent edec5e9087
commit 77262c9cd6
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE

View File

@ -38,12 +38,12 @@ struct PostListFilteredView: View {
) {
PostCellView(post: post)
}
}.onDelete(perform: { indexSet in
.deleteDisabled(post.status != PostStatus.local.rawValue)
}
.onDelete(perform: { indexSet in
for index in indexSet {
let post = fetchRequest.wrappedValue[index]
if post.status == PostStatus.local.rawValue {
delete(post)
}
delete(post)
}
})
}