Stay organized with collections
Save and categorize content based on your preferences.
If you're an experienced ML developer and the pre-built TensorFlow Lite
library doesn't meet your needs, you can use a custom
TensorFlow Lite build with ML Kit. For
example, you may want to add custom ops.
The generated framework can be found at tensorflow/lite/gen/ios_frameworks/tensorflow_lite.framework.zip
Creating a local pod
Create a directory for your local pod
Run pod lib create TensorFlowLite in the directory you created
Create a Frameworks directory inside the TensorFlowLite directory
Unzip the tensorflow_lite.framework.zip file generated above
Copy the unzipped tensorflow_lite.framework to TensorFlowLite/Frameworks
Modify the generated TensorFlowLite/TensorFlowLite.podspec to reference the library:
Pod::Spec.newdo|s|s.name='TensorFlowLite's.version='0.1.7'# Version must match.s.ios.deployment_target='9.0'# ... make other changes as desiredinternal_pod_root=Pathname.pwds.frameworks='Accelerate's.libraries='c++'s.vendored_frameworks='Frameworks/tensorflow_lite.framework's.pod_target_xcconfig={'SWIFT_VERSION'=>'4.0','INTERNAL_POD_ROOT'=>"#{internal_pod_root}",'HEADER_SEARCH_PATHS'=>"$(inherited) '${INTERNAL_POD_ROOT}/Frameworks/tensorflow_lite.framework/Headers'",'OTHER_LDFLAGS'=>"-force_load '${INTERNAL_POD_ROOT}/Frameworks/tensorflow_lite.framework/tensorflow_lite'"}end
Referencing the custom pod in your project
You can include the custom pod by referencing it directly from your app's
Podfile:
pod 'Firebase/MLModelInterpreter'
pod 'TensorFlowLite', :path => 'path/to/your/TensorflowLite'
For other options for managing private pods, see
Private Pods in
the Cocoapods documentation. Note that the version must exactly match, and you
should reference this version when including the pod from your
private repository, e.g. pod 'TensorFlowLite', "1.10.1".
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-15 UTC."],[],[],null,["\u003cbr /\u003e\n\nIf you're an experienced ML developer and the pre-built TensorFlow Lite\nlibrary doesn't meet your needs, you can use a custom\n[TensorFlow Lite](//www.tensorflow.org/mobile/tflite/) build with ML Kit. For\nexample, you may want to add custom ops.\n\nPrerequisites\n\n- A working [TensorFlow Lite](//github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/README.md#building-tensorflow-lite-and-the-demo-app-from-source) build environment\n- A checkout of TensorFlow Lite 1.10.1\n\nYou can check out the correct version using Git: \n\n git checkout -b work\n git reset --hard tflite-v1.10.1\n git cherry-pick 4dcfddc5d12018a5a0fdca652b9221ed95e9eb23\n\nBuilding the Tensorflow Lite library\n\n1. Build Tensorflow Lite (with your modifications) following the [standard instructions](//github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/g3doc/guide/build_ios.md)\n2. Build the framework:\n\n```\ntensorflow/lite/lib_package/create_ios_frameworks.sh\n```\n\nThe generated framework can be found at `tensorflow/lite/gen/ios_frameworks/tensorflow_lite.framework.zip`\n| **Note:** There have been [build issues\n| reported](https://github.com/tensorflow/tensorflow/issues/18356) with Xcode 9.3\n\nCreating a local pod\n\n1. Create a directory for your local pod\n2. Run `pod lib create TensorFlowLite` in the directory you created\n3. Create a `Frameworks` directory inside the `TensorFlowLite` directory\n4. Unzip the `tensorflow_lite.framework.zip` file generated above\n5. Copy the unzipped `tensorflow_lite.framework` to `TensorFlowLite/Frameworks`\n6. Modify the generated `TensorFlowLite/TensorFlowLite.podspec` to reference the library:\n\n Pod::Spec.new do |s|\n s.name = 'TensorFlowLite'\n s.version = '0.1.7' # Version must match.\n s.ios.deployment_target = '9.0'\n \n # ... make other changes as desired\n \n internal_pod_root = Pathname.pwd\n s.frameworks = 'Accelerate'\n s.libraries = 'c++'\n s.vendored_frameworks = 'Frameworks/tensorflow_lite.framework'\n\n s.pod_target_xcconfig = {\n 'SWIFT_VERSION' =\u003e '4.0',\n 'INTERNAL_POD_ROOT' =\u003e \"#{internal_pod_root}\",\n 'HEADER_SEARCH_PATHS' =\u003e \"$(inherited) '${INTERNAL_POD_ROOT}/Frameworks/tensorflow_lite.framework/Headers'\",\n 'OTHER_LDFLAGS' =\u003e \"-force_load '${INTERNAL_POD_ROOT}/Frameworks/tensorflow_lite.framework/tensorflow_lite'\"\n }\n end\n\nReferencing the custom pod in your project\n\nYou can include the custom pod by referencing it directly from your app's\n`Podfile`: \n\n pod 'Firebase/MLModelInterpreter'\n pod 'TensorFlowLite', :path =\u003e 'path/to/your/TensorflowLite'\n\nFor other options for managing private pods, see\n[Private Pods](https://guides.cocoapods.org/making/private-cocoapods.html) in\nthe Cocoapods documentation. Note that the version must exactly match, and you\nshould reference this version when including the pod from your\nprivate repository, e.g. `pod 'TensorFlowLite', \"1.10.1\"`."]]