How to import and use CreateML or CreateMLUI in Xcode

强颜欢笑 提交于 2020-05-23 17:06:51

问题


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:

  1. Go to https://developer.apple.com/download/
  2. Install macOS Mojave 10.14 beta version.
  3. Install Xcode 10 beta.
  4. 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

  1. Have Mojave installed
  2. Install Xcode 10 beta
  3. 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.

  1. Upgraded to latest MacOS (Not Mojave)
  2. Upgraded latest Xcode - beta.
  3. 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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!