From f4cf3e0eb23251f6ac264f6b17ee3bd1de29d695 Mon Sep 17 00:00:00 2001 From: Cemal Eker Date: Tue, 23 Aug 2016 23:10:32 +0300 Subject: [PATCH 1/2] Added ability to provide a preferred image size --- Source/ImagePickerController.swift | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/Source/ImagePickerController.swift b/Source/ImagePickerController.swift index a0077b39..09599dce 100644 --- a/Source/ImagePickerController.swift +++ b/Source/ImagePickerController.swift @@ -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? { @@ -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) } @@ -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) } } From 6e89178a99fee3fe4367d74dc41d9a9ada0fd205 Mon Sep 17 00:00:00 2001 From: Cemal Eker Date: Tue, 23 Aug 2016 23:26:07 +0300 Subject: [PATCH 2/2] Added missing public access level modifier --- Source/ImagePickerController.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/ImagePickerController.swift b/Source/ImagePickerController.swift index 09599dce..afa27f8d 100644 --- a/Source/ImagePickerController.swift +++ b/Source/ImagePickerController.swift @@ -69,12 +69,12 @@ public class ImagePickerController: UIViewController { public weak var delegate: ImagePickerDelegate? public var stack = ImageStack() public var imageLimit = 0 + public var preferredImageSize: CGSize? var totalSize: CGSize { return UIScreen.mainScreen().bounds.size } var initialFrame: CGRect? var initialContentOffset: CGPoint? var numberOfCells: Int? var statusBarHidden = true - var preferredImageSize: CGSize? private var isTakingPicture = false public var doneButtonTitle: String? {