I have a project and currently trying to convert to Swift project but I couldn't figure out how to present a Zbar barcode reader that scans from the camera feed. On my current project I called like this
- (IBAction)scanButton:(id)sender {
// ADD: present a barcode reader that scans from the camera feed
ZBarReaderViewController *reader = [ZBarReaderViewController new];
reader.readerDelegate = self;
reader.supportedOrientationsMask = ZBarOrientationMaskAll;
ZBarImageScanner *scanner = reader.scanner;
// TODO: (optional) additional reader configuration here
// EXAMPLE: disable rarely used I2/5 to improve performance
[scanner setSymbology: ZBAR_I25
config: ZBAR_CFG_ENABLE
to: 0];
// present and release the controller
[self presentViewController:reader animated:YES completion:nil];}
Note: What I did so far
- Copy framework into the swift
Added framework path to the Header Search Paths (Targets Section > Build Settings)
- $(PROJECT_DIR)/Test/ZBarSDK/Headers/ZBarSDK
- Created Projectname-Bridging-Header.h for Bridging (added all h files from zbar)
- Added Projectname-Bridging-Header.h to Header Search Paths
After that either if I write "import ZBarSDK" or ZBarReaderDelegate still gives me error!