Skip to content

Instantly share code, notes, and snippets.

@yoiang
Created May 8, 2015 14:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yoiang/953f8005c624fb5a6c51 to your computer and use it in GitHub Desktop.
Save yoiang/953f8005c624fb5a6c51 to your computer and use it in GitHub Desktop.
//
// TesseractOCR+PromiseKit.swift
//
// Created by Ian G on 5/1/15.
//
import PromiseKit
import TesseractOCR
extension G8Tesseract
{
func promise() -> Promise< String > {
return Promise< String >({ (fulfill, reject) -> Void in
dispatch_async(dispatch_get_global_queue(0, 0), { () -> Void in
if self.recognize() == true
{
fulfill(self.recognizedText)
} else
{
reject(NSError(domain: "Recognize Failed", code: 0, userInfo: nil) )
}
})
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment