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.
 
 
 

26 lines
774 B

  1. import SwiftUI
  2. import CoreData
  3. class CollectionListModel: ObservableObject {
  4. @Published var userCollections = [WFACollection]()
  5. static let allPostsCollection = PostCollection(title: "All Posts")
  6. static let draftsCollection = PostCollection(title: "Drafts")
  7. init() {
  8. // let request = WFACollection.createFetchRequest()
  9. // request.sortDescriptors = []
  10. // do {
  11. // userCollections = try PersistenceManager.persistentContainer.viewContext.fetch(request)
  12. // } catch {
  13. // print("Error: Failed to fetch user collections from local store")
  14. // userCollections = []
  15. // }
  16. }
  17. func clearUserCollection() {
  18. userCollections = []
  19. // Clear collections from CoreData store.
  20. }
  21. }