|
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 Take the pain out of configuring and testing your paywalls. RevenueCat's Paywalls allow you to remotely configure your entire paywall view without any code changes or app updates.
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.