Skip to main content
Platform
Language

Using the Photo Editor

Photo Editor is built to provide versatile photo editing capabilities. Toggling from edit and preview modes enables users to evaluate their edited photo before export. A dock at the bottom of the editor provides quick access to the most essential photo editing tools allowing users to tweak adjustments, crop the photo, and add filters, effects, blur, text, shapes, as well as stickers.

In this example, we will show you how to initialize the Photo Editor solution for the mobile editor on iOS.

The mobile editor is implemented entirely with SwiftUI and this example assumes that you also use SwiftUI to integrate it, however, you can check the UIKit implementation sample on the quickstart page. It can be also applied to this example.

Explore a full code sample on GitHub.

Import#

After adding the IMGLYUI Swift Package to your app. You can get started right away by importing the editor module into your own code.

Initialization#

The editor is initialized with EngineSettings which are used to initialize the underlying Engine. The license key that you received from IMG.LY is the only required parameter. Additionally, you should provide an optional unique ID tied to your application's user. This helps us accurately calculate monthly active users (MAU) and it is especially useful when one person uses the app on multiple devices with a sign-in feature, ensuring they're counted once.

For more details on how to configure the editor, visit the configuration page.

Presentation#

In this integration example the editor is presented as a modal view after tapping a button. Check out the quickstart page for details on the expected environment for the editor and the ModalEditor helper.

Callbacks#

The photo editor should be used with custom callbacks to fit your use case. The onCreate callback is required to create a scene with just a single page with an image fill applied. This page is the photo you are editing. Its size can be changed to define a custom crop format. Per default, OnCreateEditor.loadImage with a white image is used. The default onExport callback exports a PNG compressed image, writes the content into a temporary file, and opens a system dialog for sharing the exported file. In this example, we changed the exported format to JPEG.