Created
May 8, 2015 14:48
-
-
Save yoiang/953f8005c624fb5a6c51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// 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