{"id":"fac86b7d-9b85-4e4f-83d1-fe5925b9dbb1","shortId":"HHwCU7","kind":"skill","title":"coreml","tagline":"Integrate and optimize Core ML models in iOS apps for on-device machine learning inference. Covers model loading (.mlmodelc, .mlpackage), predictions with auto-generated classes and MLFeatureProvider, compute unit configuration (CPU, GPU, Neural Engine), MLTensor, VNCoreMLRequest","description":"# Core ML Swift Integration\n\nLoad, configure, and run Core ML models in iOS apps. This skill covers the\nSwift side: model loading, prediction, MLTensor, profiling, and deployment.\nTarget iOS 26+ with Swift 6.3, backward-compatible to iOS 14 unless noted.\n\n> **Scope boundary:** Python-side model conversion, optimization (quantization,\n> palettization, pruning), and framework selection live in the `apple-on-device-ai`\n> skill. This skill owns Swift integration only.\n\nSee [references/coreml-swift-integration.md](references/coreml-swift-integration.md) for complete code patterns including\nactor-based caching, batch inference, image preprocessing, and testing.\n\n## Contents\n\n- [Loading Models](#loading-models)\n- [Model Configuration](#model-configuration)\n- [Making Predictions](#making-predictions)\n- [MLTensor (iOS 18+)](#mltensor-ios-18)\n- [Working with MLMultiArray](#working-with-mlmultiarray)\n- [Image Preprocessing](#image-preprocessing)\n- [Multi-Model Pipelines](#multi-model-pipelines)\n- [Vision Integration](#vision-integration)\n- [Performance Profiling](#performance-profiling)\n- [Model Deployment](#model-deployment)\n- [Memory Management](#memory-management)\n- [Common Mistakes](#common-mistakes)\n- [Review Checklist](#review-checklist)\n- [References](#references)\n\n## Loading Models\n\n### Auto-Generated Classes\n\nWhen you drag a `.mlpackage` or `.mlmodelc` into Xcode, it generates a Swift\nclass with typed input/output. Use this whenever possible.\n\n```swift\nimport CoreML\n\nlet config = MLModelConfiguration()\nconfig.computeUnits = .all\n\nlet model = try MyImageClassifier(configuration: config)\n```\n\n### Manual Loading\n\nLoad from a URL when the model is downloaded at runtime or stored outside the\nbundle.\n\n```swift\nlet modelURL = Bundle.main.url(\n    forResource: \"MyModel\", withExtension: \"mlmodelc\"\n)!\nlet model = try MLModel(contentsOf: modelURL, configuration: config)\n```\n\n### Async Loading (iOS 16+)\n\nLoad models without blocking the main thread. Prefer this for large models.\n\n```swift\nlet model = try await MLModel.load(\n    contentsOf: modelURL,\n    configuration: config\n)\n```\n\n### Compile at Runtime\n\nCompile a `.mlpackage` or `.mlmodel` to `.mlmodelc` on device. Useful for\nmodels downloaded from a server.\n\n```swift\nlet compiledURL = try await MLModel.compileModel(at: packageURL)\nlet model = try MLModel(contentsOf: compiledURL, configuration: config)\n```\n\nCache the compiled URL -- recompiling on every launch wastes time. Copy\n`compiledURL` to a persistent location (e.g., Application Support).\n\n## Model Configuration\n\n`MLModelConfiguration` controls compute units, GPU access, and model parameters.\n\n### Compute Units Decision Table\n\n| Value | Uses | When to Choose |\n|---|---|---|\n| `.all` | CPU + GPU + Neural Engine | Default. Let the system decide. |\n| `.cpuOnly` | CPU | Background tasks, audio sessions, or when GPU is busy. |\n| `.cpuAndGPU` | CPU + GPU | Need GPU but model has ops unsupported by ANE. |\n| `.cpuAndNeuralEngine` | CPU + Neural Engine | Best energy efficiency for compatible models. |\n\n```swift\nlet config = MLModelConfiguration()\nconfig.computeUnits = .cpuAndNeuralEngine\n\n// Allow low-priority background inference\nconfig.computeUnits = .cpuOnly\n```\n\n### Configuration Properties\n\n```swift\nlet config = MLModelConfiguration()\nconfig.computeUnits = .all\nconfig.allowLowPrecisionAccumulationOnGPU = true // faster, slight precision loss\n```\n\n## Making Predictions\n\n### With Auto-Generated Classes\n\nThe generated class provides typed input/output structs.\n\n```swift\nlet model = try MyImageClassifier(configuration: config)\nlet input = MyImageClassifierInput(image: pixelBuffer)\nlet output = try model.prediction(input: input)\nprint(output.classLabel)        // \"golden_retriever\"\nprint(output.classLabelProbs)   // [\"golden_retriever\": 0.95, ...]\n```\n\n### With MLDictionaryFeatureProvider\n\nUse when inputs are dynamic or not known at compile time.\n\n```swift\nlet inputFeatures = try MLDictionaryFeatureProvider(dictionary: [\n    \"image\": MLFeatureValue(pixelBuffer: pixelBuffer),\n    \"confidence_threshold\": MLFeatureValue(double: 0.5),\n])\nlet output = try model.prediction(from: inputFeatures)\nlet label = output.featureValue(for: \"classLabel\")?.stringValue\n```\n\n### Async Prediction (iOS 17+)\n\n```swift\nlet output = try await model.prediction(from: inputFeatures)\n```\n\n### Batch Prediction\n\nProcess multiple inputs in one call for better throughput.\n\n```swift\nlet batchInputs = try MLArrayBatchProvider(array: inputs.map { input in\n    try MLDictionaryFeatureProvider(dictionary: [\"image\": MLFeatureValue(pixelBuffer: input)])\n})\nlet batchOutput = try model.predictions(from: batchInputs)\nfor i in 0..<batchOutput.count {\n    let result = batchOutput.features(at: i)\n    print(result.featureValue(for: \"classLabel\")?.stringValue ?? \"unknown\")\n}\n```\n\n### Stateful Prediction (iOS 18+)\n\nUse `MLState` for models that maintain state across predictions (sequence models,\nLLMs, audio accumulators). Create state once and pass it to each prediction call.\n\n```swift\nlet state = model.makeState()\n\n// Each prediction carries forward the internal model state\nfor frame in audioFrames {\n    let input = try MLDictionaryFeatureProvider(dictionary: [\n        \"audio_features\": MLFeatureValue(multiArray: frame)\n    ])\n    let output = try await model.prediction(from: input, using: state)\n    let classification = output.featureValue(for: \"label\")?.stringValue\n}\n```\n\nState is not `Sendable` -- use it from a single actor or task. Call\n`model.makeState()` to create independent state for concurrent streams.\n\n## MLTensor (iOS 18+)\n\n`MLTensor` is a Swift-native multidimensional array for pre/post-processing.\nOperations run lazily -- call `.shapedArray(of:)` to materialize results.\n\n```swift\nimport CoreML\n\n// Creation\nlet tensor = MLTensor([1.0, 2.0, 3.0, 4.0])\nlet zeros = MLTensor(zeros: [3, 224, 224], scalarType: Float.self)\n\n// Reshaping\nlet reshaped = tensor.reshaped(to: [2, 2])\n\n// Math operations\nlet softmaxed = tensor.softmax()\nlet normalized = (tensor - tensor.mean()) / tensor.standardDeviation()\n\n// Interop with MLMultiArray\nlet multiArray = try MLMultiArray([1.0, 2.0, 3.0, 4.0])\nlet fromMultiArray = MLTensor(multiArray)\nlet backToArray = tensor.shapedArray(of: Float.self)\n```\n\n## Working with MLMultiArray\n\n`MLMultiArray` is the primary data exchange type for non-image model inputs and\noutputs. Use it when the auto-generated class expects array-type features.\n\n```swift\n// Create a 3D array: [batch, sequence, features]\nlet array = try MLMultiArray(shape: [1, 128, 768], dataType: .float32)\n\n// Write values\nfor i in 0..<128 {\n    array[[0, i, 0] as [NSNumber]] = NSNumber(value: Float(i))\n}\n\n// Read values\nlet value = array[[0, 0, 0] as [NSNumber]].floatValue\n\n// Create from data pointer for zero-copy interop\nlet data: [Float] = [1.0, 2.0, 3.0]\nlet fromData = try MLMultiArray(dataPointer: UnsafeMutableRawPointer(mutating: data),\n                                 shape: [3],\n                                 dataType: .float32,\n                                 strides: [1])\n```\n\nSee [references/coreml-swift-integration.md](references/coreml-swift-integration.md) for advanced MLMultiArray patterns\nincluding NLP tokenization and audio feature extraction.\n\n## Image Preprocessing\n\nImage models expect `CVPixelBuffer` input. Use `CGImage` conversion for photos\nfrom the camera or photo library. Vision's `VNCoreMLRequest` handles this\nautomatically; manual conversion is needed only for direct `MLModel` prediction.\n\n```swift\nimport CoreVideo\n\nfunc createPixelBuffer(from cgImage: CGImage, width: Int, height: Int) -> CVPixelBuffer? {\n    var pixelBuffer: CVPixelBuffer?\n    let attrs: [CFString: Any] = [\n        kCVPixelBufferCGImageCompatibilityKey: true,\n        kCVPixelBufferCGBitmapContextCompatibilityKey: true,\n    ]\n    CVPixelBufferCreate(kCFAllocatorDefault, width, height,\n                        kCVPixelFormatType_32ARGB, attrs as CFDictionary, &pixelBuffer)\n\n    guard let buffer = pixelBuffer else { return nil }\n    CVPixelBufferLockBaseAddress(buffer, [])\n    let context = CGContext(\n        data: CVPixelBufferGetBaseAddress(buffer),\n        width: width, height: height,\n        bitsPerComponent: 8, bytesPerRow: CVPixelBufferGetBytesPerRow(buffer),\n        space: CGColorSpaceCreateDeviceRGB(),\n        bitmapInfo: CGImageAlphaInfo.noneSkipFirst.rawValue\n    )\n    context?.draw(cgImage, in: CGRect(x: 0, y: 0, width: width, height: height))\n    CVPixelBufferUnlockBaseAddress(buffer, [])\n    return buffer\n}\n```\n\nFor additional preprocessing patterns (normalization, center-cropping), see\n[references/coreml-swift-integration.md](references/coreml-swift-integration.md).\n\n## Multi-Model Pipelines\n\nChain models when preprocessing or postprocessing requires a separate model.\n\n```swift\n// Sequential inference: preprocessor -> main model -> postprocessor\nlet preprocessed = try preprocessor.prediction(from: rawInput)\nlet mainOutput = try mainModel.prediction(from: preprocessed)\nlet finalOutput = try postprocessor.prediction(from: mainOutput)\n```\n\nFor Xcode-managed pipelines, use the pipeline model type in the `.mlpackage`.\nEach sub-model runs on its optimal compute unit.\n\n## Vision Integration\n\nUse Vision to run Core ML image models with automatic image preprocessing\n(resizing, normalization, color space, orientation).\n\n### Modern: CoreMLRequest (iOS 18+)\n\n```swift\nimport Vision\nimport CoreML\n\nlet model = try MLModel(contentsOf: modelURL, configuration: config)\nlet request = CoreMLRequest(model: .init(model))\nlet results = try await request.perform(on: cgImage)\n\nif let classification = results.first as? ClassificationObservation {\n    print(\"\\(classification.identifier): \\(classification.confidence)\")\n}\n```\n\n### Legacy: VNCoreMLRequest\n\n```swift\nlet vnModel = try VNCoreMLModel(for: model)\nlet request = VNCoreMLRequest(model: vnModel) { request, error in\n    guard let results = request.results as? [VNRecognizedObjectObservation] else { return }\n    for observation in results {\n        let label = observation.labels.first?.identifier ?? \"unknown\"\n        let confidence = observation.labels.first?.confidence ?? 0\n        let boundingBox = observation.boundingBox // normalized coordinates\n        print(\"\\(label): \\(confidence) at \\(boundingBox)\")\n    }\n}\nrequest.imageCropAndScaleOption = .scaleFill\n\nlet handler = VNImageRequestHandler(cvPixelBuffer: pixelBuffer)\ntry handler.perform([request])\n```\n\n> For complete Vision framework patterns (text recognition, barcode detection,\n> document scanning), see the `vision-framework` skill.\n\n## Performance Profiling\n\n### MLComputePlan (iOS 17.4+)\n\nInspect which compute device each operation will use before running predictions.\n\n```swift\nlet computePlan = try await MLComputePlan.load(\n    contentsOf: modelURL, configuration: config\n)\nguard case let .program(program) = computePlan.modelStructure else { return }\nguard let mainFunction = program.functions[\"main\"] else { return }\n\nfor operation in mainFunction.block.operations {\n    let deviceUsage = computePlan.deviceUsage(for: operation)\n    let estimatedCost = computePlan.estimatedCost(of: operation)\n    print(\"\\(operation.operatorName): \\(deviceUsage?.preferredComputeDevice ?? \"unknown\")\")\n}\n```\n\n### Instruments\n\nUse the **Core ML** instrument template in Instruments to profile:\n- Model load time\n- Prediction latency (per-operation breakdown)\n- Compute device dispatch (CPU/GPU/ANE per operation)\n- Memory allocation\n\nRun outside the debugger for accurate results (Xcode: Product > Profile).\n\n## Model Deployment\n\n### Bundle vs On-Demand Resources\n\n| Strategy | Pros | Cons |\n|---|---|---|\n| Bundle in app | Instant availability, works offline | Increases app download size |\n| On-demand resources | Smaller initial download | Requires download before first use |\n| Background Assets (iOS 16+) | Downloads ahead of time | More complex setup |\n| CloudKit / server | Maximum flexibility | Requires network, longer setup |\n\n### Size Considerations\n\n- App Store limit: 4 GB for app bundle\n- Cellular download limit: 200 MB (can request exception)\n- Use ODR tags for models > 50 MB\n- Pre-compile to `.mlmodelc` to skip on-device compilation\n\n```swift\n// On-demand resource loading\nlet request = NSBundleResourceRequest(tags: [\"ml-model-v2\"])\ntry await request.beginAccessingResources()\nlet modelURL = Bundle.main.url(forResource: \"LargeModel\", withExtension: \"mlmodelc\")!\nlet model = try await MLModel.load(contentsOf: modelURL, configuration: config)\n// Call request.endAccessingResources() when done\n```\n\n## Memory Management\n\n- **Unload on background:** Release model references when the app enters background\n  to free GPU/ANE memory. Reload on foreground return.\n- **Use `.cpuOnly` for background tasks:** Background processing cannot use GPU or\n  ANE; setting `.cpuOnly` avoids silent fallback and resource contention.\n- **Share model instances:** Never create multiple `MLModel` instances from the same\n  compiled model. Use an actor to provide shared access.\n- **Monitor memory pressure:** Large models (>100 MB) can trigger memory warnings.\n  Register for `UIApplication.didReceiveMemoryWarningNotification` and release\n  cached models when under pressure.\n\nSee [references/coreml-swift-integration.md](references/coreml-swift-integration.md) for an actor-based model manager with\nlifecycle-aware loading and cache eviction.\n\n## Common Mistakes\n\n**DON'T:** Load models on the main thread.\n**DO:** Use `MLModel.load(contentsOf:configuration:)` async API or load on a background actor.\n**Why:** Large models can take seconds to load, freezing the UI.\n\n**DON'T:** Recompile `.mlpackage` to `.mlmodelc` on every app launch.\n**DO:** Compile once with `MLModel.compileModel(at:)` and cache the compiled URL persistently.\n**Why:** Compilation is expensive. Cache the `.mlmodelc` in Application Support.\n\n**DON'T:** Hardcode `.cpuOnly` unless you have a specific reason.\n**DO:** Use `.all` and let the system choose the optimal compute unit.\n**Why:** `.all` enables Neural Engine and GPU, which are faster and more energy-efficient.\n\n**DON'T:** Ignore `MLFeatureValue` type mismatches between input and model expectations.\n**DO:** Match types exactly -- use `MLFeatureValue(pixelBuffer:)` for images, not raw data.\n**Why:** Type mismatches cause cryptic runtime crashes or silent incorrect results.\n\n**DON'T:** Create a new `MLModel` instance for every prediction.\n**DO:** Load once and reuse. Use an actor to manage the model lifecycle.\n**Why:** Model loading allocates significant memory and compute resources.\n\n**DON'T:** Skip error handling for model loading and prediction.\n**DO:** Catch errors and provide fallback behavior when the model fails.\n**Why:** Models can fail to load on older devices or when resources are constrained.\n\n**DON'T:** Assume all operations run on the Neural Engine.\n**DO:** Use `MLComputePlan` (iOS 17.4+) to verify device dispatch per operation.\n**Why:** Unsupported operations fall back to CPU, which may bottleneck the pipeline.\n\n**DON'T:** Process images manually before passing to Vision + Core ML.\n**DO:** Use `CoreMLRequest` (iOS 18+) or `VNCoreMLRequest` (legacy) to let Vision handle preprocessing.\n**Why:** Vision handles orientation, scaling, and pixel format conversion correctly.\n\n## Review Checklist\n\n- [ ] Model loaded asynchronously (not blocking main thread)\n- [ ] `MLModelConfiguration.computeUnits` set appropriately for use case\n- [ ] Model instance reused across predictions (not recreated each time)\n- [ ] Auto-generated class used when available (typed inputs/outputs)\n- [ ] Error handling for model loading and prediction failures\n- [ ] Compiled model cached persistently if compiled at runtime\n- [ ] Image inputs use Vision pipeline (`CoreMLRequest` iOS 18+ or `VNCoreMLRequest`) for correct preprocessing\n- [ ] `MLComputePlan` checked to verify compute device dispatch (iOS 17.4+)\n- [ ] Batch predictions used when processing multiple inputs\n- [ ] Model size appropriate for deployment strategy (bundle vs ODR)\n- [ ] Memory tested on target devices (especially older devices with less RAM)\n- [ ] Predictions run outside debugger for accurate performance measurement\n\n## References\n\n- Patterns and code: [references/coreml-swift-integration.md](references/coreml-swift-integration.md)\n- Model conversion and optimization (Python-side): covered in the `apple-on-device-ai` skill\n- Apple docs: [Core ML](https://sosumi.ai/documentation/coreml) |\n  [MLModel](https://sosumi.ai/documentation/coreml/mlmodel) |\n  [MLComputePlan](https://sosumi.ai/documentation/coreml/mlcomputeplan-1w21n)","tags":["coreml","swift","ios","skills","dpearson2699","accessibility","agent-skills","ai-coding","apple","claude-code","codex-skills","cursor-skills"],"capabilities":["skill","source-dpearson2699","skill-coreml","topic-accessibility","topic-agent-skills","topic-ai-coding","topic-apple","topic-claude-code","topic-codex-skills","topic-cursor-skills","topic-ios","topic-ios-development","topic-liquid-glass","topic-localization","topic-mapkit"],"categories":["swift-ios-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/dpearson2699/swift-ios-skills/coreml","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add dpearson2699/swift-ios-skills","source_repo":"https://github.com/dpearson2699/swift-ios-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 599 github stars · SKILL.md body (16,564 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-05-18T18:53:40.868Z","embedding":null,"createdAt":"2026-04-18T20:34:25.384Z","updatedAt":"2026-05-18T18:53:40.868Z","lastSeenAt":"2026-05-18T18:53:40.868Z","tsv":"'/documentation/coreml)':1928 '/documentation/coreml/mlcomputeplan-1w21n)':1936 '/documentation/coreml/mlmodel)':1932 '0':578,814,817,819,831,832,833,981,983,1161 '0.5':517 '0.95':489 '1':804,865 '1.0':710,747,849 '100':1489 '128':805,815 '14':78 '16':281,1334 '17':533 '17.4':1203,1741,1864 '18':146,150,594,683,1087,1775,1850 '2':728,729 '2.0':711,748,850 '200':1363 '224':719,720 '26':69 '3':718,861 '3.0':712,749,851 '32argb':942 '3d':794 '4':1355 '4.0':713,750 '50':1373 '6.3':72 '768':806 '8':967 'access':365,1483 'accumul':608 'accur':1292,1897 'across':602,1812 'actor':119,669,1479,1511,1545,1677 'actor-bas':118,1510 'addit':993 'advanc':870 'ahead':1336 'ai':102,1920 'alloc':1286,1686 'allow':427 'ane':410,1455 'api':1539 'app':10,53,1310,1316,1352,1358,1433,1565 'appl':99,1917,1922 'apple-on-device-ai':98,1916 'applic':356,1587 'appropri':1805,1874 'array':558,691,788,795,800,816,830 'array-typ':787 'asset':1332 'assum':1729 'async':278,530,1538 'asynchron':1798 'attr':930,943 'audio':392,607,640,877 'audiofram':634 'auto':26,206,453,783,1819 'auto-gener':25,205,452,782,1818 'automat':903,1076 'avail':1312,1824 'avoid':1458 'await':298,327,538,648,1110,1219,1401,1413 'awar':1518 'back':1752 'background':390,431,1331,1427,1435,1447,1449,1544 'backtoarray':756 'backward':74 'backward-compat':73 'barcod':1189 'base':120,1512 'batch':122,542,796,1865 'batchinput':555,574 'batchoutput':570 'batchoutput.count':579 'batchoutput.features':582 'behavior':1708 'best':415 'better':551 'bitmapinfo':973 'bitspercompon':966 'block':285,1800 'bottleneck':1757 'boundari':82 'boundingbox':1163,1171 'breakdown':1278 'buffer':949,955,961,970,989,991 'bundl':261,1299,1308,1359,1878 'bundle.main.url':265,1405 'busi':398 'bytesperrow':968 'cach':121,339,1500,1521,1574,1583,1837 'call':549,618,672,697,1419 'camera':894 'cannot':1451 'carri':625 'case':1226,1808 'catch':1703 'caus':1652 'cellular':1360 'center':998 'center-crop':997 'cfdictionari':945 'cfstring':931 'cgcolorspacecreatedevicergb':972 'cgcontext':958 'cgimag':888,919,920,977,1113 'cgimagealphainfo.noneskipfirst.rawvalue':974 'cgrect':979 'chain':1007 'check':1857 'checklist':197,200,1795 'choos':377,1606 'class':28,208,222,455,458,785,1821 'classif':655,1116 'classification.confidence':1122 'classification.identifier':1121 'classificationobserv':1119 'classlabel':528,588 'cloudkit':1342 'code':115,1903 'color':1081 'common':191,194,1523 'common-mistak':193 'compat':75,419 'compil':304,307,341,501,1377,1385,1475,1568,1576,1580,1835,1840 'compiledurl':325,336,350 'complet':114,1183 'complex':1340 'comput':31,362,369,1063,1206,1279,1609,1690,1860 'computeplan':1217 'computeplan.deviceusage':1246 'computeplan.estimatedcost':1251 'computeplan.modelstructure':1230 'con':1307 'concurr':679 'confid':513,1158,1160,1169 'config':234,243,277,303,338,423,439,469,1100,1224,1418 'config.allowlowprecisionaccumulationongpu':443 'config.computeunits':236,425,433,441 'configur':33,45,135,138,242,276,302,337,359,435,468,1099,1223,1417,1537 'consider':1351 'constrain':1726 'content':128,1463 'contentsof':274,300,335,1097,1221,1415,1536 'context':957,975 'control':361 'convers':87,889,905,1792,1907 'coordin':1166 'copi':349,844 'core':5,40,48,1071,1262,1769,1924 'coreml':1,232,705,1092 'coremlrequest':1085,1103,1773,1848 'corevideo':915 'correct':1793,1854 'cover':18,56,1913 'cpu':34,379,389,400,412,1754 'cpu/gpu/ane':1282 'cpuandgpu':399 'cpuandneuralengin':411,426 'cpuon':388,434,1445,1457,1592 'crash':1655 'creat':609,675,792,837,1468,1662 'createpixelbuff':917 'creation':706 'crop':999 'cryptic':1653 'cvpixelbuff':885,925,928,1177 'cvpixelbuffercr':937 'cvpixelbuffergetbaseaddress':960 'cvpixelbuffergetbytesperrow':969 'cvpixelbufferlockbaseaddress':954 'cvpixelbufferunlockbaseaddress':988 'data':767,839,847,859,959,1648 'datapoint':856 'datatyp':807,862 'debugg':1290,1895 'decid':387 'decis':371 'default':383 'demand':1303,1321,1389 'deploy':66,182,185,1298,1876 'detect':1190 'devic':14,101,315,1207,1280,1384,1721,1744,1861,1885,1888,1919 'deviceusag':1245,1256 'dictionari':508,564,639 'direct':910 'dispatch':1281,1745,1862 'doc':1923 'document':1191 'done':1422 'doubl':516 'download':254,319,1317,1325,1327,1335,1361 'drag':211 'draw':976 'dynam':496 'e.g':355 'effici':417,1625 'els':951,1146,1231,1238 'enabl':1613 'energi':416,1624 'energy-effici':1623 'engin':37,382,414,1615,1736 'enter':1434 'error':1138,1695,1704,1827 'especi':1886 'estimatedcost':1250 'everi':345,1564,1668 'evict':1522 'exact':1640 'except':1367 'exchang':768 'expect':786,884,1636 'expens':1582 'extract':879 'fail':1712,1716 'failur':1834 'fall':1751 'fallback':1460,1707 'faster':445,1620 'featur':641,790,798,878 'finaloutput':1037 'first':1329 'flexibl':1345 'float':824,848 'float.self':722,759 'float32':808,863 'floatvalu':836 'foreground':1442 'format':1791 'forresourc':266,1406 'forward':626 'frame':632,644 'framework':93,1185,1197 'free':1437 'freez':1554 'fromdata':853 'frommultiarray':752 'func':916 'gb':1356 'generat':27,207,219,454,457,784,1820 'golden':483,487 'gpu':35,364,380,396,401,403,1453,1617 'gpu/ane':1438 'guard':947,1140,1225,1233 'handl':901,1696,1782,1786,1828 'handler':1175 'handler.perform':1180 'hardcod':1591 'height':923,940,964,965,986,987 'identifi':1155 'ignor':1628 'imag':124,158,161,473,509,565,773,880,882,1073,1077,1645,1763,1843 'image-preprocess':160 'import':231,704,914,1089,1091 'includ':117,873 'incorrect':1658 'increas':1315 'independ':676 'infer':17,123,432,1019 'init':1105 'initi':1324 'input':471,479,480,494,546,560,568,636,651,775,886,1633,1844,1871 'input/output':225,461 'inputfeatur':505,523,541 'inputs.map':559 'inputs/outputs':1826 'inspect':1204 'instanc':1466,1471,1666,1810 'instant':1311 'instrument':1259,1264,1267 'int':922,924 'integr':2,43,108,172,175,1066 'intern':628 'interop':740,845 'io':9,52,68,77,145,149,280,532,593,682,1086,1202,1333,1740,1774,1849,1863 'kcfallocatordefault':938 'kcvpixelbuffercgbitmapcontextcompatibilitykey':935 'kcvpixelbuffercgimagecompatibilitykey':933 'kcvpixelformattyp':941 'known':499 'label':525,658,1153,1168 'larg':292,1487,1547 'largemodel':1407 'latenc':1274 'launch':346,1566 'lazili':696 'learn':16 'legaci':1123,1778 'less':1890 'let':233,238,263,270,295,324,331,384,422,438,464,470,475,504,518,524,535,554,569,580,620,635,645,654,707,714,724,732,735,743,751,755,799,828,846,852,929,948,956,1024,1030,1036,1093,1101,1107,1115,1126,1132,1141,1152,1157,1162,1174,1216,1227,1234,1244,1249,1392,1403,1410,1603,1780 'librari':897 'lifecycl':1517,1682 'lifecycle-awar':1516 'limit':1354,1362 'live':95 'llms':606 'load':20,44,61,129,132,203,245,246,279,282,1271,1391,1519,1527,1541,1553,1671,1685,1699,1718,1797,1831 'loading-model':131 'locat':354 'longer':1348 'loss':448 'low':429 'low-prior':428 'machin':15 'main':287,1021,1237,1531,1801 'mainfunct':1235 'mainfunction.block.operations':1243 'mainmodel.prediction':1033 'mainoutput':1031,1041 'maintain':600 'make':139,142,449 'making-predict':141 'manag':187,190,1045,1424,1514,1679 'manual':244,904,1764 'match':1638 'materi':701 'math':730 'maximum':1344 'may':1756 'mb':1364,1374,1490 'measur':1899 'memori':186,189,1285,1423,1439,1485,1493,1688,1881 'memory-manag':188 'mismatch':1631,1651 'mistak':192,195,1524 'ml':6,41,49,1072,1263,1397,1770,1925 'ml-model-v2':1396 'mlarraybatchprovid':557 'mlcomputeplan':1201,1739,1856,1933 'mlcomputeplan.load':1220 'mldictionaryfeatureprovid':491,507,563,638 'mlfeatureprovid':30 'mlfeaturevalu':510,515,566,642,1629,1642 'mlmodel':273,311,334,911,1096,1470,1665,1929 'mlmodel.compilemodel':328,1571 'mlmodel.load':299,1414,1535 'mlmodelc':21,215,269,313,1379,1409,1562,1585 'mlmodelconfigur':235,360,424,440 'mlmodelconfiguration.computeunits':1803 'mlmultiarray':153,157,742,746,762,763,802,855,871 'mlpackag':22,213,309,1054,1560 'mlstate':596 'mltensor':38,63,144,148,681,684,709,716,753 'mltensor-io':147 'model':7,19,50,60,86,130,133,134,137,165,169,181,184,204,239,252,271,283,293,296,318,332,358,367,405,420,465,598,605,629,774,883,1005,1008,1016,1022,1050,1058,1074,1094,1104,1106,1131,1135,1270,1297,1372,1398,1411,1429,1465,1476,1488,1501,1513,1528,1548,1635,1681,1684,1698,1711,1714,1796,1809,1830,1836,1872,1906 'model-configur':136 'model-deploy':183 'model.makestate':622,673 'model.prediction':478,521,539,649 'model.predictions':572 'modelurl':264,275,301,1098,1222,1404,1416 'modern':1084 'monitor':1484 'multi':164,168,1004 'multi-model':163,1003 'multi-model-pipelin':167 'multiarray':643,744,754 'multidimension':690 'multipl':545,1469,1870 'mutat':858 'myimageclassifi':241,467 'myimageclassifierinput':472 'mymodel':267 'nativ':689 'need':402,907 'network':1347 'neural':36,381,413,1614,1735 'never':1467 'new':1664 'nil':953 'nlp':874 'non':772 'non-imag':771 'normal':736,996,1080,1165 'note':80 'nsbundleresourcerequest':1394 'nsnumber':821,822,835 'observ':1149 'observation.boundingbox':1164 'observation.labels.first':1154,1159 'odr':1369,1880 'offlin':1314 'older':1720,1887 'on-demand':1301,1319,1387 'on-devic':12,1382 'one':548 'op':407 'oper':694,731,1209,1241,1248,1253,1277,1284,1731,1747,1750 'operation.operatorname':1255 'optim':4,88,1062,1608,1909 'orient':1083,1787 'output':476,519,536,646,777 'output.classlabel':482 'output.classlabelprobs':486 'output.featurevalue':526,656 'outsid':259,1288,1894 'own':106 'packageurl':330 'palett':90 'paramet':368 'pass':613,1766 'pattern':116,872,995,1186,1901 'per':1276,1283,1746 'per-oper':1275 'perform':176,179,1199,1898 'performance-profil':178 'persist':353,1578,1838 'photo':891,896 'pipelin':166,170,1006,1046,1049,1759,1847 'pixel':1790 'pixelbuff':474,511,512,567,927,946,950,1178,1643 'pointer':840 'possibl':229 'postprocess':1012 'postprocessor':1023 'postprocessor.prediction':1039 'pre':1376 'pre-compil':1375 'pre/post-processing':693 'precis':447 'predict':23,62,140,143,450,531,543,592,603,617,624,912,1214,1273,1669,1701,1813,1833,1866,1892 'prefer':289 'preferredcomputedevic':1257 'preprocess':125,159,162,881,994,1010,1025,1035,1078,1783,1855 'preprocessor':1020 'preprocessor.prediction':1027 'pressur':1486,1504 'primari':766 'print':481,485,585,1120,1167,1254 'prioriti':430 'process':544,1450,1762,1869 'product':1295 'profil':64,177,180,1200,1269,1296 'program':1228,1229 'program.functions':1236 'properti':436 'pros':1306 'provid':459,1481,1706 'prune':91 'python':84,1911 'python-sid':83,1910 'quantiz':89 'ram':1891 'raw':1647 'rawinput':1029 'read':826 'reason':1598 'recognit':1188 'recompil':343,1559 'recreat':1815 'refer':201,202,1430,1900 'references/coreml-swift-integration.md':111,112,867,868,1001,1002,1506,1507,1904,1905 'regist':1495 'releas':1428,1499 'reload':1440 'request':1102,1133,1137,1181,1366,1393 'request.beginaccessingresources':1402 'request.endaccessingresources':1420 'request.imagecropandscaleoption':1172 'request.perform':1111 'request.results':1143 'requir':1013,1326,1346 'reshap':723,725 'resiz':1079 'resourc':1304,1322,1390,1462,1691,1724 'result':581,702,1108,1142,1151,1293,1659 'result.featurevalue':586 'results.first':1117 'retriev':484,488 'return':952,990,1147,1232,1239,1443 'reus':1674,1811 'review':196,199,1794 'review-checklist':198 'run':47,695,1059,1070,1213,1287,1732,1893 'runtim':256,306,1654,1842 'scalartyp':721 'scale':1788 'scalefil':1173 'scan':1192 'scope':81 'second':1551 'see':110,866,1000,1193,1505 'select':94 'sendabl':663 'separ':1015 'sequenc':604,797 'sequenti':1018 'server':322,1343 'session':393 'set':1456,1804 'setup':1341,1349 'shape':803,860 'shapedarray':698 'share':1464,1482 'side':59,85,1912 'signific':1687 'silent':1459,1657 'singl':668 'size':1318,1350,1873 'skill':55,103,105,1198,1921 'skill-coreml' 'skip':1381,1694 'slight':446 'smaller':1323 'softmax':733 'sosumi.ai':1927,1931,1935 'sosumi.ai/documentation/coreml)':1926 'sosumi.ai/documentation/coreml/mlcomputeplan-1w21n)':1934 'sosumi.ai/documentation/coreml/mlmodel)':1930 'source-dpearson2699' 'space':971,1082 'specif':1597 'state':591,601,610,621,630,653,660,677 'store':258,1353 'strategi':1305,1877 'stream':680 'stride':864 'stringvalu':529,589,659 'struct':462 'sub':1057 'sub-model':1056 'support':357,1588 'swift':42,58,71,107,221,230,262,294,323,421,437,463,503,534,553,619,688,703,791,913,1017,1088,1125,1215,1386 'swift-nat':687 'system':386,1605 'tabl':372 'tag':1370,1395 'take':1550 'target':67,1884 'task':391,671,1448 'templat':1265 'tensor':708,737 'tensor.mean':738 'tensor.reshaped':726 'tensor.shapedarray':757 'tensor.softmax':734 'tensor.standarddeviation':739 'test':127,1882 'text':1187 'thread':288,1532,1802 'threshold':514 'throughput':552 'time':348,502,1272,1338,1817 'token':875 'topic-accessibility' 'topic-agent-skills' 'topic-ai-coding' 'topic-apple' 'topic-claude-code' 'topic-codex-skills' 'topic-cursor-skills' 'topic-ios' 'topic-ios-development' 'topic-liquid-glass' 'topic-localization' 'topic-mapkit' 'tri':240,272,297,326,333,466,477,506,520,537,556,562,571,637,647,745,801,854,1026,1032,1038,1095,1109,1128,1179,1218,1400,1412 'trigger':1492 'true':444,934,936 'type':224,460,769,789,1051,1630,1639,1650,1825 'ui':1556 'uiapplication.didreceivememorywarningnotification':1497 'unit':32,363,370,1064,1610 'unknown':590,1156,1258 'unless':79,1593 'unload':1425 'unsafemutablerawpoint':857 'unsupport':408,1749 'url':249,342,1577 'use':226,316,374,492,595,652,664,778,887,1047,1067,1211,1260,1330,1368,1444,1452,1477,1534,1600,1641,1675,1738,1772,1807,1822,1845,1867 'v2':1399 'valu':373,810,823,827,829 'var':926 'verifi':1743,1859 'vision':171,174,898,1065,1068,1090,1184,1196,1768,1781,1785,1846 'vision-framework':1195 'vision-integr':173 'vncoremlmodel':1129 'vncoremlrequest':39,900,1124,1134,1777,1852 'vnimagerequesthandl':1176 'vnmodel':1127,1136 'vnrecognizedobjectobserv':1145 'vs':1300,1879 'warn':1494 'wast':347 'whenev':228 'width':921,939,962,963,984,985 'withextens':268,1408 'without':284 'work':151,155,760,1313 'working-with-mlmultiarray':154 'write':809 'x':980 'xcode':217,1044,1294 'xcode-manag':1043 'y':982 'zero':715,717,843 'zero-copi':842","prices":[{"id":"07692ff8-8219-412f-9115-33fcc68fa8c8","listingId":"fac86b7d-9b85-4e4f-83d1-fe5925b9dbb1","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"dpearson2699","category":"swift-ios-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T20:34:25.384Z"}],"sources":[{"listingId":"fac86b7d-9b85-4e4f-83d1-fe5925b9dbb1","source":"github","sourceId":"dpearson2699/swift-ios-skills/coreml","sourceUrl":"https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/coreml","isPrimary":false,"firstSeenAt":"2026-04-18T22:00:53.668Z","lastSeenAt":"2026-05-18T18:53:40.868Z"},{"listingId":"fac86b7d-9b85-4e4f-83d1-fe5925b9dbb1","source":"skills_sh","sourceId":"dpearson2699/swift-ios-skills/coreml","sourceUrl":"https://skills.sh/dpearson2699/swift-ios-skills/coreml","isPrimary":true,"firstSeenAt":"2026-04-18T20:34:25.384Z","lastSeenAt":"2026-05-07T22:40:33.820Z"}],"details":{"listingId":"fac86b7d-9b85-4e4f-83d1-fe5925b9dbb1","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"dpearson2699","slug":"coreml","github":{"repo":"dpearson2699/swift-ios-skills","stars":599,"topics":["accessibility","agent-skills","ai-coding","apple","claude-code","codex-skills","cursor-skills","ios","ios-development","liquid-glass","localization","mapkit","networking","storekit","swift","swift-concurrency","swiftdata","swiftui","widgetkit","xcode"],"license":"other","html_url":"https://github.com/dpearson2699/swift-ios-skills","pushed_at":"2026-04-26T21:04:17Z","description":"Agent Skills for iOS 26+, Swift 6.3, SwiftUI, and modern Apple frameworks","skill_md_sha":"d3aeac2f05b0ce51d2f776007c081d2db03e5367","skill_md_path":"skills/coreml/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/dpearson2699/swift-ios-skills/tree/main/skills/coreml"},"layout":"multi","source":"github","category":"swift-ios-skills","frontmatter":{"name":"coreml","description":"Integrate and optimize Core ML models in iOS apps for on-device machine learning inference. Covers model loading (.mlmodelc, .mlpackage), predictions with auto-generated classes and MLFeatureProvider, compute unit configuration (CPU, GPU, Neural Engine), MLTensor, VNCoreMLRequest, MLComputePlan, multi-model pipelines, and deployment strategies. Use when loading Core ML models, making predictions, configuring compute units, or profiling model performance."},"skills_sh_url":"https://skills.sh/dpearson2699/swift-ios-skills/coreml"},"updatedAt":"2026-05-18T18:53:40.868Z"}}