SweetCardScanner
SweetCardScanner is a fast and simple Card Scanner library written in Swift, based on CreditCardScanner and Reg libraries by @yhkaplan so that users can pay much more easily by capturing their credit/debit card with the rear camera.
Requirements
- iOS 13.0+ (due to SwiftUI, Vision Framework)
- Tesed on iOS 14.1 with iPhone X
Installation
-
In Xcode, add SwiftPM with the URL of this repository:
Usage
-
Add
NSCameraUsageDescription
intoInfo.plist
for Camera Useage Description. -
import SweetCardScanner
on top of theContentView.swift
. -
Now, you can use like
SweetCardScanner()
inside of the body. -
Also, you can use completion clousures, such as
.onDismiss
,.onError
,.onSuccess
right afterSweetCardScanner()
like below. -
If you want to turn off the camera when you move to the result view, you will need to use your own customized navigation status trick. (Check the example below)
CreditCardScannerError
CreditCard
Example
You can customize your own view with SweetCardScanner, and SwiftUI like below.