SwiftData not working in VisionOS

I want to make icloud backup using SwiftData in VisionOS and I need to use SwiftData first but I get the following error even though I do the following steps

I followed the steps below

I created a Model

import Foundation
import SwiftData

@Model
class NoteModel {
    @Attribute(.unique) var id: UUID
    var date:Date
    var title:String
    var text:String
    
    init(id: UUID = UUID(), date: Date, title: String, text: String) {
        self.id = id
        self.date = date
        self.title = title
        self.text = text
    }
}

I added modelContainer

WindowGroup(content: {
    NoteView()
})
.modelContainer(for: [NoteModel.self])

And I'm making inserts to test

import SwiftUI
import SwiftData

struct NoteView: View {
    @Environment(\.modelContext) private var context
    
    var body: some View {
        Button(action: { // new Note
                                let note = NoteModel(date: Date(), title: "New Note", text: "")
                                context.insert(note)
                            }, label: {
                                Image(systemName: "note.text.badge.plus")
                                    .font(.system(size: 24))
                                    .frame(width: 30, height: 30)
                                    .padding(12)
                                    .background(
                                        RoundedRectangle(cornerRadius: 50)
                                            .foregroundStyle(.black.opacity(0.2))
                                    )
                            })
                            .buttonStyle(.plain)
                            .hoverEffectDisabled(true)
    }
}

#Preview {
    NoteView().modelContainer(for: [NoteModel.self])
}
SwiftData not working in VisionOS
 
 
Q