Skip to content

Instantly share code, notes, and snippets.

@rpiwetz
Last active November 13, 2017 15:50
Show Gist options
  • Save rpiwetz/f13f4cbaf083afe9aa2e1eac90815d47 to your computer and use it in GitHub Desktop.
Save rpiwetz/f13f4cbaf083afe9aa2e1eac90815d47 to your computer and use it in GitHub Desktop.
Hyperloop NSArray sample
var MTBBarcodeScanner = require('MTBBarcodeScanner/MTBBarcodeScanner');
var scanner = MTBBarcodeScanner.alloc().initWithPreviewView($.window);
MTBBarcodeScanner.requestCameraPermissionWithSuccess(function(success) {
if(success) {
Ti.API.log("success received");
scanner.startScanningWithResultBlock(function(codes) {
for (var i = 0; i < codes.count; i++) {
Ti.API.log(codes.objectAtIndex(i).stringValue);
}
Ti.API.log("code: " + codes.count);
scanner.stopScanning();
});
}
else {
Ti.API.log("error received");
}
});
$.window.open();
@rpiwetz
Copy link
Author

rpiwetz commented Mar 15, 2017

outputs: <KrollCallback: 0x170271540>

@rpiwetz
Copy link
Author

rpiwetz commented Mar 15, 2017

Podfile contents:

install! 'cocoapods',
    :integrate_targets => false

platform :ios, '8.0'
target 'HyperloopTest' do
    pod 'MTBBarcodeScanner'
end

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment