From cfdb0e6d503e61dadd157c844f2b2f68f19dabd2 Mon Sep 17 00:00:00 2001 From: Aaron Lee Date: Tue, 1 Dec 2020 00:14:13 +0900 Subject: [PATCH] docs: Update README.md --- README.md | 61 +++++++++++++++++++++++++++++++------------------------ 1 file changed, 35 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index c5dca34..1311cd6 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Platform: iOS 13+](https://img.shields.io/badge/platform-iOS%2013%2B-blue?style=flat&logo=apple) ![SwiftPM compatible](https://img.shields.io/badge/SPM-compatible-brightgreen?style=flat&logo=swift) [![License: MIT](https://img.shields.io/badge/license-MIT-lightgrey?style=flat)](https://github.com/aaronLab/SweetCardScanner/blob/main/LICENSE) -[![Release version](https://img.shields.io/badge/pre--release-v0.1.3-blue)](https://github.com/aaronLab/SweetCardScanner/releases) +[![Release version](https://img.shields.io/badge/release-v1.0.0-blue)](https://github.com/aaronLab/SweetCardScanner/releases) # SweetCardScanner @@ -36,31 +36,32 @@ SweetCardScanner is a fast and simple Card Scanner library written in Swift, bas 7. The default value of `invalidNames: Array?` is `["expiration", "valid", "since", "from", "until", "month", "year"]` 8. Also, you can use completion clousures, such as `.onDismiss`, `.onError`, `.onSuccess` right after `SweetCardScanner()` like below. 9. 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)](#example) - ```Swift - var body: some View { - /* - You can add some words "in lowercase" to try to skip in recognition to improve the performance like bank names, - such as "td", "td banks", "cibc", and so on. - Also you can try to add some words "in lowercase" for invalid names, such as "thru", "authorized", "signature". - Or you can just simply usw liek "SweetCardScanner()" - */ - SweetCardScanner( - wordsToSkip: ["td", "td bank", "cibc"], - invalidNames: ["thru", "authorized", "signature"] - ) - .onDismiss { - // Do something when the view dismissed. - } - .onError { error in - // The 'error' above gives you 'CreditCardScannerError' struct below. - print(error) - } - .onSuccess { card in - // The card above gives you 'CreditCard' struct below. - print(card) - } - } - ``` + +```Swift +var body: some View { + /* + You can add some words "in lowercase" to try to skip in recognition to improve the performance like bank names, + such as "td", "td banks", "cibc", and so on. + Also you can try to add some words "in lowercase" for invalid names, such as "thru", "authorized", "signature". + Or you can just simply usw liek "SweetCardScanner()" + */ + SweetCardScanner( + wordsToSkip: ["td", "td bank", "cibc"], + invalidNames: ["thru", "authorized", "signature"] + ) + .onDismiss { + // Do something when the view dismissed. + } + .onError { error in + // The 'error' above gives you 'CreditCardScannerError' struct below. + print(error) + } + .onSuccess { card in + // The card above gives you 'CreditCard' struct below. + print(card) + } + } +``` ## CreditCardScannerError @@ -91,6 +92,14 @@ public struct CreditCard { } ``` +## CardVendor + +```Swift +public enum CardVendor: String { + case Unknown, Amex, Visa, MasterCard, Diners, Discover, JCB, Elo, Hipercard, UnionPay +} +``` + ## Example You can customize your own view with SweetCardScanner, and SwiftUI like below.