{"slug": "anyone-using-apple-coreml-with-zig", "title": "Anyone using Apple CoreML ? With zig?", "summary": "A developer on the Zig forum shared that integrating Apple's CoreML framework with Zig is challenging due to heavy reliance on Apple's Xcode tooling and auto-generated code, and suggested using FFI or bridging via Swift, referencing Mitchell Hashimoto's zig-objc project and a guide on calling Swift from C.", "body_md": "I can share a bit of my experience working with Apple Libraries in C/Rust, which applies to Zig as well since they’re either Obj-C runtime or FFI based.\n\nI think you have two ways to go about this:\n\nThe problem with CoreML, is that it heavily depends on Apple’s own tooling. Take [this guide for example](https://developer.apple.com/documentation/coreml/integrating-a-core-ml-model-into-your-app?language=objc), it defaults to using Xcode integration with the `.mlmodel`\n\nfile that makes everything magically work. But I think working with these files in Zig will require you to check how these `.mlmodel`\n\nbundles work and what exactly is in them, what libraries the auto-generated code depends, how you’ll link and bridge things together [3].\n\nNot sure how much it helps, but working with Apple libraries can be a bit challenging, let me know if you have any other questions I hope I can help with useful answers.\n\nGood to keep in mind that I have only worked with CoreML once, a long time ago back when it was introduced, and back then I worked exclusively on getting it to work on Swift apps.\n\n[This guide shows how you can call Swift from C](https://christiantietze.de/posts/2025/04/calling-swift-library-functions-from-c/), the Swift compilation steps are the same but instead of doing the clang step you’d have to play with Zig’s build system to link all the system frameworks that your swift code depends on, that would likely be [Foundation](https://developer.apple.com/documentation/foundation?language=objc), [CoreML](https://developer.apple.com/documentation/coreml?language=objc) and the libraries in between. [↩︎](https://ziggit.dev#footnote-ref-76904-1)\n\nYou can check [Mitchell Hashimoto’s zig-objc project](https://github.com/mitchellh/zig-objc). And this\n\nAfter a quick search, I found [a short article](https://krisp.ai/blog/how-to-integrate-coreml-models-into-c-c-codebase/) that might shed a light on this. [↩︎](https://ziggit.dev#footnote-ref-76904-3)", "url": "https://wpnews.pro/news/anyone-using-apple-coreml-with-zig", "canonical_source": "https://ziggit.dev/t/anyone-using-apple-coreml-with-zig/17381#post_2", "published_at": "2026-08-27 05:55:10+00:00", "updated_at": "2026-08-27 06:19:34.997329+00:00", "lang": "en", "topics": ["developer-tools"], "entities": ["Apple CoreML", "Zig", "Mitchell Hashimoto", "zig-objc", "Swift"], "alternates": {"html": "https://wpnews.pro/news/anyone-using-apple-coreml-with-zig", "markdown": "https://wpnews.pro/news/anyone-using-apple-coreml-with-zig.md", "text": "https://wpnews.pro/news/anyone-using-apple-coreml-with-zig.txt", "jsonld": "https://wpnews.pro/news/anyone-using-apple-coreml-with-zig.jsonld"}}