Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS

Aaron Watkins
PLUS
Aaron Watkins
Courses Plus Student 10,500 Points

Cropping Images (Swift): Custom crop frame size

Hi everybody,

I'm looking to allow users to crop an image with dimensions 320x200. Using UIImagePickerController and enabling editing, I'm only allowed the standard 320x320 crop frame. I've looked all over and I've found a few libraries written in Objective-C (GKImagePicker) that will allow a custom frame. Wondering if anyone has come across a Swift library or accomplished something like this themselves in Swift. Please let me know. I'd greatly appreciate it!

Thank you

GKImagePicker: https://github.com/gekitz/GKImagePicker

1 Answer

Hey, Aaron

You can use Obj-C libraries with Swift you know? Just use a bridging header to import your statements. A simple google search would have found you the solution.

Thanks, Alex

Aaron Watkins
Aaron Watkins
Courses Plus Student 10,500 Points

Thanks, Alex - familiar with Google & with using bridging headers as I have one in my app. However, I am having issues and wondering if there was one that was entirely written in Swift already.

What's your issue, I can have a go at solving the issue for you.