Skip to main content

iOS and macOS API

Modules Nitrakit and NitrakitUI. Times are microseconds (Int64); ids are String. Calls marked throws throw EditorError.

Functions​

setLicense(key:) -> LicenseInfo StableInstalls your license key.
licenseInfo() -> LicenseInfo StableThe installed license.
setLocale(tag:) -> String StableThe editor's language; returns the one used.
availableLocales() -> [String] StableBuilt-in languages.
localeIsRtl() -> Bool StableThe current language is right to left.
setStrings(json:) throws StableYour own wording: a JSON object of message id → text.
registerFont(path:) throws -> [String] StableAdds a font file; returns its family names.
fontFamilies() -> [String] StableFonts text can use.
iconNames() -> [String] StableThe built-in icon names.
fontPreview(family:heightPx:path:) throws PreviewWrites a PNG of a family's name in that font, for picker rows.
easingNames() -> [String] PreviewNamed easings.
NitrakitMedia.resolve StableYour lookup from a media id to .remote(url) or .file(url).

NitrakitPreviewView Stable​

init(frame:)
editor: Editor?The editor to show. Starts once the view has a size.
player: Player?Playback: play(), pause(), seek(timeUs:), positionUs(), isPlaying(), setVolume(volume:).
onPosition: ((Int64) -> Void)?Playback position, on the main thread.
onPlaying: ((Bool) -> Void)?Playback started or stopped.

NitrakitTimelineView Stable​

init(frame:)
editor: Editor?The editor to show.
timeline: Timeline?setChrome(visible:), select(clip:).
theme: EditorTheme?The editor's look; see Theme.
hideMenuItems(_:), addMenuItem(_:), removeMenuItem(id:)See Tools and menus.
setIcon(_:svg:)See Icons.
onCustomItem: ((String) -> Void)?One of your tools was tapped.
stickerPacks: [StickerPack]Your sticker packs; see Stickers.
fonts: [String]The font panel's list; see Fonts.
onRequest: (@MainActor (EditorRequest) async -> RequestResponse?)?Your pickers: return the answer, .cancel, or nil for the built-in picker.
onSelected: ((String) -> Void)?The selected clip; "" for none.
onFullscreen: (() -> Void)?The fullscreen button was tapped.
onError: ((Error) -> Void)?The view couldn't start.

EditorRequest: kind, clip (the selected clip, "" if none), property (for colours).

RequestType: .addMedia, .addOverlay, .addAudio, .addSticker, .chooseFilter, .chooseFont, .chooseColor, .editText, .chooseTextStyle.

RequestResponse: .source(id:), .text(value:), .color(r:g:b:a:), .effect(id:), .stylePreset(id:), .cancel.

Editor​

init(width:height:fpsNum:fpsDen:) StableA new empty project.
init(open:) throws StableReopens a saved project.
toJson() -> String StableThe project as JSON.
addMedia(id:file:name:) throws -> MediaInfo StableAdds a local file under your media id: source, kind, durationUs, width, height, hasAudio.
loadMedia() StableAfter opening: makes the project's media available (device, else NitrakitMedia.resolve).
setMediaProgress(id:fraction:) StableProgress on a media id's clips, e.g. while uploading; nil when done.
retryMedia(id:) StableResolves a media id (or every missing one) again.
mediaIds() -> [String] StableThe media ids the project uses.
apply(edit:) throws -> String Stable with .addTrack, .insertMedia, .insertTextReturns the new id.
apply(edit:) with any other Edit PreviewSee Editing from code.
undo(), redo() -> Bool Stable
setListener(listener:) StableEditorListener.changed(canUndo:canRedo:changes:) after every change.
exportSettings(), exportSettingsFor(shortSide:) Stable
export(path:settings:listener:) -> ExportJob StableExportJob.cancel(); ExportListener.progress / finished.
selectedClips(), selectClips(clips:) Preview
timeline() -> TimelineView PreviewTracks and clips, for your own UI.
trimLimits(clip:) throws Preview
properties(clip:), property(clip:path:atUs:), setProperty(…), resetProperty(…) Preview
setKeyframe(…), removeKeyframe(…), keyframes(…) Preview
addEffect(clip:kind:), removeEffect(clip:effect:) Preview
effectCatalog(), animationPresets(), textStylePresets(), textAnimationPresets() Preview
beginSession(), commitSession(), cancelSession() PreviewOne undo step, or revert.

LicenseInfo Stable​

state (.valid, .development, .expired, .wrongApp, .invalid, .missing), org, id, trial, expires, updatesUntil, maxExportSeconds (0 = no limit), watermark, problems.