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.
 
 
 

26 rader
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. }