Skip to content

Commit

Permalink
Added ability to provide a preferred image size
Browse files Browse the repository at this point in the history
  • Loading branch information
cemaleker committed Aug 23, 2016
1 parent 72b2998 commit f4cf3e0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions Source/ImagePickerController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ public class ImagePickerController: UIViewController {
var initialContentOffset: CGPoint?
var numberOfCells: Int?
var statusBarHidden = true
var preferredImageSize: CGSize?

private var isTakingPicture = false
public var doneButtonTitle: String? {
Expand Down Expand Up @@ -331,7 +332,13 @@ extension ImagePickerController: BottomContainerViewDelegate {
}

func doneButtonDidPress() {
let images = AssetManager.resolveAssets(stack.assets)
var images: [UIImage]
if let preferredImageSize = preferredImageSize {
images = AssetManager.resolveAssets(stack.assets, size: preferredImageSize)
} else {
images = AssetManager.resolveAssets(stack.assets)
}

delegate?.doneButtonDidPress(self, images: images)
}

Expand All @@ -341,7 +348,13 @@ extension ImagePickerController: BottomContainerViewDelegate {
}

func imageStackViewDidPress() {
let images = AssetManager.resolveAssets(stack.assets)
var images: [UIImage]
if let preferredImageSize = preferredImageSize {
images = AssetManager.resolveAssets(stack.assets, size: preferredImageSize)
} else {
images = AssetManager.resolveAssets(stack.assets)
}

delegate?.wrapperDidPress(self, images: images)
}
}
Expand Down

0 comments on commit f4cf3e0

Please sign in to comment.