mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Add selectedPost published property to WF model
This commit is contained in:
parent
45b6fb533c
commit
30b527daa4
@ -7,7 +7,7 @@ enum PostStatus {
|
||||
case published
|
||||
}
|
||||
|
||||
class Post: Identifiable, ObservableObject {
|
||||
class Post: Identifiable, ObservableObject, Hashable {
|
||||
@Published var wfPost: WFPost
|
||||
@Published var status: PostStatus
|
||||
@Published var collection: PostCollection
|
||||
@ -39,6 +39,16 @@ class Post: Identifiable, ObservableObject {
|
||||
}
|
||||
}
|
||||
|
||||
extension Post {
|
||||
static func == (lhs: Post, rhs: Post) -> Bool {
|
||||
return lhs.id == rhs.id
|
||||
}
|
||||
|
||||
func hash(into hasher: inout Hasher) {
|
||||
hasher.combine(id)
|
||||
}
|
||||
}
|
||||
|
||||
#if DEBUG
|
||||
let testPost = Post(
|
||||
title: "Test Post Title",
|
||||
|
@ -10,6 +10,7 @@ class WriteFreelyModel: ObservableObject {
|
||||
@Published var store = PostStore()
|
||||
@Published var collections = CollectionListModel(with: [])
|
||||
@Published var isLoggingIn: Bool = false
|
||||
@Published var selectedPost: Post?
|
||||
|
||||
private var client: WFClient?
|
||||
private let defaults = UserDefaults.standard
|
||||
|
Loading…
Reference in New Issue
Block a user