Swipe-That_pic/Swipe That Pic/Swipe_That_PicApp.swift

35 lines
811 B
Swift
Raw Normal View History

2024-07-26 13:16:48 +00:00
//
// Swipe_That_PicApp.swift
// Swipe That Pic
//
// Created by Amine Bou on 26/07/2024.
//
import SwiftUI
import SwiftData
import Photos
@main
struct Swipe_That_PicApp: App {
var sharedModelContainer: ModelContainer = {
let schema = Schema([
Item.self,
])
let modelConfiguration = ModelConfiguration(schema: schema, isStoredInMemoryOnly: false)
do {
return try ModelContainer(for: schema, configurations: [modelConfiguration])
} catch {
fatalError("Could not create ModelContainer: \(error)")
}
}()
var body: some Scene {
WindowGroup {
ContentView().environmentObject(PhotosService(modelContainer: sharedModelContainer))
}
.modelContainer(sharedModelContainer)
}
}