Install from Swift Package Manager, using this repository as the url.
If you don't have an account with Veryfi, please go ahead and register here: https://hub.veryfi.com/signup/api/.
The veryfi library can be used to communicate with Veryfi API. All available functionality is described here.
Below is the sample Swift code using veryfi to OCR and extract data from a document:
import UIKit
import VeryfiSDK
class ViewController: UIViewController {
let clientId = "your_client_id"
let clientSecret = "your_client_secret"
let username = "your_username"
let apiKey = "your_password"
override func viewDidLoad() {
super.viewDidLoad()
let client = Client(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey)
let file = "receipt"
let url = Bundle(for: Self.self).url(forResource: file, withExtension: "jpeg")!
let fileData = try? Data(contentsOf: url)
client.processDocument(fileName: file, fileData: fileData!) { result in
switch result {
case .success(let data):
print("Succeded")
case .failure(let error):
print("Error")
}
}
}
}
import UIKit
import VeryfiSDK
class ViewController: UIViewController {
let clientId = "your_client_id"
let clientSecret = "your_client_secret"
let username = "your_username"
let apiKey = "your_password"
override func viewDidLoad() {
super.viewDidLoad()
let client = Client(clientId: clientId, clientSecret: clientSecret, username: username, apiKey: apiKey)
let documentId = "your_document_id"
var parameters = [String : Any]()
parameters["category"] = "Meals & Entertainment"
parameters["total"] = 11.23
client.updateDocument(documentId: documentId, params: parameters) { result in
switch result {
case .success(let data):
print("Succeded")
case .failure(let error):
print("Error")
}
}
}
}
- Create new branch for your code
- Change version in
Constants.swift
- Commit changes and push to Github
- Create PR pointing to master branch and add a Veryfi member as a reviewer
- Tag your commit with the new version
- The new version will be accesible through Swift Package Manager
Visit https://docs.veryfi.com/ to access integration guides and usage notes in the Veryfi API Documentation Portal
If you run into any issue or need help installing or using the library, please contact [email protected].
If you found a bug in this library or would like new features added, then open an issue or pull requests against this repo!
To learn more about Veryfi visit https://www.veryfi.com/