Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

No such module 'SwiftData'

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 :

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

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).

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading