xslim / TKScanKit

Use multiple scanning SDKs with one clean API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

TKScanKit

TKScanKit is a CocoaPods only library, inspired by ARAnalytics, which provides a clean API for different scanning SDKs. It does this by using subspecs from CocoaPods to let you decide which libraries you'd like to use.

Usage

To get list of loaded providers:

NSArray *items = [TKScanKit availableProviders];

To start scanning:

TKScanningProvider *provider = [TKScanKit newProviderWithName:@"ZBarSDK"];
provider.delegate = self;
[provider presentScannerFromViewController:viewController];
self.scanningProvider = provider;

Or

self.currentProvider = [TKScanKit presentScanner:@"ZBarSDK" fromViewController:self];

And became a delegate of TKScanningProviderDelegate:

- (void)scanningProvider:(TKScanningProvider *)provider didFinishScanningWithText:(NSString *)text info:(NSDictionary *)info
{
    NSString *title = [NSString stringWithFormat:@"Scanned: %@", text];
    [self showMessageWithTitle:title text:[info description]];
}

- (void)scanningProviderDidCancel:(TKScanningProvider *)provider { }

- (void)scanningProvider:(TKScanningProvider *)provider didFailedScanningWithError:(NSError *)error
{
    [self showMessageWithTitle:@"Error" text:[error localizedDescription]];
}

To run the example project:

  • clone the repo
  • run pod install from the TKScanKitApp directory
  • Try it

Supported scanning providers

Feel free to add more!

Installation

TKScanKit is available through CocoaPods, to install it simply add the following line to your Podfile:

pod "TKScanKit"

Author

Taras Kalapun, t.kalapun@gmail.com

License

TKScanKit is available under the MIT license. See the LICENSE file for more info.

About

Use multiple scanning SDKs with one clean API

License:MIT License


Languages

Language:Objective-C 82.7%Language:Ruby 17.3%