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.
 
 
 

39 Zeilen
1.3 KiB

  1. import SwiftUI
  2. struct ContentView: View {
  3. @EnvironmentObject var model: WriteFreelyModel
  4. var body: some View {
  5. NavigationView {
  6. SidebarView()
  7. PostListView(selectedCollection: CollectionListModel.allPostsCollection)
  8. Text("Select a post, or create a new local draft.")
  9. .foregroundColor(.secondary)
  10. }
  11. .environmentObject(model)
  12. }
  13. }
  14. struct ContentView_Previews: PreviewProvider {
  15. static var previews: some View {
  16. let userCollection1 = WFACollection(context: PersistenceManager.persistentContainer.viewContext)
  17. let userCollection2 = WFACollection(context: PersistenceManager.persistentContainer.viewContext)
  18. let userCollection3 = WFACollection(context: PersistenceManager.persistentContainer.viewContext)
  19. userCollection1.title = "Collection 1"
  20. userCollection2.title = "Collection 2"
  21. userCollection3.title = "Collection 3"
  22. let model = WriteFreelyModel()
  23. model.collections = CollectionListModel()
  24. for post in testPostData {
  25. model.store.add(post)
  26. }
  27. return ContentView()
  28. .environmentObject(model)
  29. .environment(\.managedObjectContext, PersistenceManager.persistentContainer.viewContext)
  30. }
  31. }