Created
January 10, 2024 09:20
-
-
Save parpok/b67ab56aa8136bf8726fe2b4b8e15f8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Preview { | |
do { | |
let config = ModelConfiguration(isStoredInMemoryOnly: true) | |
let container = try ModelContainer(for: Item.self, configurations: config) | |
let example = Item("Insert Item Parameters") | |
return PostView(Item: example) | |
.modelContainer(container) | |
} | |
catch { | |
fatalError("Something fucked up") | |
} | |
} | |
// This basically creates a in memory ModelConfiguration so that SwiftData can Show you the data. It's like with observables creating example objects but with SwiftData drip. | |
// Yes I stole that from tutorial - welcome to tutorial hell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment