Skip to content

Commit

Permalink
docs: Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronlab committed Nov 30, 2020
1 parent 70d7c5e commit cfdb0e6
Showing 1 changed file with 35 additions and 26 deletions.
61 changes: 35 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -36,31 +36,32 @@ SweetCardScanner is a fast and simple Card Scanner library written in Swift, bas
7. The default value of `invalidNames: Array<String>?` 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

Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit cfdb0e6

Please sign in to comment.