SharkCardScan is a Credit/Debit Card scanner built using Apple's Vision Framework.

Related tags

Image ios-card-scan
Overview

SharkCardScan

SharkCardScan is a Credit/Debit Card scanner built using Apple's Vision Framework.

SharkCardScan allows you to quickly implement a card scanner inside of your own app.

SharkCardScan is built and maintained with love by the Gymshark Engineering Team 💙 📱

Usage

It's possible to get started quickly with the following snippet.

        let scannerVC = SharkCardScanViewController(viewModel: CardScanViewModel(noPermissionAction: { [weak self] in
            
            self?.showNoPermissionAlert()
            
        }, successHandler: { (response) in
            print("Expiry 💣: \(response.expiry ?? "")")
            print("Card Number 💳: \(response.number)")
            print("Holder name 🕺: \(response.holder ?? "")")
        }))
        

Here we handle the No Camera Permission error, from the ViewModeland our successHandler is called upon receipt of finding a card number, and the expiry and card holders name, albeit, we can call success if only a valid card number is found.

Styling

SharkCardScanViewController initialiser takes a default parameter for styling, which you can specify your own, if you wish to amend fonts/colours.

SharkCardScanViewController(viewModel: CardScanViewModel{...}, styling: MyOwnCardScannerStyling())

CardScanStyling is a protocol, your styling struct must conform too with the following properties you have to set;

public protocol CardScanStyling {
    var instructionLabelStyling: LabelStyling { get set }
    var cardNumberLabelStyling: LabelStyling { get set }
    var expiryLabelStyling: LabelStyling { get set }
    var holderLabelStyling: LabelStyling { get set }
    var backgroundColor: UIColor { get set }
}

NB: By using the default parameter, and using our DefaultStyling struct instance, the font will only have fixed sizes, for now, rather than being dynamic - one for us to fix later (or send us a PR?!)

Other Customisations

ACardScanViewModel has a insturctionText property, if you wish to override the default instruction text that is shown on the viewer.

Installation

Swift Package Manager (SPM) To install SharkCardScan using Swift Package Manager you can follow the tutorial published by Apple using the URL for the SharkCardScan repo with the current version:

  1. In Xcode, select “File” → “Swift Packages” → “Add Package Dependency”
  2. Enter https://github.com/gymshark/ios-card-scan.git
Comments
  • task/update_instruction_text

    task/update_instruction_text

    Updates the instruction text

    Type of change

    Please delete options that are not relevant.

    • [✅] New feature (non-breaking change which adds/updates functionality)
    opened by Chris-ios-92 0
  • 🐛 Chore/input output crash fix

    🐛 Chore/input output crash fix

    Pull Request Template

    Description

    This fixes a crash identified, if the user had declined camera permission, yet we still tried adding a nil input connection to the AVCapture Session.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [x ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] This change requires a documentation update

    How Has This Been Tested?

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [x ] Unit Tests

    Checklist:

    • [x ] My code follows the style guidelines of this project
    • [ x] I have performed a self-review of my own code
    • [ x] I have commented my code, particularly in hard-to-understand areas
    • [ x] I have made corresponding changes to the documentation
    • [ x] My changes generate no new warnings
    • [ x] I have added tests that prove my fix is effective or that my feature works
    • [ x] New and existing unit tests pass locally with my changes
    • [ x] Any dependent changes have been merged and published in downstream modules
    • [ x] I have checked my code and corrected any misspellings
    opened by TheiOSDude 0
  • Update README.md

    Update README.md

    Pull Request Template

    Description

    This updates the Readme file for the cloning instructions over HTTPS.

    Type of change

    Please delete options that are not relevant.

    • [x] This change requires a documentation update

    How Has This Been Tested?

    No Testing required, its just a readme :)

    Checklist:

    • [ x] My code follows the style guidelines of this project
    • [ x] I have performed a self-review of my own code
    • [ x] I have commented my code, particularly in hard-to-understand areas
    • [ x] I have made corresponding changes to the documentation
    • [ x] My changes generate no new warnings
    • [ x] I have added tests that prove my fix is effective or that my feature works
    • [ x] New and existing unit tests pass locally with my changes
    • [ x] Any dependent changes have been merged and published in downstream modules
    • [ x] I have checked my code and corrected any misspellings
    opened by TheiOSDude 0
  • 📃 Updates Readme

    📃 Updates Readme

    Pull Request Template

    Description

    Please include a summary of the change and which issue is fixed. Please also include relevant motivation and context.

    Fixes # (issue)

    Type of change

    Please delete options that are not relevant.

    • [ ] Bug fix (non-breaking change which fixes an issue)
    • [ ] New feature (non-breaking change which adds functionality)
    • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
    • [ ] This change requires a documentation update

    How Has This Been Tested?

    Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

    • [ ] Unit Tests

    Checklist:

    • [x] My code follows the style guidelines of this project
    • [x] I have performed a self-review of my own code
    • [x] I have commented my code, particularly in hard-to-understand areas
    • [x] I have made corresponding changes to the documentation
    • [x] My changes generate no new warnings
    • [ ] I have added tests that prove my fix is effective or that my feature works
    • [x] New and existing unit tests pass locally with my changes
    • [ ] Any dependent changes have been merged and published in downstream modules
    • [ ] I have checked my code and corrected any misspellings
    DO NOT MERGE 
    opened by TheiOSDude 0
  • Unable to build for arm64-apple-ios-simulator

    Unable to build for arm64-apple-ios-simulator

    Integrated card scan module as a SPM module in my flutter application.

    Upgraded flutter SDK flutter_macos_arm64_3.3.4-stable for M1 chip

    application works in Xcode having Rosetta support as it will create x86_64-apple-ios-simulator in derived data but when running flutter run using VSCode or terminal does not run the app instead prompts following error .

    build: Could not find module 'SharkCardScan' for target 'x86_64-apple-ios-simulator'; found: arm64-apple-ios-simulator, at:

    Looks like the iOS-card-scan doesn't support arm64

    Any way to make it work instead of using in Rosetta mode as the hot reloading and dev tools aren't working from Xcode

    note -: Even if I run in Xcode without Rosetta support the same error will prompt

    opened by GaniduAsh 0
  • I don't see the close button image on Scanner screen.

    I don't see the close button image on Scanner screen.

    I have presented cardScanner ViewController, but it is not showing the close icon at top right corner. Maybe some issue with naming convention but I cant edit your package. Screenshot 2022-06-24 at 2 49 12 PM

    opened by ShahidIqbal452 1
