Source code for the WriteFreely SwiftUI app for iOS, iPadOS, and macOS
Du kan inte välja fler än 25 ämnen
Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
|
- 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.
- }
- }
|