问题
I would like to use the new CreateML
and CreateMLUI
Swift frameworks.
But when I write:
import CreateML
Xcode gives me an error:
No such module 'CreateML'
How can I use those in Xcode?
回答1:
To import CoreML or CoreMLUI you need to get latest software:
- Go to https://developer.apple.com/download/
- Install macOS Mojave 10.14 beta version.
- Install Xcode 10 beta.
- Create a macOS platform template.
HOW TO CREATE YOUR OWN MLMODEL: https://developer.apple.com/documentation/create_ml/creating_an_image_classifier_model
Use free MLModels provided by apple: https://developer.apple.com/machine-learning/run-a-model/
回答2:
You need to
- Have Mojave installed
- Install Xcode 10 beta
- Create a macOS template playground (not iOS)
回答3:
Install Mojave* and Xcode 10.
Create a new playground and make sure you select macOS as the target (e.g. macOS Single View).
Type in import CreateMLUI
- it should compile without problems.
(*)macOS Mojave is officially available since yesterday.
回答4:
For Xcode 10 - beta 6 You don't have to upgrade to Mojave. The newest Xcode - beta already supports 10.13.x. (From Apple Developer Forums).
I followed this step to try CreateML framework.
- Upgraded to latest MacOS (Not Mojave)
- Upgraded latest Xcode - beta.
- Create playground in macOS template (Default is iOS template)
Then, I can use createMLUI.
回答5:
Be sure that you are running a macOS playground not iOS
来源:https://stackoverflow.com/questions/50709748/how-to-import-and-use-createml-or-createmlui-in-xcode