mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Convert CollectionListModel to ObservableObject
This commit is contained in:
parent
f118d58d5c
commit
eebbf1a909
@ -1,18 +1,13 @@
|
||||
import SwiftUI
|
||||
|
||||
struct CollectionListModel {
|
||||
class CollectionListModel: ObservableObject {
|
||||
private(set) var userCollections: [PostCollection] = []
|
||||
private(set) var collectionsList: [PostCollection]
|
||||
|
||||
init() {
|
||||
collectionsList = [ allPostsCollection, draftsCollection ]
|
||||
|
||||
#if DEBUG
|
||||
userCollections = [ userCollection1, userCollection2, userCollection3 ]
|
||||
#endif
|
||||
@Published private(set) var collectionsList: [PostCollection] = [ allPostsCollection, draftsCollection ]
|
||||
|
||||
init(with userCollections: [PostCollection]) {
|
||||
for userCollection in userCollections {
|
||||
collectionsList.append(userCollection)
|
||||
self.userCollections.append(userCollection)
|
||||
}
|
||||
collectionsList.append(contentsOf: self.userCollections)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user