import PhotoEditorSDK
import UIKit
class PhotoAdjustmentsConfigurationSwift: Example, PhotoEditViewControllerDelegate {
override func invokeExample() {
let photo = Photo(url: Bundle.main.url(forResource: "LA", withExtension: "jpg")!)
let configuration = Configuration { builder in
builder.configureAdjustToolController { options in
options.showResetButton = false
options.allowedAdjustTools = [.brightness, .contrast, .saturation]
}
}
let photoEditViewController = PhotoEditViewController(photoAsset: photo, configuration: configuration)
photoEditViewController.delegate = self
photoEditViewController.modalPresentationStyle = .fullScreen
presentingViewController?.present(photoEditViewController, animated: true, completion: nil)
}
func photoEditViewControllerShouldStart(_ photoEditViewController: PhotoEditViewController, task: PhotoEditorTask) -> Bool {
true
}
func photoEditViewControllerDidFinish(_ photoEditViewController: PhotoEditViewController, result: PhotoEditorResult) {
presentingViewController?.dismiss(animated: true, completion: nil)
}
func photoEditViewControllerDidFail(_ photoEditViewController: PhotoEditViewController, error: PhotoEditorError) {
print(error.localizedDescription)
presentingViewController?.dismiss(animated: true, completion: nil)
}
func photoEditViewControllerDidCancel(_ photoEditViewController: PhotoEditViewController) {
presentingViewController?.dismiss(animated: true, completion: nil)
}
}