GabrielAlva / Cool-iOS-Camera

A fully customisable and modern camera implementation for iOS made with AVFoundation.
1.3k stars 152 forks source link

Make the delegate an IBOutlet #8

Closed kwerle closed 9 years ago

kwerle commented 9 years ago

@property (nonatomic, weak) id delegate; -> @property (nonatomic, weak) IBOutlet id delegate;

Now I can just hook it up in XCode/IB.

GabrielAlva commented 9 years ago

Thanks for the observations. Thats another option Kurt, I made the adoption of the delegate not use IBOutlets in case they would not use storyboards.

kwerle commented 9 years ago

Doesn't really matter if it's a storyboard or a xib. It does no harm, and it makes it codeless if you are using xcode/IB.

kwerle commented 9 years ago

Also need to implement

- (id)initWithCoder:(NSCoder *)aDecoder {
    self = [super initWithCoder:aDecoder];
    if (self) {
        _animationInProgress = NO;
        [self setupCaptureManager:RearFacingCamera];
        cameraBeingUsed = RearFacingCamera;
        [self composeInterface];

        [[_captureManager captureSession] startRunning];
    }
    return self;
}

(so clearly refactor)

GabrielAlva commented 9 years ago

Your recommendation for making the id delegate an IBOutlet is a great idea, however given the use this lib will probably get I believe its better to leave as it is for clarity's sake for new developers.

I already pushed the initWithCoder function, thank you very much!

Knights22 commented 9 years ago

I agree, the code base is cleaner and easier to use this way! Thanks GabrielAlva