Latest 0.0.1
Homepage https://github.com/tattn/TTScanView
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, Foundation
Authors

CocoaPods Status
License

A simple QR code or barcode reader.

The reader can change into a viewer.


TTToast

When running on real iPhone, the upper example program shows a camera view instead of black screen.

Installation

CocoaPods

Install with CocoaPods by adding the following to your Podfile:

platform :ios, '8.0'
pod 'TTScanView'

Manually

Add TTScanView.swift to your project.

Examples

let scanView = ScanView(frame: CGRectMake(0, 0, 300, 300))!
self.view.addSubview(scanView)

// show QR code
scanView.showQRcode("Hello world")

// read QR code
scanView.showCamera(ScanView.CameraType.QRcode)

// read barcode
scanView.showCamera(ScanView.CameraType.Barcode)

// set delegate
scanView!.delegate = self

// MARK: -  ScanDelegate

// finished reading QR code / barcode
func detectedCode(code: String) {
    print(code)
}

Objective-C

If you use this library in Objective-C, you need to import the following:

#import <TTScanView/TTScanView.h>
#import <TTScanView/TTScanView-Swift.h> // auto-generated header file

and set [Build Settings]-[Build Options]-[Embeedded Content Contains Swift Code] to Yes.

Examples for Objective-C

TTScanView* scanView = [TTScanView new];
scanView.delegate = self;

[scanView showQRcode:@"Hello world"];
[scanView showCamera: TTScanViewCameraTypeQRcode];

- (void)detectedCode:(NSString *)code {
    NSLog(@"%@n", code);
}

Contributing

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

License

TTScanView is released under the MIT license. See LICENSE for details.

Latest podspec

{
    "name": "TTScanView",
    "version": "0.0.1",
    "summary": "A library which shows/reads QR code or barcode easily",
    "homepage": "https://github.com/tattn/TTScanView",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Tatsuya Tanaka": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/tattn/TTScanView.git",
        "tag": "v0.0.1"
    },
    "source_files": "TTScanView/TTScanView/*.{swift,h}",
    "public_header_files": "TTScanView/TTScanView/TTScanView.h",
    "frameworks": [
        "UIKit",
        "Foundation"
    ],
    "requires_arc": true
}

Pin It on Pinterest

Share This