Conditionally use SwiftData?

Awesome courses and summary on SwiftData. Is there an option to implement SwiftData models (@Model, structures, persistence…) conditionally? I wanted to implement swiftdata IF the iOS is 17.0 or above, otherwise just not use swiftdata models if the device is earlier iOS version.

Or do you guys just limit the app to iOS 17 when using swiftData? I feel that leaves out a good chunk of iOS users

Great question. I don’t have the answer. But the quick answer section in my Kagi search does:

Let me know if that works :slight_smile:

If your intention is to use SwiftData when iOS17 is detected and use CoreData when an earlier version of iOS is detected then you are probably better off to implement CoreData rather than having to maintain the two different implementations.

SwiftData sits on top of CoreData. The underlying database is still sqlite.