Swiftpack.co - CardScan-ai/insurance-card-scan-ios as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by CardScan-ai.
CardScan-ai/insurance-card-scan-ios 3.0.1
Health Insurance Card Scanning for iOS
⭐️ 1
🕓 Yesterday
iOS
.package(url: "https://github.com/CardScan-ai/insurance-card-scan-ios.git", from: "3.0.1")

InsuranceCardScan

Our InsuranceCardScan swift package makes it easy to add health insurance card scanning and eligibility verification to any iOS application in 5 minutes or less.

Sandbox API Keys

Create an account on the dashboard to generate a sandbox API key.

Check out the End User authentication section for how to generate short lived user JWTs

Quick Start

Installation

Find the Add Package Dependency menu item in Xcode, File > Swift Packages.

Then enter the Github repository for the package:

https://github.com/CardScan-ai/insurance-card-scan-ios

Usage

Import the package into your Xcode project files:

import InsuranceCardScan

Basic Example:

Create the CardScannerViewController using the generated session token, present in the current view controller and register a callbacks to handle updates and errors.

import UIKit

class ViewController: UIViewController {
    @IBOutlet weak var cardScanButton: UIButton!

    @IBAction private func didTapScanCard(_ sender: UIButton) {
        startCardScanning()
    }

    private func startCardScanning() {
        // Replace <GENERATED_USER_TOKEN> with the user token generated from the server
        // See https://docs.cardscan.ai/authentication#end-user

        let userToken = "<GENERATED_USER_TOKEN>"
        
        let onSuccessCallback: (InsuranceCard) -> Void = { card in
            print("Card Scanned Successfully! - \(card)")
        }

        let onErrorCallback: (CardScanError) -> Void = { error in
            print("Card Scanning Error: \(error.localizedDescription)")
        }
        
        // Configure and present the CardScanViewController
        let config = CardScanConfig(sessionToken: userToken, live: false, onSuccess: onSuccessCallback, onError: onErrorCallback)
        let cardScanViewController = CardScanViewController()
        cardScanViewController.config = config
        
        // Present the CardScanViewController
        present(cardScanViewController, animated: true)
    }
}

Available Properties

CardScanViewController should be passed a CardScanConfig instance with properties for server connection, callback handling and UI customization.

CardScanConfig(
  // Required
  sessionToken: token,
  live: false,
  onSuccess: onSuccess,

  // Recommended
  onCancel: onCancel,
  onError: onError,

  //eligibility
  eligibility: eligibility,
  onEligibilitySuccess: onEligibilitySuccess,
  onEligibilityError: onEligibilityError,

  // Optional
  backsideSupport: scanBackside,
  onRetry: onRetry,
  onProgress: onProgress,

  // UI Customization
  messages: messages,
  messageStyle: messagesStyle,
  autoSwitchActiveColor: autoSwitchActiveColor,
  autoSwitchInactiveColor: autoSwitchInactiveColor,
  progressBarColor: progressBarColor,
  widgetBackgroundColor: widgetBackgroundColor,
  logging: logging,
)

Documentation

Checkout the full docs and iOS / Swift Widget docs.

GitHub

link
Stars: 1
Last commit: 2 days ago
Advertisement: IndiePitcher.com - Cold Email Software for Startups

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics