Source code for the WriteFreely SwiftUI app for iOS, iPadOS, and macOS
Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.
 
 
 

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