Skip to content

Commit

Permalink
Merge branch 'release/0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelochs committed Dec 21, 2014
2 parents 620cee6 + 7ee2a0b commit 1a7ab7e
Show file tree
Hide file tree
Showing 36 changed files with 776 additions and 337 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ profile
*.moved-aside
DerivedData
.idea/
Pods
Podfile.lock
17 changes: 10 additions & 7 deletions BCScanner.podspec
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
Pod::Spec.new do |s|
s.name = "BCScanner"
s.version = "0.0.1"
s.summary = "A barcode and qr code scanner that wraps the iOS7 scanning capabilities in a UIViewController"
s.version = "0.1.0"
s.summary = "A barcode and qr code scanner that wraps the `AVFoundation` scanning capabilities in a `UIViewController`"
s.homepage = "https://github.com/michaelochs/BCScanner"
s.license = { :type => 'Apache License, Version 2.0', :file => 'LICENSE' }
s.author = 'Michael Ochs'
s.platform = :ios, '7.0'
s.source = { :git => "https://github.com/michaelochs/BCScanner.git", :commit => "ae445da822b3058fe57f8c262ef8596326f31929" }
s.source_files = 'BCScanner', 'BCScanner/**/*.{h,m}'
s.framework = 'AVFoundation'
s.author = 'Michael Ochs, @_mochs'
s.platform = :ios, '8.0'
s.ios.deployment_target = '7.0'
s.requires_arc = true
s.framework = 'AVFoundation', 'UIKit'
s.source = { :git => "https://github.com/michaelochs/BCScanner.git", :tag => s.version.to_s }
s.source_files = 'BCScanner', 'BCScanner/**/*.{h,m}'
s.public_header_files = 'BCScanner/*.h'
s.preserve_path = 'LICENSE', 'VERSION', 'CREDITS.md'
end
2 changes: 2 additions & 0 deletions BCScanner/BCScanner.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#import <BCScanner/BCScannerViewController.h>
#import <BCScanner/UIViewController+BCScanner.h>
154 changes: 99 additions & 55 deletions BCScanner/BCScannerViewController.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,105 +19,149 @@

#import <UIKit/UIKit.h>

@protocol BCScannerViewControllerDelegate;

extern NSString *const BCScannerQRCode; /// The code type used for QR codes.
extern NSString *const BCScannerUPCECode;

//extern NSString *const BCScannerCode39Code;
//extern NSString *const BCScannerCode39Mod43Code;

extern NSString *const BCScannerEAN13Code;
extern NSString *const BCScannerEAN8Code;

//extern NSString *const BCScannerCode93Code;
//extern NSString *const BCScannerCode128Code;
//extern NSString *const BCScannerPDF417Code;
//extern NSString *const BCScannerAztecCode;
#pragma mark - code types

// iOS7+
FOUNDATION_EXTERN NSString *const BCScannerUPCECode; /// The UPC-E code type.
FOUNDATION_EXTERN NSString *const BCScannerCode39Code; /// The code 39 code type.
FOUNDATION_EXTERN NSString *const BCScannerCode39Mod43Code; /// The code 39 code type with mod 43 support.
FOUNDATION_EXTERN NSString *const BCScannerEAN13Code; /// The EAN 13 code type.
FOUNDATION_EXTERN NSString *const BCScannerEAN8Code; /// The EAN 8 code type.
FOUNDATION_EXTERN NSString *const BCScannerCode93Code; /// The code 93 code type.
FOUNDATION_EXTERN NSString *const BCScannerCode128Code; /// The code 128 code type.
FOUNDATION_EXTERN NSString *const BCScannerPDF417Code; /// The PDF 417 code type.
FOUNDATION_EXTERN NSString *const BCScannerQRCode; /// The QR code type.
FOUNDATION_EXTERN NSString *const BCScannerAztecCode; /// The aztec code type.

// iOS8+
FOUNDATION_EXTERN NSString *const BCScannerI25Code; /// The Interleaved 2 of 5 code type. This type does nothing on iOS7, as it is only supported on iOS8 and later
FOUNDATION_EXTERN NSString *const BCScannerITF14Code; /// The ITF14 code type. This type does nothing on iOS7, as it is only supported on iOS8 and later
FOUNDATION_EXTERN NSString *const BCScannerDataMatrixCode; /// The data matrix code type. This type does nothing on iOS7, as it is only supported on iOS8 and later


@protocol BCScannerViewControllerDelegate;

#pragma mark - controller

