No such module 'SwiftData'

Advertisements

I am trying to create a data model for an experiment project. However, I am unable to import SwiftData. I am using Swift 5.

import Foundation
import SwiftData

@Model
class WeatherDataModel{
    var dayOfWeek: String
    var imageImage: String
    var temperature: Int
    
    init(dayOfWeek: String, imageImage: String, temperature: Int){
        self.dayOfWeek = dayOfWeek
        self.imageImage = imageImage
        self.temperature = temperature
    }
}

>Solution :

According to Xcode 15 release notes and SwiftData documentation. SwiftData was shipped with Xcode 15 and supported iOS 17 and above. So, you need to upgrade Xcode to at least 15.0 (15A240d).

Leave a ReplyCancel reply