PhotoEditToolController

@available(iOS 9.0, *)
@objcMembers
@objc(PESDKPhotoEditToolController)
open class PhotoEditToolController : ViewController
extension PhotoEditToolController: EventSubscribable
extension PhotoEditToolController: ToolbarItemProviding
extension PhotoEditToolController: PhotoPreviewControlling

A PhotoEditToolController is the base class for any tool controller. Tool controllers can be presented in a PhotoEditViewController and are displayed above a PhotoEditPreviewController.

Initializers

  • Creates a new PhotoEditToolController with the given configuration. This initializer must be implemented by each PhotoEditToolController subclass and is the initializer that gets called when a tool is instantiated by the framework.

    Declaration

    Swift

    public required init?(configuration: Configuration, productType: LicenseProduct)

    Parameters

    configuration

    A Configuration object.

    productType

    The product that this tool is used in.

ToolbarItemProviding

  • The ToolbarItem that is displayed in the Toolbar of a PhotoEditViewController when this tool is pushed onto the stack.

    Declaration

    Swift

    open lazy var toolbarItem: ToolbarItem { get set }
  • Configures the toolbarItem. Subclasses can override this to do any custom configuration.

    Declaration

    Swift

    open func configureToolbarItem()
  • Called when the apply button is tapped. This sends a viewControllerDidFinish(_:) message to subscribers.

    Declaration

    Swift

    open func apply(_ sender: ToolbarItem)

    Parameters

    sender

    The toolbar item that called this method.

  • Called when the discard button is tapped. This sends a viewControllerDidCancel(_:) message to subscribers.

    Declaration

    Swift

    open func discard(_ sender: ToolbarItem)

    Parameters

    sender

    The toolbar item that called this method.

PhotoEditModel

  • The photo edit model. Changing this sends a photoEditModelDidChange(_:) message to subscribers.

    Declaration

    Swift

    open var photoEditModel: PhotoEditModel { get set }
  • The unedited photo edit model without any changes applied.

    Declaration

    Swift

    public private(set) var uneditedPhotoEditModel: PhotoEditModel
  • Called when the photo edit model changes.

    Declaration

    Swift

    open func photoEditModelDidChange(from oldModel: PhotoEditModel, to newModel: PhotoEditModel)

    Parameters

    oldModel

    The previous photo edit model, before the update.

    newModel

    The new photo edit model, after the update.

PhotoEditToolController

  • The configuration object that configures this tool.

    Declaration

    Swift

    public let configuration: Configuration
  • An object that acts as a delegate.

    Declaration

    Swift

    open weak var delegate: PhotoEditToolControllerDelegate?
  • The UndoController associated with this tool controller.

    Declaration

    Swift

    open var undoController: UndoController?
  • The AssetManager that this view controller can use to set and get assets.

    Declaration

    Swift

    open var assetManager: AssetManager?
  • The AssetCatalog that is associated with this view controller.

    Declaration

    Swift

    public var assetCatalog: AssetCatalog { get set }
  • A UserInteraceState can be used by a tool to restore any previous state when being initialized and to pass updated state back to the subscriber.

    Declaration

    Swift

    open var userInterfaceState: UserInterfaceState { get set }
  • Asks the tool to update its user interface state if required. By default this method does nothing.

    Declaration

    Swift

    open func updateUserInterfaceState()
  • Notifies the tool controller that it is about to become the active tool.

    Important

    If you override this method, you must call super at some point in your implementation.

    Declaration

    Swift

    open override func willBecomeActiveTool()
  • Notifies the tool controller that it became the active tool.

    Important

    If you override this method, you must call super at some point in your implementation.

    Declaration

    Swift

    open override func didBecomeActiveTool()
  • Notifies the tool controller that it is about to resign being the active tool.

    Note

    This method will not be called if another tool is pushed above this tool. It is only called if you pop the tool from the photo edit view controller.

    Important

    If you override this method, you must call super at some point in your implementation.

    Declaration

    Swift

    open override func willResignActiveTool()
  • Notifies the tool controller that it resigned being the active tool.

    Note

    This method will not be called if another tool is pushed above this tool. It is only called if you pop the tool from the photo edit view controller.

    Important

    If you override this method, you must call super at some point in your implementation.

    Declaration

    Swift

    open override func didResignActiveTool()
  • Called when this tool wants zooming enabled. Override this method to setup a proxy scroll view for example.

    Declaration

    Swift

    open func setupForZoomAndPan()
  • Called when this tool wants zooming enabled and is about to be presented. Override this method to reset your zoom scale if necessary.

    Declaration

    Swift

    open func resetForZoomAndPan()
  • This is a boxed property which exposes a Swift struct to Objective-C. This property should only be used if you are using Objective-C.

    Every invocation of the getter will return a new (temporary) object wrapping the underlying Swift struct. Boxed properties cannot be chained with the dot syntax for mutable access of nested properties in place. Use the setter with the assignment operator instead to modify boxed properties, e.g.:

    PESDKPhotoEditModel *photoEditModel = [[PESDKPhotoEditModel alloc] init];
    
    // CORRECT:
    // get boxed `AdjustmentModel`
    PESDKAdjustmentModel *adjustmentModel = photoEditModel.adjustmentModel;
    // modify boxed `AdjustmentModel`
    adjustmentModel.brightness = 0.5;
    // set modified boxed `AdjustmentModel`
    photoEditModel.adjustmentModel = adjustmentModel;
    
    // WRONG:
    photoEditModel.adjustmentModel.brightness = 0.5;
    

    Declaration

    Swift

    var boxedPhotoEditModel: _ObjCPhotoEditModel { get set }