Implemented the "preview" constant for the ModelContainer+Constants extension in the app target.

This commit is contained in:
Javier Cicchelli 2024-10-06 13:41:30 +02:00
parent cd9bd975b4
commit b4a6491db7
2 changed files with 28 additions and 2 deletions

View File

@ -429,7 +429,7 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "Piper/Sources/Previews/Extensions/Repository+Samples.swift Piper/Resources/Catalogs/Previews.xcassets"; DEVELOPMENT_ASSET_PATHS = "Piper/Sources/Previews/Extensions/Repository+Samples.swift Piper/Sources/Previews/Extensions/ModelContainer+Constants.swift Piper/Resources/Catalogs/Previews.xcassets";
DEVELOPMENT_TEAM = 7FMNM89WKG; DEVELOPMENT_TEAM = 7FMNM89WKG;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;
@ -461,7 +461,7 @@
CODE_SIGN_STYLE = Automatic; CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES; COMBINE_HIDPI_IMAGES = YES;
CURRENT_PROJECT_VERSION = 1; CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_ASSET_PATHS = "Piper/Sources/Previews/Extensions/Repository+Samples.swift Piper/Resources/Catalogs/Previews.xcassets"; DEVELOPMENT_ASSET_PATHS = "Piper/Sources/Previews/Extensions/Repository+Samples.swift Piper/Sources/Previews/Extensions/ModelContainer+Constants.swift Piper/Resources/Catalogs/Previews.xcassets";
DEVELOPMENT_TEAM = 7FMNM89WKG; DEVELOPMENT_TEAM = 7FMNM89WKG;
ENABLE_HARDENED_RUNTIME = YES; ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES; ENABLE_PREVIEWS = YES;

View File

@ -0,0 +1,26 @@
//
// ModelContainer+Constants.swift
// Piper
//
// Created by Javier Cicchelli on 06/10/2024.
// Copyright © 2024 Röck+Cöde. All rights reserved.
//
import SwiftData
extension ModelContainer {
// MARK: Constants
static let preview: ModelContainer = {
do {
return try ModelContainer(
for: .entities,
configurations: ModelConfiguration(isStoredInMemoryOnly: true)
)
} catch {
fatalError("Model Container should have been created.")
}
}()
}