Source code for the WriteFreely SwiftUI app for iOS, iPadOS, and macOS
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 
 

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