svprdga
svprdga

Reputation: 2549

Import ML Kit dependencies on iOS

I'm following this documentation to implement ML Kit for iOS, but I can't figure out which import should I use to create a VisionImage.

The pod I am using is GoogleMLKit/BarcodeScanning.

I have tried with the following imports without luck:

import MLImage
import MLKit
import MLKitBarcodeScanning

Which is the right import to create a VisionImage and then a BarcodeScanner?

Upvotes: 1

Views: 2398

Answers (2)

Tarun Tyagi
Tarun Tyagi

Reputation: 10112

According to MLKit Release Notes (as of June 29, 2021), the correct pod artifact names are listed like this. enter image description here


Update your pod declaration to the latest version like this.

pod 'MLKitBarcodeScanning', '1.3.0'

After this change, do a pod install and now you can use following two imports to work with MLKit on iOS.

import MLKitBarcodeScanning
import MLKitVision

Upvotes: 1

Dong Chen
Dong Chen

Reputation: 882

At top of the documentation you referenced, there is a link to the ML Kit quickstart sample, where you can find sample code in both Swift and Objective-C showing you how to import ML Kit. Specifically, in Swift you can import MLKit and in Objective-C @import MLKit;.

Upvotes: 0

Related Questions