42 lines
868 B
Swift
42 lines
868 B
Swift
//
|
|
// WorkoutsPlusApp.swift
|
|
// WorkoutsPlus
|
|
//
|
|
// Created by Felix Förtsch on 10.08.24.
|
|
//
|
|
|
|
import SwiftUI
|
|
import SwiftData
|
|
|
|
@main
|
|
struct WorkoutsPlusApp: App {
|
|
var sharedModelContainer: ModelContainer = {
|
|
let schema = WorkoutsPlusApp.swiftDataSchema
|
|
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()
|
|
}
|
|
.modelContainer(sharedModelContainer)
|
|
}
|
|
}
|
|
|
|
extension WorkoutsPlusApp {
|
|
static let swiftDataSchema = Schema([
|
|
Exercise.self,
|
|
Equipment.self,
|
|
Workout.self,
|
|
WorkoutItem.self,
|
|
WorkoutSession.self,
|
|
WorkoutSessionItem.self,
|
|
])
|
|
}
|