Skip to main content

Stickers

The VideoEditor SDK for iOS ships with a preset sticker library containing emoticons and shapes. Learn how to add custom sticker packages to the library.

Stickers tool

The VideoEditor SDK ships with a categorized sticker library whose UI is optimized for exploration and discovery. You can easily leverage the API to complement the library with your custom sticker packages.

The tool allows placing, rotating, scaling and ordering stickers on your image. Once a sticker has been placed the user can reselect it by tapping the sticker again.

The tool is implemented in the StickerToolController class and can be customized using the StickerToolControllerOptions. For details on how to modify the options, take a look at the configuration section

Adding stickers#

Stickers are inserted into the SDK using the static property StickerCategory.all, which is an array of StickerCategory objects. A StickerCategory object holds the metadata of a sticker category, such as its preview image or the title and has an array of Sticker objects, which again hold the metadata for a Sticker, such as its imageURL and thumbnailURL. The Sticker class can handle local and remote resources. Supported formats are jpeg and png

var categories = StickerCategory.all
let stickers = [
Bundle.main.url(forResource: "glasses_nerd", withExtension: "png"),
Bundle.main.url(forResource: "glasses_normal", withExtension: "png"),
Bundle.main.url(forResource: "glasses_shutter_green", withExtension: "png"),
Bundle.main.url(forResource: "glasses_shutter_yellow", withExtension: "png"),
Bundle.main.url(forResource: "glasses_sun", withExtension: "png"),
Bundle.main.url(forResource: "hat_cap", withExtension: "png"),
Bundle.main.url(forResource: "hat_party", withExtension: "png"),
Bundle.main.url(forResource: "hat_scherif", withExtension: "png"),
Bundle.main.url(forResource: "hat_zylinder 2", withExtension: "png"),
Bundle.main.url(forResource: "heart", withExtension: "png"),
Bundle.main.url(forResource: "mustache_long", withExtension: "png"),
Bundle.main.url(forResource: "mustache1", withExtension: "png"),
Bundle.main.url(forResource: "mustache2", withExtension: "png"),
Bundle.main.url(forResource: "mustache3", withExtension: "png"),
Bundle.main.url(forResource: "pipe", withExtension: "png"),
Bundle.main.url(forResource: "smile", withExtension: "png"),
Bundle.main.url(forResource: "snowflake", withExtension: "png"),
Bundle.main.url(forResource: "star", withExtension: "png"),
Bundle.main.url(forResource: "teardrop", withExtension: "png")
].compactMap { $0.map { Sticker(imageURL: $0, thumbnailURL: nil, identifier: $0.path) } }
if let previewURL = Bundle.main.url(forResource: "face_decor", withExtension: "png") {
categories.append(StickerCategory(title: "Oldschool", imageURL: previewURL, stickers: stickers))
}
StickerCategory.all = categories