Customizable reusable component to get cropped image from provided one.
- Fully customizable UI
- The possibility to use different quality images for according zoom scale
- Specify crop shape to preview
- Apply crop using bounding box or specified shape
-
Create and customize view controller as you want:
let cropViewController = CropperViewController(images: [.less(2): myLowQualityImage, .default: mySourceImage]) cropViewController.clipBorderInset = 10 cropViewController.cropOptions = [.circle()] cropViewController.mode = .path
-
Present view controller. Please note, that
CropperViewController
does not contain UI controls to apply or decline cropped image that allows you to present it with any way using your custom controls:navigationController?.pushViewController(viewController, animated: true)
-
Retrive a cropped image from
CropperViewController
.@objc private func acceptCropActionTriggered() { guard case let .normal(image) = cropperViewController.makeCroppResult() else { UINotificationFeedbackGenerator().notificationOccurred(.error) return } // TODO: Use provided image }
Depo is a universal dependency manager that combines Carthage, SPM and CocoaPods and provides common user interface to all of them.
To install Cripper
via Carthage using Depo you need to add this to your Depofile
:
carts:
- kind: github
identifier: rosberry/Cripper
Create a Cartfile
that lists the framework and run carthage update
. Follow the instructions to add the framework to your project.
Add SPM dependency to your Package.swift:
dependencies: [
...
.package(url: "https://github.com/rosberry/Cripper")
],
targets: [
.target(
...
dependencies: [
...
.product(name: "Cripper", package: "Cripper")
]
)
]
- Nikolay Tyunin, nikolay.tyunin@rosberry.com
This project is owned and maintained by Rosberry. We build mobile apps for users worldwide 🌏.
Check out our open source projects, read our blog or give us a high-five on 🐦 @rosberryapps.
The project is available under the MIT license. See the LICENSE file for more info.