I’ve an app on the AppStore that targets iOS 16 and later.
I want to introduce help for SwiftData for units working iOS 17 and later, whereas sustaining help for iOS 16.
Instance code:
import Basis
import SwiftData
@obtainable(iOS 17, *)
@Mannequin
class Individual {
var firstName: String
var lastName: String
init(firstName: String, lastName: String) {
self.firstName = firstName
self.lastName = lastName
}
}
The app crashes due to @Mannequin with the next error:
dyld[5910]: Library not loaded: /System/Library/Frameworks/SwiftData.framework/SwiftData
If I remark out @Mannequin the app runs with no errors.
I can not drop help for iOS 16, however I would like to make use of SwiftData (not CoreData) and restrict the performance to iOS 17 units.
The under doesn’t work:
#if canImport(SwiftData)
import SwiftData
#endif
I might’ve thought that at runtime when it reads “@obtainable(iOS 17, *)” that it might not proceed to what’s after it because it’s working on iOS 16.