Installation
Download the latest AvatarKit.xcframework from the releases page, unzip, and drag it into your Xcode project. Set Embed & Sign in your target’s Frameworks, Libraries, and Embedded Content.AvatarSDK
Main initialization and configuration interface for AvatarKit.Type Properties
appID
appID
configuration
configuration
sessionToken
sessionToken
userID
userID
version
version
Type Methods
initialize(appID:configuration:)
initialize(appID:configuration:)
appID: The app identifierconfiguration: The configuration for AvatarKit
setRenderQuality(_:)
setRenderQuality(_:)
setRenderResolutionCap(enabled:maxHeight:)
setRenderResolutionCap(enabled:maxHeight:)
isDeviceSupported()
isDeviceSupported()
deviceScore()
deviceScore()
AvatarManager
Manage avatar asset loading, caching, and retrieval.Type Properties
Instance Methods
load(id:onProgress:)
load(id:onProgress:)
id: The avatar identifieronProgress: Optional progress callback
Avatar instance.cancelLoading(id:)
cancelLoading(id:)
id: The avatar identifier
cancelAllLoading()
cancelAllLoading()
retrieve(id:)
retrieve(id:)
id: The avatar identifier
Avatar if available, otherwise nil.derive(assetPath:)
derive(assetPath:)
assetPath: The path to the avatar asset
Avatar instance.clear(id:)
clear(id:)
id: The avatar identifier to clear
clearAll()
clearAll()
clearLRU(keepCount:)
clearLRU(keepCount:)
keepCount: Number of most recently used avatars to keep
getCacheSize(id:)
getCacheSize(id:)
id: The avatar identifier
getAllCacheSize()
getAllCacheSize()
AvatarController
The main controller for managing avatar driving service connections and interactions.Instance Properties
onFirstRendering
onFirstRendering
onConnectionState
onConnectionState
onConversationState
onConversationState
onError
onError
start()
start()
close()
close()
pauseRendering()
pauseRendering()
resumeRendering()
resumeRendering()
isRendering
isRendering
interrupt()
interrupt()
send(_:end:)
send(_:end:)
data: The audio data to sendend: Whether this is the end of the audio stream
yield(_:end:audioFormat:)
yield(_:end:audioFormat:)
data: The audio dataend: Whether this is the end of the audio streamaudioFormat: The audio format (optional)
yield(_:conversationID:)
yield(_:conversationID:)
animations: Array of encoded motion data framesconversationID: The conversation identifier
pointCount
pointCount
volume
volume
AvatarView
A UIView subclass for rendering avatars.Initializers
init(avatar:)
init(avatar:)
avatar: The avatar to display
Instance Properties
controller
controller
contentTransform
contentTransform
Render over an Avatar Background
Download the optional 16:9 background from Spatius Studio and add it to the Asset Catalog. Place the image andAvatarView in the same ZStack, with the image first. AvatarView is transparent by default, so the background shows through.
Avatar
Represents an avatar instance.Configuration
Configuration for AvatarKit.Initializers
init(region:audioFormat:drivingServiceMode:logLevel:renderQuality:)
init(region:audioFormat:drivingServiceMode:logLevel:renderQuality:)
region: The region to connect to ("us-west","ap-northeast", or"cn-beijing")audioFormat: The audio format configurationdrivingServiceMode: The driving service modelogLevel: The log levelrenderQuality: Render quality tier
AudioFormat
Audio format configuration for AvatarKit.Initializers
init(sampleRate:)
init(sampleRate:)
sampleRate: The audio sample rate in Hz
DrivingServiceMode
Driving service modes for AvatarKit.RenderQuality
Render quality tiers for AvatarKit.FrameStarvationMode
Controls playback behavior when motion data cannot keep up with the audio clock.LogLevel
Log levels for AvatarKit.ConnectionState
Connection states for AvatarKit.ConversationState
Conversation states for AvatarKit.Transform
Transform for avatar content rendering.Initializers
init(x:y:scale:)
init(x:y:scale:)
x: The x-axis translationy: The y-axis translationscale: The scale factor

