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 theTKScanKitApp
directory - Try it
Supported scanning providers
- ZBarSDK
- CDZQRScanningViewController
- ScanditSDK
- MDCBarcodePicker, 3-d party iOS 7 scanning thing
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.