Using a MLPackage in a Swift Playgrounds App

Hi, I'm trying to use a MLPackage in my app. Is this possible?Because during importing I get a warning.

Answered by dbbudd in 710343022

This appears to be a bug in Swift Playgrounds 4.0.2. You are able to drag in the CoreML model, but Swift Playgrounds won’t be able to find it in scope. I also tried this in Xcode 13.2 using the new App Package and had the same result. Xcode normally builds the model based on the inputs, so I tried to extract the model from another build and still the same result. I’m sure this will get fixed soon because it used to work in older Playground Books / Files. I’ve logged the bug also.

Accepted Answer

This appears to be a bug in Swift Playgrounds 4.0.2. You are able to drag in the CoreML model, but Swift Playgrounds won’t be able to find it in scope. I also tried this in Xcode 13.2 using the new App Package and had the same result. Xcode normally builds the model based on the inputs, so I tried to extract the model from another build and still the same result. I’m sure this will get fixed soon because it used to work in older Playground Books / Files. I’ve logged the bug also.

Using a MLPackage in a Swift Playgrounds App
 
 
Q