Does SwiftData work in the Xcode Swift Playground? (Xc 15.1)

234 Views Asked by At

I'd like to experiment with SwiftData in the Xcode Swift Playground. Some low-level business with lldb prevents me from proceeding.

I've set it up like this:

// Xcode 15.1 Playground, iOS idiom.

import Foundation
import SwiftData

// Trivial Model
@Model
final class OneModel {
    let name: String
    let age: Int

    init(name: String, age: Int) {
        (self.name, self.age) = (name, age)
    }
}

// In-memory store; I figure getting files involved
// is one more complication than I need.
let configuration = ModelConfiguration(isStoredInMemoryOnly: true)

// Create a container for OneModel, in-memory.
let container = ModelContainer(for: OneModel.self,
                               configurations: configuration)

I needn't go further, the Playground console shows:

error: Couldn't lookup symbols:
  self.unsafeMutableAddressor : __lldb_expr_80.OneModel
  self.unsafeMutableAddressor : __lldb_expr_80.OneModel
  self.unsafeMutableAddressor : __lldb_expr_80.OneModel
... about 20 ...

I'm thrashing, I tried to initialize configuration and container in a @MainActor function, same result.

  • Am I doing something wrong?
  • Or is this another instance of playgrounds' not having runtime support for a feature?
0

There are 0 best solutions below