existential any error in MLModel class

Problem

I have set SWIFT_UPCOMING_FEATURE_EXISTENTIAL_ANY at Build Settings > Swift Compiler - Upcoming Features to true to support this existential any proposal.

Then following errors appears in the MLModel class, but this is an auto-generated file, so I don't know how to deal with it.

Use of protocol 'MLFeatureProvider' as a type must be written 'any MLFeatureProvider'

Use of protocol 'Error' as a type must be written 'any Error'

environment

  • Xcode 16.0
  • Xcode 16.1 Beta 2

What I tried

  • Delete cache of DerivedData and regenerate MLModel class files
  • I also tried using DepthAnythingV2SmallF16P6.mlpackage to verify if there is a problem with my mlmodel
  • I tried the above after setting up Swift6 in Xcode
  • I also used coremlc to generate MLModel class files with Swift6 specified by command.

Thank you for the report. At this moment, you would need to work around by loading the model directly using MLModel API.

To prevent Xcode from generating the model access code, you can select the model file in the project navigator, open "Target Membership", and select "No generated class".

@moto_coreml_apple

thank you for replying! I'll turn off auto-generation and write it myself until Apple supports this.

existential any error in MLModel class
 
 
Q