I think, its all because SwiftData is only can be used in iOS 17+, so if you project not, you get this error
Topic:
App & System Services
SubTopic:
iCloud & Data
Tags: