Download and compile CoreMLModel from the server

How to download and use the model

There are cases where you don’t want to bundle your model with your app

There are cases where you do not want to bundle the CoreML model with the app due to the size of the app or the system.

CoreML model can be downloaded from the server and used

You can put the CoreML model on any server and download it to your device the first time you launch the app.


Download mlmodel with URLSession.

Compile the model you wrote locally.

After compiling, you will have a mlmodelc file locally (compiledModelURL).

Move the compiled model file to a directory where you can save it for future use.

Initialize the MLModel from the compiled model file.

Now you can initialize the model from the permanent URL from the next time onwards.

Delete the downloaded mlmodel that you no longer need.


I’m a freelance engineer.
Work consultation
Please feel free to contact us with a brief development description.

I am making an app that uses Core ML and ARKit.
We send machine learning / AR related information.





Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store