TodosApp.swift 633 B

1234567891011121314151617181920212223242526272829303132
  1. //
  2. // TodosApp.swift
  3. // Todos
  4. //
  5. // Created by Sam Jaffe on 2/28/26.
  6. //
  7. import SwiftUI
  8. import SwiftData
  9. @main
  10. struct TodosApp: App {
  11. var sharedModelContainer: ModelContainer = {
  12. let schema = Schema([
  13. Category.self,
  14. ])
  15. let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
  16. do {
  17. return try ModelContainer(for: schema, configurations: [modelConfiguration])
  18. } catch {
  19. fatalError("Could not create ModelContainer: \(error)")
  20. }
  21. }()
  22. var body: some Scene {
  23. WindowGroup {
  24. ContentView()
  25. }
  26. .modelContainer(sharedModelContainer)
  27. }
  28. }