ConnectConfig
A typed configuration object passed to ConnectSDK.shared.enable(with:). Use ConnectConfig when you need more control than the convenience enable(appKey:postURL:push:) method provides.
Platform: iOS 15.1+
Declared in: ConnectSDK
Initializer
public struct ConnectConfig {
public init(
appKey: String,
postURL: String,
push: ConnectPushConfig = .off,
layout: Layout = .loadFromBundle(),
ui: UI = UI(),
logging: Logging = Logging(),
network: Network = Network(),
advanced: [AdvancedKey: Any] = [:]
)
}Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
appKey | String | Required | Your Acoustic Connect app key |
postURL | String | Required | The collector endpoint URL |
push | ConnectPushConfig | .off | Push notification mode and App Group identifier. See ConnectPush. |
layout | Layout | .loadFromBundle() | AutoLayout and map ID configuration |
ui | UI | UI() | SwiftUI capture behavior |
logging | Logging | Logging() | Payload logging and location options |
network | Network | Network() | Timeouts, caching, and compression |
advanced | [AdvancedKey: Any] | [:] | Escape hatch for raw configuration keys. |
Example
let config = ConnectConfig(
appKey: "YOUR_APP_KEY",
postURL: "https://collector.example.com/collectorPost",
push: ConnectPushConfig(mode: .automatic, appGroupIdentifier: "group.com.example.YourApp"),
network: ConnectConfig.Network(postTimeoutSeconds: 30, compressPayloads: true),
advanced: [.sessionTimeout: 300]
)
ConnectSDK.shared.enable(with: config)ConnectConfig.Layout
Controls AutoLayout capture and map ID configuration.
| Property | Type | Default | Description |
|---|---|---|---|
autoLayout | [AnyHashable: Any]? | From bundle | AutoLayout capture configuration dictionary. |
appendMapIds | [AnyHashable: Any]? | From bundle | Map ID append configuration dictionary. |
Static helpers
| Helper | Description |
|---|---|
.loadFromBundle() | Reads configuration from ConnectLayoutConfig.json in the main bundle. This is the default. Falls back to .basicAnalytics if the file is absent. |
.basicAnalytics | Minimal layout configuration sufficient for basic analytics. Used automatically when ConnectLayoutConfig.json is not found in the bundle. |
.none | Disables layout configuration entirely. |
ConnectConfig.UI
Controls SwiftUI-specific capture behavior.
| Property | Type | Default | Description |
|---|---|---|---|
removeSwiftUIDuplicates | Bool | true | Deduplicates repeated SwiftUI view captures. |
captureKeyboardTouches | Bool | false | Captures touches on the system keyboard. |
captureSwiftUINonVariadic | Bool | true | Uses the non-variadic SwiftUI capture path. |
ConnectConfig.Logging
Controls what the SDK logs to the console and whether location events are captured.
| Property | Type | Default | Description |
|---|---|---|---|
logFullPayloads | Bool | false | Logs full HTTP request and response payloads to the console. Useful for debugging; disable in production. |
logLocationEnabled | Bool | false | Logs location updates. Requires the app to have location permission from the user. |
ConnectConfig.Network
Controls network behavior for outgoing SDK payloads.
| Property | Type | Default | Description |
|---|---|---|---|
postTimeoutSeconds | TimeInterval? | nil | POST request timeout in seconds. nil uses the bundle default. |
cachingLevel | Int? | nil | Offline caching level. nil uses the bundle default. |
compressPayloads | Bool | true | Gzip-compresses outgoing payloads. |
ConnectConfig.AdvancedKey
An escape hatch for raw configuration keys not covered by the typed API. Pass values in the advanced dictionary at initialization.
| Key | Raw value | Description |
|---|---|---|
.killSwitchURL | "KillSwitchUrl" | Remote kill-switch endpoint URL. |
.sessionTimeout | "SessionTimeout" | Inactivity timeout in seconds before a new session starts. |
.manualPostEnabled | "ManualPostEnabled" | Enables ConnectSDK.shared.requestManualPost(). |
.dynamicConfigEnabled | "DynamicConfigurationEnabled" | Enables remote configuration fetching. |
.maxBytesPerActivation | "MaxNumberOfBytesPerActivation" | Maximum payload bytes per app activation. |
.maxPostsPerActivation | "MaxNumberOfPostsPerActivation" | Maximum POST requests per app activation. |
.postIntervalSeconds | "PostMessageTimeIntervals" | Interval in seconds between automatic POSTs. |
.maxPostBytesSize | "PostMessageMaxBytesSize" | Maximum bytes per individual POST. |
For keys not listed above, use a custom AdvancedKey:
let config = ConnectConfig(
appKey: "YOUR_APP_KEY",
postURL: "https://collector.example.com/collectorPost",
advanced: [AdvancedKey("YourRawKeyName"): yourValue]
)Updated about 2 hours ago
