MultiSetConfig
SDK Configuration
The MultiSetConfig struct provides centralized configuration for the MultiSet SDK localization behavior. It controls how the AR views perform localization, including timing, quality, and feature settings.
Description
This configuration struct allows you to customize the localization behavior before a query request is made. Settings include auto-localization triggers, background localization intervals, frame capture parameters, confidence thresholds, GPS integration, localization hints (to narrow the search for Map and MapSet localization), and UI feedback options.
Settings are supplied during SDK initialization via MultiSet.shared.initialize(config:callback:). You can also change them at runtime and apply the updated configuration with MultiSet.shared.updateConfig(_:) — the new values take effect on the next localization / tracking query, without re-initializing or re-authenticating. All numeric settings can be clamped to their valid ranges using the validated() method.
Properties
This section details the publicly accessible properties of the MultiSetConfig that can be configured.
Authentication
clientId
String
Required
Your MultiSet client identifier. Obtain from developer.multiset.ai/credentials.
clientSecret
String
Required
Your MultiSet client secret key. Obtain from developer.multiset.ai/credentials.
Map Configuration
mapCode
String
""
Single map identifier for localization. Use either this or mapSetCode.
mapSetCode
String
""
MapSet identifier for localizing against multiple maps. Use either this or mapCode.
Localization Mode
localizationMode
LocalizationMode
.multiFrame
The capture strategy: .singleFrame for quick single-image capture, or .multiFrame for multi-image capture with better accuracy.
Localization Behavior
autoLocalize
Bool
true
Whether to automatically start localization when the AR session begins. If false, the user must manually tap the capture/localize button.
backgroundLocalization
Bool
true
Whether to continue localization in the background after the first success. Helps maintain accurate positioning over time.
bgLocalizationDurationSeconds
Float
30.0
The time interval in seconds between background localization attempts. Only used when backgroundLocalization is true. Valid range: 15 - 180 seconds.
relocalization
Bool
true
Whether to enable relocalization when AR tracking is lost. Automatically triggers localization when the AR tracking state changes to paused or stopped.
firstLocalizationUntilSuccess
Bool
true
Keep trying until the first localization succeeds. If true, failed localizations will silently retry until one succeeds.
Multi-Frame Capture Settings
numberOfFrames
Int
4
The number of frames to capture for multi-frame localization. More frames = better accuracy but longer capture time. Valid range: 4 - 6 frames.
frameCaptureIntervalMs
Int
500
The interval between frame captures in milliseconds. Allows user movement between frames for better coverage. Valid range: 300 - 800 ms.
Confidence Settings
confidenceCheck
Bool
false
Whether to check confidence threshold before accepting localization. If true, localizations with confidence below the threshold will be rejected.
confidenceThreshold
Float
0.3
Minimum confidence score to accept a localization result. Only used when confidenceCheck is true. Valid range: 0.2 - 0.8.
GPS Settings
passGeoPose
Bool
false
Whether to send GPS coordinates as a hint to improve localization. Requires location permission. Useful for outdoor or large-scale maps.
geoCoordinatesInResponse
Bool
false
Whether to include geo-coordinates in the localization response. Useful if you need the world position of localized objects.
hintRadius
Int
25
Search radius in meters for spatial filtering. Only applies when a geo hint or hintPosition is provided; sent when greater than 0. Valid range: 1 - 100.
use2DFiltering
Bool
false
When true, skips altitude (Y-axis) in spatial filtering, using only horizontal distance (X and Z). Only applies when a geo hint is provided.
Localization Hints
These hints narrow the search space for Map and MapSet localization, improving speed and accuracy in large or visually repetitive environments. They are most useful to set (or adjust) at runtime, right before a query — see Updating Configuration at Runtime.
hintMapCodes
[String]
[]
Map codes that narrow the candidate maps during MapSet localization. Only sent when localizing a MapSet; each code is sent as a separate hintMapCodes field.
hintPosition
String
""
Positional hint to seed localization, in "X,Y,Z" format. Sent when non-empty.
hintFloorHeight
String
""
Floor/ceiling height hint, in "floor,ceiling" format (e.g. "0,5"). Sent when non-empty.
UI Settings
showAlerts
Bool
true
Whether to show UI alerts (toasts) for localization status. Shows success/failure messages to the user.
meshVisualization
Bool
true
Whether to show 3D mesh overlay after successful localization. The mesh helps visualize the mapped environment.
Image Quality Settings
imageQuality
Int
90
JPEG quality for captured images sent to the localization API. Higher quality = better accuracy but larger upload size. Valid range: 50 - 100.
Object Tracking Settings
objectCodes
[String]
[]
Array of object codes to track. Obtain from the MultiSet dashboard. Maximum 10 codes.
autoObjectTracking
Bool
true
Whether to automatically start object tracking when the AR session is ready.
backgroundObjectTracking
Bool
true
Whether to re-send tracking requests at regular intervals after first success.
bgObjectTrackingDurationSeconds
Float
15.0
Interval in seconds between background object tracking requests. Valid range: 5 - 30 seconds.
restartObjectTracking
Bool
true
Whether to re-track when AR tracking state is lost or paused.
objectTrackingCaptureDelay
Float
1.0
Delay in seconds before capturing the frame after tracking is triggered. Gives users time to aim. Valid range: 0.5 - 3.0 seconds.
firstObjectTrackingUntilSuccess
Bool
true
If true, failed tracking attempts will silently retry until one succeeds, without triggering onObjectTrackingFailure.
Computed Properties
activeMapType
MapType
Returns .map or .mapSet based on which code is configured.
activeMapCode
String
Returns the active map code (either mapCode or mapSetCode).
hasCredentials
Bool
Returns true if both clientId and clientSecret are configured.
hasMapConfiguration
Bool
Returns true if either mapCode or mapSetCode is configured.
hasObjectTrackingConfiguration
Bool
Returns true if objectCodes is non-empty.
frameCaptureIntervalSeconds
TimeInterval
Returns frameCaptureIntervalMs converted to seconds.
bgLocalizationDuration
TimeInterval
Returns bgLocalizationDurationSeconds as TimeInterval.
Factory Methods
Each factory method returns a MultiSetConfig preset for a common localization strategy.
singleFrame(clientId:clientSecret:mapCode:)
Single-image localization: captures one frame, with auto and background localization disabled.
multiFrame(clientId:clientSecret:mapCode:)
Multi-image localization for higher accuracy.
continuous(clientId:clientSecret:mapCode:)
Aggressive re-localization, re-localizing at 15-second intervals.
Methods
validated()
Returns a new configuration with all numeric settings clamped to their valid ranges.
Declaration
Description
Calling this method returns a new configuration with all values clamped to acceptable bounds. This ensures that all configuration values are within acceptable ranges before they are used by the SDK.
Validation Rules:
bgLocalizationDurationSeconds
15 - 180
numberOfFrames
4 - 6
frameCaptureIntervalMs
300 - 800
confidenceThreshold
0.2 - 0.8
hintRadius
1 - 100
imageQuality
50 - 100
objectCodes
Truncated to 10 entries
bgObjectTrackingDurationSeconds
5 - 30
objectTrackingCaptureDelay
0.5 - 3.0
Example
Updating Configuration at Runtime
Configuration is supplied once at initialization, but you can change the Map / MapSet localization settings on the fly and apply them before the next query request using MultiSet.shared.updateConfig(_:). This is the recommended way to adjust behavior — auto-localize, confidence thresholds, background intervals, localization hints, object-tracking behavior — between queries without tearing down the SDK.
updateConfig(_:)
Declaration
Description
Applies an updated configuration to an already-initialized SDK without re-authenticating. The new behavioral settings take effect on the next localization / tracking query; a run that is already in flight is unaffected. Credentials and authentication state are preserved — to change credentials, call release() followed by initialize(config:callback:) instead. The call is a no-op if the SDK has not been initialized yet.
Example
The updated values take effect on the next
localize()/ object-tracking query — there is no need to re-initialize or re-authenticate the SDK.
In-App Settings Screen
The sample app exposes a Configuration screen (the gear icon on the LandingView) that edits these same properties at runtime. It is backed by a ConfigStore that persists values across launches via UserDefaults, and it calls updateConfig(_:) on Save / Reset — so changes apply to the running SDK immediately, before your next localization or object-tracking query.
Usage Examples
Basic Configuration
Configuration Flow
Best Practices
Always validate configuration by calling
validated()after modifying settings to ensure values are within valid ranges.Apply runtime changes with
updateConfig(_:)rather than re-initializing — it updates the live SDK before the next query without a re-authentication round-trip.Set localization hints (
hintMapCodes,hintPosition,hintRadius) before a MapSet query to narrow the candidate maps in large or repetitive spaces.Disable
firstLocalizationUntilSuccesswhen usingpassGeoPoseandgeoCoordinatesInResponsetogether, as geo-based failures should be reported to the user.Increase
numberOfFramesfor environments with sparse or repetitive features.Enable
backgroundLocalizationfor applications that need to maintain accurate positioning over time.Use higher
imageQualityfor complex environments but be mindful of network bandwidth.
Related
Last updated
Was this helpful?

