Creates a Core ML model object from a compiled model file.


convenience init(contentsOf url: URL) throws



The path to a compiled model file (ModelName.mlmodelc), typically with the URL returned from compileModel(at:).


In most cases your app won't need to create a model object directly. First consider using the wrapper class that Xcode generates automatically, as described in Add a Model to Your Xcode Project.

However, if the wrapper class doesn't meet your app's needs, then use this initializer to create a model object from any compiled model file your app has access to. Typically, you use this initializer after your app has downloaded and compiled a model, which is one technique for saving space in your app. See Downloading and Compiling a Model on the User's Device.

See Also

Creating a Model

init(contentsOf: URL, configuration: MLModelConfiguration)

Creates a Core ML model object from a compiled model file and a custom configuration.

class MLModelConfiguration

The settings for creating or updating a machine learning model.