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​

NitrakitLicense.set(_:) -> LicenseInfoInstalls your license key (NitrakitUI).
licenseInfo() -> LicenseInfoThe installed license.
setLocale(tag:) -> StringThe editor's language; returns the one used.
availableLocales() -> [String]Built-in languages.
localeIsRtl() -> BoolThe current language is right to left.
setStrings(json:) throwsYour own wording: a JSON object of message id → text.
registerFont(path:) throws -> [String]Adds a font file; returns its family names.
fontFamilies() -> [String]Fonts text can use.
iconNames() -> [String]The built-in icon names.
fontPreview(family:heightPx:path:) throwsWrites a PNG of a family's name in that font, for picker rows.
easingNames() -> [String]Named easings.
NitrakitMedia.resolveYour lookup from a media id to .remote(url) or .file(url).

NitrakitPreviewView​

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​

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:)A new empty project.
init(open:) throwsReopens a saved project.
toJson() -> StringThe project as JSON.
addMedia(id:file:name:) throws -> MediaInfoAdds a local file under your media id: source, kind, durationUs, width, height, hasAudio.
loadMedia()After opening: makes the project's media available (device, else NitrakitMedia.resolve).
setMediaProgress(id:fraction:)Progress on a media id's clips, e.g. while uploading; nil when done.
retryMedia(id:)Resolves a media id (or every missing one) again.
mediaIds() -> [String]The media ids the project uses.
apply(edit:) throws -> String with .addTrack, .insertMedia, .insertTextReturns the new id.
apply(edit:) with any other EditSee Editing from code.
undo(), redo() -> Bool
setListener(listener:)EditorListener.changed(canUndo:canRedo:changes:) after every change.
exportSettings(), exportSettingsFor(shortSide:)
export(path:settings:listener:) -> ExportJobExportJob.cancel(); ExportListener.progress / finished.
selectedClips(), selectClips(clips:)
timeline() -> TimelineViewTracks and clips, for your own UI.
trimLimits(clip:) throws
properties(clip:), property(clip:path:atUs:), setProperty(…), resetProperty(…)
setKeyframe(…), removeKeyframe(…), keyframes(…)
addEffect(clip:kind:), removeEffect(clip:effect:)
effectCatalog(), animationPresets(), textStylePresets(), textAnimationPresets()
beginSession(), commitSession(), cancelSession()One undo step, or revert.

LicenseInfo​

state (whether the key applies to this app, e.g. valid, development or wrong app), the team, and problems saying what doesn't match.