|
I'm getting a crash in the preview canvas only - runs fine in the simulator. Pretty sure I've copied Paul's code exactly, but cannot get past this error: Fatal error in ModelContainer.swift - failed to find a currently active container for Book. My Code Main App Bundle:
ContentView
AddBookView
Book
I've also tried initiating the modelContainer differenly in the main app file as I found in other suggestions online. This did not change the crash.
Any help is apprectiated!! |
|
When you run an application in the simulator, all the pieces of all your code files are available to execute and provide data between themselves. So when your app decides to compute the You see? The PreviewBut if you're just wanting to see just the A Preview only knows about the view that's inside the Keep CodingFor a great tutorial on viewing SwiftData in Previews, jump over to Stewart Lynch's series on SwiftData in the YouTube. See -> SwiftData Previews |
SPONSORED Superwall lets you build & test paywalls without shipping updates. Run experiments, offer sales, segment users, update locked features and more at the click of button. Best part? It's FREE for up to 250 conversions / mo and the Superwall team builds out 100% custom paywalls – free of charge.
Sponsor Hacking with Swift and reach the world's largest Swift community!
You need to create an account or log in to reply.
All interactions here are governed by our code of conduct.
Link copied to your pasteboard.