Skip to content

Commit

Permalink
better completion block
Browse files Browse the repository at this point in the history
  • Loading branch information
aashishdhawan committed Apr 2, 2016
1 parent bffb637 commit 87d46aa
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions Source/CameraView/CameraView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate {
}
}

func takePicture(completion: Bool -> ()) {
func takePicture(completion: () -> ()) {
capturedImageView.frame = view.bounds

UIView.animateWithDuration(0.1, animations: {
Expand Down Expand Up @@ -269,7 +269,7 @@ class CameraView: UIViewController, CLLocationManagerDelegate {
request.location = self.locationManager?.latestLocation
}, completionHandler: { success, error in
self.delegate?.imageToLibrary()
completion(true)
completion()
})
})
})
Expand Down
10 changes: 4 additions & 6 deletions Source/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ public protocol ImagePickerDelegate: class {
}

public class ImagePickerController: UIViewController {

struct GestureConstants {
static let maximumHeight: CGFloat = 200
static let minimumHeight: CGFloat = 125
Expand Down Expand Up @@ -108,7 +108,7 @@ public class ImagePickerController: UIViewController {

public override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)

statusBarHidden = UIApplication.sharedApplication().statusBarHidden
UIApplication.sharedApplication().setStatusBarHidden(true, withAnimation: .Fade)
}
Expand Down Expand Up @@ -249,9 +249,7 @@ public class ImagePickerController: UIViewController {
bottomContainer.pickerButton.enabled = false
bottomContainer.stackView.startLoader()
let action: Void -> Void = { [unowned self] in
self.cameraController.takePicture({ (finished) in
self.isTakingPicture = false
})
self.cameraController.takePicture { self.isTakingPicture = false }
}

if Configuration.collapseCollectionViewWhileShot {
Expand All @@ -269,7 +267,7 @@ extension ImagePickerController: BottomContainerViewDelegate {
func pickerButtonDidPress() {
takePicture()
}

func doneButtonDidPress() {
let images = ImagePicker.resolveAssets(stack.assets)
delegate?.doneButtonDidPress(images)
Expand Down

0 comments on commit 87d46aa

Please sign in to comment.