Owner
Gymshark
The home of Gymshark's engineering team
Gymshark
Scanner for decks of cards with bar codes printed on card edges

The Nettle Magic Project This deck of cards has a bar code printed on the edge of each card. Scanning these bar codes would reveal where every card is

Paul Nettle 793 Dec 14, 2022
A simple macOS app to read code from images, written purely in Swift using Vision Framework.

CodeReader A simple macOS app to read code from images, written purely in Swift using Vision Framework. Usage Drag an image Click the convert button R

Md Ibrahim Hassan 44 Nov 20, 2022
Autocrop - A face-aware crop utility using OSX's Vision framework

autocrop A high-performance face-aware crop utility using OSX's Vision framework

Alex Dong 0 Jan 19, 2022
Simple command-line utility for performing OCR using Apple's Vision framework

ocrit Runs Vision's OCR on input images and outputs corresponding txt files for each image, or writes the recognized results to standard output. USAGE

Guilherme Rambo 61 Nov 23, 2022
QR Barcode Scanner For Swift

QRBarcodeScanner Example To run the example project, clone the repo, and run pod

null 0 Dec 22, 2021
Utilizing Apple's Vision Framework to center faces in CGImage.

FaceCrop CGImage extension that utilizes Apple's Vision Framework to detect and center faces. Usage cgImage.faceCrop { [weak self] result in switc

Ancestry.com 40 Nov 24, 2022
Picture anonymiser using Vision face recognition

?? Anonymojizer [WIP] Anonymize people in photos by replacing their faces by emojis. How to use it ? Pick a photo from the gallery Choose an emoji The

Kaww 1 Dec 20, 2021
✂️ Detect and crop faces, barcodes and texts in image with iOS 11 Vision api.

ImageDetect ImageDetect is a library developed on Swift. With ImageDetect you can easily detect and crop faces, texts or barcodes in your image with i

Arthur Sahakyan 299 Dec 17, 2022
Screen translator for macOS with Apple Vision API and IBM Watson, Google Cloud Translator

Swifty-OCR-Translator Screen translator for macOS with Apple Vision API and IBM Watson, Google Cloud Translator Usage Select Translator Fill in the AP

Kwangmin Bae 21 Sep 13, 2022
Crop faces, inside of your image, with iOS 11 Vision api.

FaceCropper Requirements Xcode 9.0 (beta) or higher. iOS 11.0 (beta) or higher. (It is possible to import this library under the iOS 11. But it won't

Taejun Kim 488 Dec 17, 2022
A demo of face recognition SwiftUI app on iOS. Based on Vision, OpenCV, Dlib and ResNet.

iOS-FaceRecognizer A demo of face recognition SwiftUI app on iOS, build for iPad. Based on Vision, OpenCV, Dlib and ResNet. Features Add face image an

js_john 11 Aug 20, 2022
A custom ImageView that is used to cover the surface of other view like a scratch card, user can swipe the mulch to see the view below.

MCScratchImageView GIF Showcase Requirments iOS 8.0+ Xcode 7.2+ Swift 4.0 Installation CocoaPods pod "MCScratchImageView" Manually Just drag MCScratch

Jaylen Bian 359 Dec 17, 2022
ThreeDCardView - Library that you can see images with a 3D card 🌌

?? ThreeDCardView Usage First you have to import 'ThreeDCardView' import 'ThreeDCardView' Create ThreeDCardView and set the frame let threeDCardView:T

Fomagran 4 Jul 9, 2022
A GPU accelerated image and video processing framework built on Metal.

MetalPetal An image processing framework based on Metal. Design Overview Goals Core Components MTIContext MTIImage MTIFilter MTIKernel Optimizations C

null 1.5k Jan 4, 2023
Random image generator built with Swift

Ody Ody is an easy to use random image generator built with Swift. Perfect for placeholders! Built with [Silo] silojq, [LoremPixel] images, and FillDu

Jose Quintero 46 Dec 14, 2020
Image gallery similar to Adidias' app, built in SwiftUI

TripleStackGallery TripleStackGallery is a image gallery component, which displays a set of images as a stack of three images, always displaying the i

Tomás Martins 5 Aug 29, 2022
An NSFW image detector for Swift built as an extension on UIImage.

Swift_NSFW_Detector An NSFW image detector for Swift built as an extension on UIImage. If you've ever allowed users to share images you are probably w

Chris Brown 5 Nov 27, 2022
GPUImage 3 is a BSD-licensed Swift framework for GPU-accelerated video and image processing using Metal.

GPUImage 3 Janie Clayton http://redqueengraphics.com @RedQueenCoder Brad Larson http://www.sunsetlakesoftware.com @bradlarson contact@sunsetlakesoftwa

Brad Larson 2.4k Jan 3, 2023
IOS UIImage processing functions using the vDSP/Accellerate framework for speed.

UIImage Image Processing extensions using the vDSP/Accelerate framework.

null 372 Sep 1, 2022