Is there a way to make CoreML model available for iOS11+ at source level

Viewed 2464

I have a CoreML model in my application.

At run time, the prediction feature should be disabled on iOS8-10 and active on iOS11.

To be able to compile, on all classes that use CoreML, I have added :

@available(iOS 11.0, *)

But the .mlmodel generates the Swift code at every rebuild discarding all annotations. And so creating compile errors like :

'MLModel' is only available on iOS 11.0 or newer

Is there a way in Xcode9 to make the mlmodel iOS11 only?

EDIT: This bug was fixed in XCode 9 beta 4. The workaround is not needed anymore.

2 Answers
Related