Source code for the WriteFreely SwiftUI app for iOS, iPadOS, and macOS
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- import SwiftUI
- import CoreData
-
- class CollectionListModel: ObservableObject {
- @Published var userCollections = [WFACollection]()
-
- static let allPostsCollection = PostCollection(title: "All Posts")
- static let draftsCollection = PostCollection(title: "Drafts")
-
- init() {
- // let request = WFACollection.createFetchRequest()
- // request.sortDescriptors = []
- // do {
- // userCollections = try PersistenceManager.persistentContainer.viewContext.fetch(request)
- // } catch {
- // print("Error: Failed to fetch user collections from local store")
- // userCollections = []
- // }
- }
-
- func clearUserCollection() {
- userCollections = []
- // Clear collections from CoreData store.
- }
- }
|