Framework written in Swift for Cropping Images easily
Clone or download
Latest commit 32419eb Oct 8, 2016
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
CropViewController Bump version. Oct 7, 2016
Example Bump version. Oct 7, 2016
PhotoCropEditor.xcodeproj Upgraded code to Swift 3.0 Oct 7, 2016
.gitignore Added initial Project file. Feb 26, 2016
LICENSE Initial commit Feb 26, 2016
README.md Update README.md May 2, 2016
screenshot.png Added files via upload Mar 7, 2016

README.md

PhotoCropEditor Carthage compatible GitHub release

screenshot

This project is a Swift translation of the PEPhotoCropEditor. Version 1.0 doesn't add anything new, or fixes existing bugs. I want to slowly iterate on that, and if you want to contribute, let me know.

Check it out

To run the example project, clone the repo, and open the 'Example/Example.xcodeproj' file.

Requirements

This component is written using Swift and Dynamic Frameworks, so iOS 8.x is required. However you may want to manually import the source files into your project, if you need to support 7.x.

Installation

ProgressButton is available through Carthage. To install it, simply add the following line to your Cartfile:

github "sprint84/CropViewController" ~> 1.2

Installing Carthage

To install the carthage tool on your system, please download and run the Carthage.pkg file for the latest release, then follow the on-screen instructions.

Alternately, you can use Homebrew and install the carthage tool on your system simply by running brew update and brew install carthage.

For further details, please visit the Carthage Github page

Usage

First import the module into your project.

import CropViewController

You may use the view controller component, with the default buttons and appearance. We will add customization properties in the future.

let controller = CropViewController()
controller.delegate = self
controller.image = image

let navController = UINavigationController(rootViewController: controller)
presentViewController(navController, animated: true, completion: nil)

Alternatively, you can use the crop view directly, and incorporate it in your existing UI.

let cropView = CropView(frame: bounds)
view.addSubview(cropView)

Reading the cropped image

Using the delegate method on the View Controller:

func cropViewController(controller: CropViewController, didFinishCroppingImage image: UIImage) {
    controller.dismissViewControllerAnimated(true, completion: nil)
    imageView.image = image
}

Retrieving directly from the crop view

let croppedImage = cropView.croppedImage

Customization

Coming in the near future...

Author

Reefactor, Inc., reefactor@gmail.com

License

ProgressButton is available under the MIT license. See the LICENSE file for more info.