Turn a set of photos and video clips into a shareable memory montage on iOS. The kit picks up media from the photo library, arranges it on a timeline with transitions and a title card, applies styled looks, layers in audio, and exports an MP4—entirely on the device with no server dependencies.

Pre-Requisites#
This guide assumes basic familiarity with iOS and Swift. You will need:
- Xcode 26.6.0 or later
- Swift 6.3.3 or later
- iOS 16.0+
Get Started#
Start with a complete, runnable iOS starter kit project.
Step 1: Clone the Repository#
git clone -b v1.87.0 https://github.com/imgly/starterkit-memories-editor-ios.gitcd starterkit-memories-editor-iosStep 2: Open and Run#
Open the project in Xcode and run on a simulator or connected device:
- Open
StarterKit-MemoriesEditor.xcodeprojin Xcode - Select your target device or simulator
- Press ⌘R to build and run
The sample app shows the full Memories flow: a media selection screen that hands the picked photos and clips to the slideshow editor.
var body: some View { switch model.screen { case .selection: MemoriesSelectionScreen(model: model, onExit: onExit) case .editor: ZStack { NavigationStack { Editor(settings) .imgly.configuration { MemoriesEditorConfiguration(model: model) } } if model.isMediaOverlayPresented { MemoriesMediaOverlay(model: model) .transition(.move(edge: .bottom)) } if model.isPreviewMode { MemoriesFullscreenControls(model: model) } if model.isEditorLoading { MemoriesLoadingScreen(items: model.picker.items) .transition(.opacity) } } .animation(.easeInOut(duration: 0.3), value: model.isEditorLoading) .animation(.easeInOut(duration: 0.25), value: model.isMediaOverlayPresented) }}Get Started#
Integrate the starter kit files into your existing iOS app.
Step 1: Add the IMG.LY Swift Package#
Add the CE.SDK dependency via Swift Package Manager:
- In Xcode, go to File → Add Package Dependencies…
- Enter the repository URL:
https://github.com/imgly/IMGLYUI-swift
- Select version
1.87.0and add theIMGLYEditorproduct to your target
Step 2: Copy the Starter Kit Files#
Run this from your project root to extract the StarterKit/ folder:
repo="starterkit-memories-editor-ios"version="1.87.0"curl -L "https://codeload.github.com/imgly/${repo}/tar.gz/refs/heads/v${version}" | tar -xz --strip-components=1 "${repo}-${version}/StarterKit"Step 3: Add Files to Your Xcode Project#
Drag the StarterKit/ folder into your Xcode project. Make sure “Copy items if needed” is checked and the files are added to your app target.
Add the StarterKit/ly.img.memories.style/ folder as a folder reference, not as a group. Its content.json points into the thumbnails/ and animations/ subfolders, and a group copies every file flat into the app bundle, so the style assets fail to load.
Step 4: Launch the Flow From Your UI#
MemoriesEditorStarterKit is the whole flow, so present it full screen. Pass an onExit closure to show a close button on the media selection screen:
struct ContentView: View { @State private var isMemoriesPresented = false
var body: some View { Button("Create a Memory") { isMemoriesPresented = true } .fullScreenCover(isPresented: $isMemoriesPresented) { MemoriesEditorStarterKit { isMemoriesPresented = false } } }}The full implementation of the starter kit lives in the StarterKit/ folder:
StarterKit/├── MemoriesEditorStarterKit.swift # The full flow: media selection → slideshow editor├── MemoriesEditorConfiguration.swift # Wires the editor's onCreate / onLoaded / onExport / dock / bottomPanel / navigationBar slots├── MemoriesModel.swift # Flow, playback, media and style state, shared by the views and callbacks├── MemoriesAnimations.swift # The slide animations (edit this to change the motion)├── MemoriesConstants.swift # Timing, page size, title knobs├── ly.img.memories.style/ # The kit's own local asset source (backdrops + picker thumbnails)│ ├── content.json # Describes the style assets; URIs use the {{base_url}} placeholder│ ├── thumbnails/ # noir.png, hologram.png, bubblegum.png│ └── animations/ # hologram.json, bubblegum.json (looping Lottie backdrops)├── callbacks/│ ├── OnCreate+Memories.swift # Locks the canvas, builds the scene, registers asset sources│ └── OnExport+Memories.swift # Export flow and handling (MP4)├── components/ # Editor UI slots: Dock, BottomPanel, NavigationBar├── scene/ # Timeline assembly (the tracks are the source of truth)│ ├── MemoriesScene.swift # Builds the video scene and its tracks in code│ ├── MemoriesScene+Timeline.swift # Lays every clip on one media track and wires the transitions│ └── MemoriesScene+Title.swift # Title card + burst-image intro├── style/ # The styled looks + their custom asset source│ ├── MemoriesStyle.swift # Style catalog (filter, backdrop, transition, typeface) referencing assets by id│ └── MemoriesStyleApplier.swift # Registers ly.img.memories.style and applies a style to the slideshow├── media/ # Picked media, photo library import and thumbnails└── views/ # Selection screen, loading screen, media grid, timeline strip, sheetsSet Up a Scene#
The Memories scene is built in code (no serialized scene file). The setup runs in the editor’s
onCreate callback in callbacks/OnCreate+Memories.swift: it creates a video scene, lays out the
persistent background and text tracks, adds the title card, then scene/MemoriesScene+Timeline.swift
appends every photo and clip to a single media track in slot order.
try lockCanvas(engine)let page = try MemoriesScene.createScene(engine)try await loadAssetSources(engine)try MemoriesStyleApplier.registerAssetSource(engine)await model.attach(engine)
// Without this, restoring a snapshot (Undo) flattens the slideshow: the engine strips the// foreground tracks and moves their clips to the page. It must be set after the scene exists.try engine.editor.setSettingBool("features/removeForegroundTracksOnSceneLoad", value: false)
let (textTrack, backdrop) = try MemoriesScene.createBaseTracks(engine, page: page)let items = model.picker.itemslet hasTitle = try await MemoriesScene.createTitle(engine, title: model.title, textTrack: textTrack)if hasTitle { try await MemoriesScene.createBurst(engine, page: page, items: items)}
// A style chosen later blends the clips again, so nothing here assumes a particular overlap.let duration = try await MemoriesScene.createMontage(engine, page: page, items: items, hasTitle: hasTitle, transition: MemoriesStyles.default.transition)try engine.block.setDuration(page, duration: duration)try engine.block.setDuration(backdrop, duration: duration)if let backgroundTrack = try engine.block.getParent(backdrop) { try engine.block.fillParent(backgroundTrack)}try engine.block.fillParent(textTrack)The clips are siblings on that one track because a transition belongs to the outgoing clip and blends it into its neighbour—which only works between siblings. The track’s own time offset holds the title gap; everything inside it is positioned by the engine.
lockCanvas runs first. The slideshow is edited through the dock and the timeline strip, so the
canvas selects no block and does not pan, zoom or rotate. Block scopes only apply in the Adopter
role, so the kit sets it before it turns off editor/select on each block it creates.
Transitions and Slide Motion#
Two things move in a Memories montage, and each has one job:
| What moves | Who owns it | |
|---|---|---|
| Between two slides | The blend from one clip to the next | The style’s transition, applied by the engine |
| Within one slide | A slow Ken Burns across the clip’s full duration | MemoriesAnimations.swift |
Keeping them apart is what lets both stay simple. Assigning a transition overlaps the pair and pulls
every later clip earlier, so the engine—not the kit—owns the timeline: there is no start-time
arithmetic anywhere in scene/. The engine also clamps each overlap to half of the shorter
neighbour, so a clip shorter than the requested duration needs no special case. A 4s video between
8s photos simply gets 2s blends on either side.
Because the transition does the leaving, a slide needs no out-animation. MemoriesAnimationRecipe.makeOut
is optional and defaults to nil, and the shipped recipe is a single Ken Burns spanning the whole
clip with Linear easing—an eased curve spends its speed early or late, which over eight seconds
reads as the photo lurching and then crawling.
/// One slow Ken Burns across the whole clip: a gentle push in with a little drift, at a constant/// rate. An eased curve spends its speed early or late, which over a whole clip reads as the photo/// lurching and then crawling.////// Ken Burns is a pure transform while `animation/ken_burns/fade` stays at its `false` default./// Leave it there: an animation that also ramps the alpha leaves both clips semi-transparent through/// the transition, and the backdrop shows through the blend.private static let kenBurnsDrift = MemoriesAnimationRecipe { engine in let animation = try engine.block.createAnimation(.kenBurns) // The whole clip, so the move is slow enough to read as life rather than motion. try engine.block.setDuration(animation, duration: MemoriesConstants.imageDuration) try engine.block.setFloat(animation, property: "animation/ken_burns/zoomIntensity", value: 0.2) // A full crop-length of travel reads as the photo sliding past; a third of it reads as drift. try engine.block.setFloat(animation, property: "animation/ken_burns/travelDistanceRatio", value: 0.3) try engine.block.setEnum(animation, property: "animationEasing", value: "Linear") return animation}A Transition Per Style#
A transition is as much a style’s character as its filter is, so each one blends differently:
| Style | Transition | Overlap |
|---|---|---|
| Default | .crossFade |
3.2s |
| Noir | .fadeToBlack |
1.8s |
| Hologram | .crossWarp |
1.2s |
| Bubblegum | .colorWipe, pink, sweeping up |
1.0s |
A style declares one as a MemoriesTransition: the type, how long the clips overlap, and a
configure closure for the type’s own properties, which live under transition/{type}/{property}
keypaths. Call findAllProperties on a created transition to see what a type exposes.
transition: MemoriesTransition(type: .colorWipe, duration: 1) { engine, transition in try engine.block.setEnum(transition, property: "transition/color-wipe/direction", value: "Up") try engine.block.setColor(transition, property: "transition/color-wipe/color", color: .rgba(r: 1, g: 0.31, b: 0.64, a: 1))},Because styles overlap by different amounts, choosing one changes how long the montage runs.
style/MemoriesStyleApplier.swift re-wires every boundary, reads the new end back off the engine,
and re-stretches the backdrop and the soundtrack to match—so nothing predicts a duration it can
measure.
Styles From a Custom Asset Source#
The styled looks (Noir, Hologram, Bubblegum) get their backdrops and picker thumbnails from the
kit’s own local asset source, ly.img.memories.style, rather than hard-coded paths. The assets
stay bundled in StarterKit/ly.img.memories.style/ and are described by content.json, which
MemoriesStyleApplier.registerAssetSource registers with
engine.asset.addLocalAssetSourceFromJSON(_:basePath:)—exactly like the default IMG.LY sources.
style/MemoriesStyle.swift then references each backdrop and thumbnail by asset id, and
style/MemoriesStyleApplier.swift resolves the actual URI from the source at apply time. The asset
URIs in content.json use the portable {{base_url}} placeholder, which the engine substitutes
with the basePath the source is registered against. On iOS that is the bundle folder that holds
ly.img.memories.style, so the Android kit uses the same content.json unchanged.
{ "uri": "{{base_url}}/ly.img.memories.style/animations/hologram.json", "thumbUri": "{{base_url}}/ly.img.memories.style/thumbnails/hologram.png"}The two animated backdrops are Lottie, not video. A video fill plays either—the engine picks its
decoder from the asset’s mimeType, so application/json routes the file through its Lottie
renderer and video/mp4 through the video decoder. MemoriesStyle.Background.video is named for
the fill, not the file. Vector costs a fraction of the bytes for this kind of abstract motion: the
two backdrops here are 25 KB together, against 25 MB as MP4.
To add a look, drop its thumbnail (and backdrop, if any) into ly.img.memories.style/, add an
entry to content.json, and add the matching MemoriesStyle to MemoriesStyles.all in
style/MemoriesStyle.swift.
Where to Change Things#
The starter kit ships a generic structure and behavior, but every part of it is in your codebase and meant to be customized. The most common edit points:
- Slide motion —
MemoriesAnimations.swift. Add, remove, or tune the animation recipes a slide can use. Keep them alpha-free, for the reason above. - Transitions — the
transitionfield on eachMemoriesStyle, wired byscene/MemoriesScene+Timeline.swift. - Looks / filters (styles) —
style/MemoriesStyle.swift. Each style bundles a filter, backdrop, transition, and title typeface, referencing the bundled assets by id (see above). - Timing, page size, title —
MemoriesConstants.swift(clip duration, the default transition overlap, canvas size, title duration). - Timeline assembly —
scene/MemoriesScene.swift,scene/MemoriesScene+Timeline.swift, andscene/MemoriesScene+Title.swift. - Dock and bottom panel —
components/Dock+Memories.swiftandcomponents/BottomPanel+Memories.swift. The Audio button opens the editor’s audio library; a new soundtrack replaces the current one and stretches to the montage.
Customize Export Functionality#
Export handling lives in callbacks/OnExport+Memories.swift. The montage is rendered to an MP4 and
opened in the system share sheet; from there you can upload it to your server, save it to the photo
library, or share it.
guard let page = try engine.scene.getCurrentPage() else { throw EditorError("No page was found.")}eventHandler.send(.exportProgress(.relative(0)))let mimeType: MIMEType = .mp4// `.auto` derives a bounded bitrate from the resolution and frame rate.let stream = try await engine.block.exportVideo( page, mimeType: mimeType, options: VideoExportOptions(videoBitrate: .auto),) { _ in }
var lastReportedProgress = 0for try await export in stream { try Task.checkCancellation() switch export { case let .progress(_, encodedFrames, totalFrames): let progress = Int((Float(encodedFrames) / Float(totalFrames)) * 100) if progress > lastReportedProgress { lastReportedProgress = progress eventHandler.send(.exportProgress(.relative(Float(progress) / 100))) } case let .finished(video: videoData): let url = FileManager.default.temporaryDirectory.appendingPathComponent( "Memory", conformingTo: mimeType.uniformType, ) try videoData.write(to: url, options: [.atomic]) eventHandler.send(.exportCompleted { eventHandler.send(.shareFile(url)) }) return }}try Task.checkCancellation()throw EditorError("Failed to export the content.")Closing the editor returns to the media selection screen, which keeps the picked media. Leaving the
flow entirely is driven by the onExit closure passed into MemoriesEditorStarterKit.
Troubleshooting#
Editor doesn’t load#
- Check onCreate: Ensure the
onCreatecallback finishes building the scene and no task is stuck. - Verify the baseURL: Assets must be reachable from the CDN or your self-hosted location.
- Check Xcode console: Look for errors in the Xcode debug console.
Styles show no backdrop or thumbnail#
- Check the folder reference:
ly.img.memories.stylemust be in the app bundle as a folder, with itsthumbnails/andanimations/subfolders.
Export fails or produces blank output#
- Wait for content to load: Ensure media is fully loaded before exporting.
- Check Xcode console: Look for errors in the Xcode debug console.
Next Steps#
- Configuration – Complete list of initialization options
- Serve Assets – Self-host engine assets for production
- Theming – Customize colors and appearance
- Localization – Add translations and language support