Warning: if you use #Preview macros #Xcode 15 Beta 2 is not especially for you:
> #Preview can’t reference symbols in Swift type extensions when they are defined in the same module as the Preview
> Workaround: Comment out #Preview and use the legacy PreviewProvider API.
Has anyone been able to get an in memory container working with SwiftData yet? Even with the FlashCards example from WWDC videos I get “ Compiling failed: main actor-isolated let 'previewContainer' can not be referenced from a non-isolated context”. Is this a known bug?
@JetForMe The #Preview macro isn't main actor-isolated by default, which I think ought to change. If that's the problem you're hitting, try putting MainActor.assumeIsolated { … } around your view in the preview?
@twostraws Xcode 15b3 releas notes say that #Preview works for pre-iOS 17/macOS 14, which is great, but I'm still running into MainActor isolation issues, and MainActor.assumIsolated is iOS 17+. Are there any other workarounds (other than old-style preview)? Not that big a deal, but I find it hard to believe it's this broken. Apple’s own sample code doesn’t build, so I wonder how this got released without a note. (BTW just bought a year of HWS+, you do great work!)
Anyone know how to make preview data for a SwiftData/SwiftUI app? I tried the SwiftDataFlashCardSample code from WWDC, but it doesn’t compile in Xcode1 5b1. #SwiftData#SwiftUI#Xcode#iOS#macOS
@StewartLynch I’m using the iOS 17 simulator, as I’m not about to install Sonoma on my dev Mac. But the problem is at compile time. The preview data is @MainActor but the #Preview is not.
This is my day for questions. With old PreviewProvider we could create static properties and use for our view’s arguments. We can’t do this with the #Preview Macro. Am I missing something here?
@dimsumthinking Yes, I can do that, but that was not my issue. My issue was not understanding the #Preview macro. I discovered that I could just create a property like let wine = Wine.samples[0] and then within the #Preview return WineView(wine: wine)
PSA: if you're having issues with the #WWDC2023 "Build an app with #SwiftData" session similar to:
CompileDylibError: Failed to build ContentView.swift
Compiling failed: main actor-isolated let 'previewContainer' can not be referenced from a non-isolated context
Replacing the #Preview macro with the old-style preview syntax resolves the issue. (I don't have macOS 14 so I'm running the preview on iOS and it looks weird with the frame so I removed it. Added a frame version if you want it.)
Swift Macros seem amazing and really speak to me as a programming nerd. But if I empathize with beginning programmers even for a second, I'm horrified. Swift has spiraled inexorably into impossible to understand territory. I used to defend it as a beginner's language but it's harder and harder to do so.
@mergesort SwiftData? (I was looking at #Preview/macros there, but all in my mostly blank New Project with SwiftData turned on.)
As for that... certainly some differences. Boutique doesn't care about property level things as long as it's Codable where SwiftData seems to want a little more structure (so it can offer queries and relationships). Grain of salt since I haven't seen a session yet, but it does feel like a less-boilerplate/Swifty Core Data where Boutique is a bit more AppStorage.
This episode will drop in a couple of hours, honestly, probably after I’m live on accessible media Inc today at 11:00 AM PT. @damashe and I had a blast on Saturday recording, and here's how the episodes gonna start. Yes, I forgot to fix the playback rate! Don't judge me… #TechnicallyWorking#Podcasting#Audio#Preview.
Death or Treat Review (Steam)
For this Death or Treat Review, where we learn that the Halloween spirit is missing! Play as Scary and help him save HallowTown. "Death or Treat" is a 2D action-rogue-lite and hack & slash, with handpainted environments and traditional animation. Explore all the worlds and defeat hordes of enemies using different weapons and skills.
Preview: 18 Minutes of Final Fantasy 16 Dungeon-Crawling Gameplay | IGN First (youtu.be)
Enjoy 18 minutes of exclusive gameplay as we explore two dungeons in Final Fantasy 16 ahead of its release for PS5 on June 22.#IGN #FF16