MediaEditViewController
@available(iOS 9.0, *)
@objcMembers
@objc(PESDKMediaEditViewController)
open class MediaEditViewController : ViewController
extension MediaEditViewController: EventSubscribable
extension MediaEditViewController: ToolbarItemProviding
extension MediaEditViewController: PhotoEditModelSettable
extension MediaEditViewController: MenuViewControllerDelegate
extension MediaEditViewController: MediaEditPreviewControllerDelegate
extension MediaEditViewController: PhotoEditToolControllerDelegate
A MediaEditViewController
is the main starting point for the core SDK. It displays the rendered
photo and a menu. It can present PhotoEditToolController
objects and react to changes. It
can be presented on its own (thus displaying a toolbar for navigation at the bottom) or be
embedded into a UINavigationController
(thus using the navigation controller’s navigation bar
for navigation).
Attention
Do not initialize this class of the core SDK directly. Use a derived class of the product SDKs instead.-
The associated flow controller for this photo edit view controller.
Declaration
Swift
open private(set) var flowController: MainFlowController! { get }
-
The contained
MenuViewController
that displays the menu at the bottom.Declaration
Swift
public let menuViewController: MenuViewController
-
The contained
MediaEditPreviewController
that displays the preview.Declaration
Swift
public let mediaEditPreviewController: MediaEditPreviewController
-
The container view that the
MenuViewController
‘s view is added to. It does not include thetoolbar
.Declaration
Swift
open private(set) lazy var containerView: UIView { get set }
-
The toolbar of this view controller.
Declaration
Swift
open private(set) lazy var toolbar: Toolbar { get set }
-
The
ToolbarItem
for this view controller.Declaration
Swift
open var toolbarItem: ToolbarItem
-
The configuration object that configures this editor.
Declaration
Swift
public let configuration: Configuration
-
The
UndoController
associated with this photo edit view controller. This instance is automatically passed to the tool controllers.Declaration
Swift
open lazy var undoController: UndoController { get set }
-
The
AssetManager
that this view controller can use to set and get assets.Declaration
Swift
public let assetManager: AssetManager
-
The
AssetCatalog
that is associated with this view controller.Declaration
Swift
public var assetCatalog: AssetCatalog { get }
-
Whether the user made any changes to the photo.
Declaration
Swift
open var hasChanges: Bool { get }
-
Creates a new
MediaEditViewController
object.Declaration
Swift
public init(mediaEditPreviewController: MediaEditPreviewController, configuration: Configuration = Configuration(), menuItems: [PhotoEditMenuItem] = PhotoEditMenuItem.defaultItems, photoEditModel: PhotoEditModel = PhotoEditModel())
Parameters
mediaEditPreviewController
The
MediaEditPreviewController
to use in this controller.configuration
The configuration options to apply.
menuItems
The menu items to display.
photoEditModel
The initial photo edit model to apply to the photo.
-
The undo button that is displayed in the editor.
Declaration
Swift
open private(set) var undoButton: OverlayButton? { get }
-
The redo button that is displayed in the editor.
Declaration
Swift
open private(set) var redoButton: OverlayButton? { get }
-
All overlay buttons that are displayed in the editor. This includes
undoButton
andredoButtton
.Declaration
Swift
open private(set) var overlayButtons: [OverlayButton] { get }
-
Presents the tool that is represented by the given
ToolMenuItem
. You must only call this when the editor is already on-screen.Declaration
Swift
open func presentTool(for toolMenuItem: ToolMenuItem)
Parameters
toolMenuItem
The tool menu item whose represented tool should be presented.
-
Called when the user wants to dismiss the editor.
Declaration
Swift
open func didCancel()
-
Called when a new tool controller will be pushed onto the tool stack.
Declaration
Swift
open func willPresent(_ toolController: PhotoEditToolController)
Parameters
toolController
The tool being presented.
-
Called when a new tool controller was pushed onto the tool stack.
Declaration
Swift
open func didPresent(_ toolController: PhotoEditToolController)
Parameters
toolController
The tool that was presented.
-
Called when a tool controller will be popped from the tool stack.
Declaration
Swift
open func willDismiss(_ toolController: PhotoEditToolController)
Parameters
toolController
The tool being dismissed.
-
Called when a tool controller was popped from the tool stack.
Declaration
Swift
open func didDismiss(_ toolController: PhotoEditToolController)
Parameters
toolController
The tool that was dismissed.
-
Applies all changes to the high resolution variant of this media edit view controller’s asset.
Declaration
Swift
open func renderHighResolutionVariant()
-
The tools that are currently on the stack.
Declaration
Swift
open private(set) var viewControllers: [PhotoEditToolController] { get }
-
Pushes a new tool onto the tool stack and presents its view.
Declaration
Swift
@objc(pushViewController:animated:completion:) open func push(_ viewController: PhotoEditToolController, animated: Bool, completion: (() -> Void)? = nil)
Parameters
viewController
The tool controller to present.
animated
Whether to show this tool animated or not.
completion
A closure that is executed after the presentation animation is finished.
-
Pops the top view controller from the stack and removes its view.
Declaration
Swift
@discardableResult @objc(popViewControllerAnimated:completion:) open func pop(animated: Bool, completion: (() -> Void)? = nil) -> PhotoEditToolController?
Parameters
animated
Whether to animate the transition or not.
completion
A closure that is executed after the dismissal animation.
Return Value
The tool that was popped from the stack, if any.
-
The configuration options.
Declaration
Swift
open var options: MediaEditViewControllerOptions { get }
-
The photo edit model.
Declaration
Swift
open var photoEditModel: PhotoEditModel { get set }
-
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 }