/**
* BCScannerViewController is a view controller that wrapps the scanning capabilities
* of iOS7 into a simple to use drop-in view controller for easy integration into your app.
*
* It is build for the purpose of scanning a single or multiple codes in a deticated screen
* and encapsules all the camera handling and metadata gathering.
*
* The view controller can be presented or pushed onto a navigation stack. It is up to you
* to present and dismiss the view controller whenever you need it.
*/
BCScannerViewController is a view controller that wrapps the scanning
capabilities of iOS7 into a simple to use drop-in view controller for easy
integration into your app.
It is build for the purpose of scanning a single or multiple codes in a
deticated screen and encapsules all the camera handling and metadata gathering.
The view controller can be presented or pushed onto a navigation stack. It is
up to you to present and dismiss the view controller whenever you need it.
*/
@interface BCScannerViewController : UIViewController

/**
* This method lets you check for the availability of the native scanner functionality
* provided by AVFoundation.
*
* @note Do not instanciate this class if this method returns NO!
*
* @return YES if native scanning is available, NO otherwise.
This method lets you check for the availability of the native scanner
functionality provided by AVFoundation.
@note Do not instanciate this class if this method returns NO!
@return YES if native scanning is available, NO otherwise.
*/
+ (BOOL)scannerAvailable;

/**
* This is the delegate of the scanner. The delegate will get called to notify you about
* codes that were found in the field of view of the camera.
This is the delegate of the scanner. The delegate will get called to notify you
about codes that were found in the field of view of the camera.
*/
@property (nonatomic, weak, readwrite) id<BCScannerViewControllerDelegate> delegate;

/**
* This is an array of the codes the scanner should look for. The more code types you
* specify, the longer the image analysis will take!
*
* @see BCScannerCode constants
This is an array of the codes the scanner should look for. The more code types
you specify, the longer the image analysis will take!
@see BCScannerCode constants
*/
@property (nonatomic, strong, readwrite) NSArray *codeTypes;

/**
* This is the gesture recognizer that is used to let the user focus and expose to a
* specific point in the field of view. You can access this property when you want to
* more precisely control what taps should be recognized.
This is the gesture recognizer that is used to let the user focus and expose to
a specific point in the field of view. You can access this property when you
want to more precisely control what taps should be recognized.
*/
@property (nonatomic, weak, readonly) UITapGestureRecognizer *focusAndExposeGestureRecognizer;

/**
Defines the rect of the view controller's view that describes the active area
that is used by `AVFoundation` to scan for barcodes.
The default value is `CGRectZero` which turns this feature off and always uses
the whole camera input as a capturing area.
@note all codes that are completely visible by the active camera and intersect
with the specified area are scanned. The code does not need to be
completely inside the scanner area.
*/
@property (nonatomic, assign, readwrite) CGRect scannerArea;



#pragma mark - torch

/**
Defines the video preview torch mode.
*/
@property (nonatomic, assign, readwrite, getter = isTorchEnabled) BOOL torchEnabled;

/**
Hides or displays the torch button in the navigation bar.
The default value is YES.
*/
@property (nonatomic, assign, readwrite, getter = isTorchButtonEnabled) BOOL torchButtonEnabled;

/**
Indicates if the torch mode is available. Varies depending on the device.
*/
@property (nonatomic, assign, readonly, getter = isTorchModeAvailable) BOOL torchModeAvailable;

@end



#pragma mark - delegate

@protocol BCScannerViewControllerDelegate <NSObject>

@optional
/**
* This method is called whenever a new code enters the field of view.
*
* @param scanner The scanner that is calling this delegate
* @param codes A list of all the codes that entered the FOV in this interval
*
* @note If you do a simple scan for the first code you find, you can get the code
* from this method and close the scanner afterwards.
This method is called whenever a new code enters the field of view.
@param scanner The scanner that is calling this delegate
@param codes A list of all the codes that entered the FOV in this interval
@note If you do a simple scan for the first code you find, you can get the
code from this method and close the scanner afterwards.
*/
- (void)scanner:(BCScannerViewController *)scanner codesDidEnterFOV:(NSSet *)codes;

//- (void)scanner:(BCScannerViewController *)scanner codesDidUpdate:(NSSet *)codes;

/**
* This method is called whenever an existing code leaves the field of view.
*
* @param scanner The scanner that is calling this delegate
* @param codes A list of all the codes that left the FOV in this interval
This method is called whenever an existing code leaves the field of view.
@param scanner The scanner that is calling this delegate
@param codes A list of all the codes that left the FOV in this interval
*/
- (void)scanner:(BCScannerViewController *)scanner codesDidLeaveFOV:(NSSet *)codes;

/**
* This method lets you specify an image that is shown as an overlay to give the user
* some feedback about how to hold the camera.
*
* This method is called when the scanner configures its interface.
*
* @param scanner The scanner that is calling this delegate
* @return The image you want to be used as HUD
This method lets you specify an image that is shown as an overlay to give the
user some feedback about how to hold the camera.
This method is called when the scanner configures its interface.
@param scanner The scanner that is calling this delegate
@return The image you want to be used as HUD
*/
- (UIImage *)scannerHUDImage:(BCScannerViewController *)scanner;

Expand Down
Loading

0 comments on commit 1a7ab7e

Please sign in to comment.