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.
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
- ZBarSDK
- CDZQRScanningViewController
- ScanditSDK
- MDCBarcodePicker, 3-d party iOS 7 scanning thing
Feel free to add more!
TKScanKit is available through CocoaPods, to install it simply add the following line to your Podfile:
pod "TKScanKit"
Taras Kalapun, t.kalapun@gmail.com
TKScanKit is available under the MIT license. See the LICENSE file for more info.