Skip to content
This repository was archived by the owner on Nov 8, 2021. It is now read-only.

Commit 9ce4b62

Browse files
committed
Fixed more documentation and static analyser warning.
1 parent cbbf6b9 commit 9ce4b62

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

Source/Private/IRLCameraView.h

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
/**
3939
@return delegate cofroming to `IRLCameraViewProtocol`
4040
*/
41-
@property (weak) id<IRLCameraViewProtocol> delegate;
41+
@property (weak) id<IRLCameraViewProtocol> _Nullable delegate;
4242

4343
/**
4444
@return minimumConfidenceForFullDetection Integer for 0 to 100 defining what is the our minimum confidence to detect the scan. Default 66.
@@ -51,14 +51,14 @@
5151
@property (nonatomic, readonly) NSUInteger maximumConfidenceForFullDetection; // Default 100
5252

5353
/**
54-
@return The color use for overlay.
54+
@return The color use for overlay. Default is [UIColor red]
5555
*/
56-
@property (readwrite, strong, nonatomic) UIColor *overlayColor;
56+
@property (readwrite, strong, nonatomic) UIColor * _Nonnull overlayColor;
5757

5858
/**
5959
@return A quick corrected image (use for preview).
6060
*/
61-
- (UIImage*)latestCorrectedUIImage;
61+
- (UIImage* _Nullable)latestCorrectedUIImage;
6262

6363
/**
6464
@return enableBorderDetection Auto detect border
@@ -99,14 +99,16 @@
9999
@param point a Point where to focuse
100100
@param completionHandler a block taking no parameter to be exctuted when done
101101
*/
102-
- (void)focusAtPoint:(CGPoint)point completionHandler:(void(^)(void))completionHandler;
102+
- (void)focusAtPoint:(CGPoint)point completionHandler:(void(^ _Nullable)(void))completionHandler;
103103

104104
/**
105105
@brief Force focus at a particular point.
106106
107+
@warning If for some reason the AVCaptureConnection could not be found (the view disapear or app resign active, your capture image will be nil).
108+
107109
@param completionHandler a block retruning 1 parameter image to be exctuted when done
108110
*/
109-
- (void)captureImageWithCompletionHander:(void(^)(UIImage* image))completionHandler;
111+
- (void)captureImageWithCompletionHander:(void(^_Nonnull)(UIImage* _Nullable image))completionHandler;
110112

111113
/**
112114
@brief Prepare the view for orientation changes (stop the camera)
@@ -130,20 +132,20 @@
130132
@param view The IRLCameraView calling the delegate
131133
@param confidence A value between 0 .. 100% indicating the confidence of the detection
132134
*/
133-
-(void)didDetectRectangle:(IRLCameraView*)view withConfidence:(NSUInteger)confidence;
135+
-(void)didDetectRectangle:(IRLCameraView* _Nonnull)view withConfidence:(NSUInteger)confidence;
134136

135137
/**
136138
@brief Call when the view gain the full confiende for the detection (stayed long enough over the [IRLCameraView minimumConfidenceForFullDetection] and close enough from [IRLCameraView maximumConfidenceForFullDetection]
137139
138140
@param view The IRLCameraView calling the delegate
139141
*/
140-
-(void)didGainFullDetectionConfidence:(IRLCameraView*)view;
142+
-(void)didGainFullDetectionConfidence:(IRLCameraView* _Nonnull)view;
141143

142144
/**
143145
@brief Call when the view lostconfiende for the detection got bellow [IRLCameraView minimumConfidenceForFullDetection]
144146
145147
@param view The IRLCameraView calling the delegate
146148
*/
147-
-(void)didLostConfidence:(IRLCameraView*)view;
149+
-(void)didLostConfidence:(IRLCameraView* _Nonnull)view;
148150

149151
@end

Source/Private/IRLCameraView.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,11 @@ - (void)captureImageWithCompletionHander:(void(^)(UIImage* image))completionHand
390390
if (videoConnection) break;
391391
}
392392

393+
if (videoConnection == nil) {
394+
completionHandler(nil);
395+
return;
396+
}
397+
393398
[self.stillImageOutput captureStillImageAsynchronouslyFromConnection:videoConnection completionHandler: ^(CMSampleBufferRef imageSampleBuffer, NSError *error) {
394399
NSData *imageData = [AVCaptureStillImageOutput jpegStillImageNSDataRepresentation:imageSampleBuffer];
395400
UIImage *finalImage;

0 commit comments

Comments
 (0)