The project helps to get started with swiftOCR in xcode 8.2, swift 3 from here https://github.com/garnele007/SwiftOCR
- Make a new project in Xcode 8.2
- Copy the frameworks folder from this repository, or from the original repo you find here https://github.com/garnele007/SwiftOCR.
-
Paste it in your projct folder(right where you find the .xcodeproj file).
-
Go inside the frameworks folder, you will find three files
1. SwiftOCR.xcodeproj
2. SwiftOCR(folder)
3. SwiftOCRTests(folder)
- Drag and drop the SwiftOCR.xcodeproj file into your project inside the project (Make sure you do not create the workspace, this happens if you drop the file outside the project)
- Now go to frameworks->SwiftOCR->GPUImage-master->framework, you will find GPUImage.xcodeproj there.
- Drag and drop this file too into the project.
- Go to targets->General scroll down to Embedded Binaries
- Click +Add
- Type GPUImage.framework, select the one that is outside the scope of you project (having iOS)
- Click +Add again, and type Swiftocr.framework, and select again the one with iOS.
- import SwiftOCR in before using it, and use it on and image like this (i Have used it on the image imageTest)
self.ocrInstance.recognize(UIImage.init(named: "imageTest")!) { [weak self] recognizedString in
DispatchQueue.main.async {
print(recognizedString)
print(self?.ocrInstance.currentOCRRecognizedBlobs ?? "Recoginzed Blob is empty")
}
}
refer https://github.com/garnele007/SwiftOCR for more options.