Source code for the WriteFreely SwiftUI app for iOS, iPadOS, and macOS
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

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