GithubHelp home page GithubHelp logo

veryfi / veryfi-swift Goto Github PK

View Code? Open in Web Editor NEW
9.0 6.0 1.0 2.62 MB

Swift framework for communicating with the Veryfi OCR API

Swift 100.00%
invoice invoice-parser ios ios-swift mobile ocr ocr-library receipt receipt-capture sdk

veryfi-swift's Introduction

Swift 5.3 code coverage License: MIT

Installation

Install from Swift Package Manager, using this repository as the url.

Getting Started

Obtaining Client ID and user keys

If you don't have an account with Veryfi, please go ahead and register here: https://hub.veryfi.com/signup/api/.

Veryfi Swift Client Library

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:

Process 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")
            }
        }
    }
}

Update 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 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")
            }
        }
    }
}

Release

  1. Create new branch for your code
  2. Change version in Constants.swift
  3. Commit changes and push to Github
  4. Create PR pointing to master branch and add a Veryfi member as a reviewer
  5. Tag your commit with the new version
  6. The new version will be accesible through Swift Package Manager

Need help?

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/

veryfi-swift's People

Contributors

alejouribesanchez avatar giraldogdiego avatar kaevan89 avatar seramirezdev avatar sgiraldog avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

sgiraldog

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.