Run multiple independent Userpilot instances in the same iOS app
Run multiple independent Userpilot instances in the same process — for example when your app integrates Userpilot directly and also embeds a vendor SDK that bundles Userpilot for its own users.Each instance keeps its own analytics, autocapture routing, storage, and experience UI without interfering with the others.
NoteIf you only have one Userpilot instance in your app, nothing changes. Keep using the Userpilot instance returned by Userpilot(config:). The SDK still resolves unattributed autocapture and screen-tracking events through the instance that claimed the default role (isDefault, which defaults to true).
Userpilot(config:) — isDefault defaults to true, so the host claims default automatically
Vendor SDK that embeds Userpilot
Userpilot(config:) inside the vendor facade with .defaultInstance(false)
Re-initialize idempotently
Userpilot(config:) again — returns the existing instance for the same token
Userpilot.Config.isDefault defaults to true. The host application does not need to call .defaultInstance(true) — a plain Userpilot.Config(token:) already claims the default role. Embedded vendor SDKs must call .defaultInstance(false) so they do not compete for that role.The two initialization entry points that used to exist (Userpilot(config:) and Userpilot.create(config:)) are collapsed into a single Userpilot(config:). An instance claims the default role on registration when the role is unclaimed. Subsequent calls with the same token return the existing instance. A second instance with a different token that also leaves isDefault at its default cannot displace an existing claimant — the SDK logs a warning and un-anchored events keep routing to whoever already holds the role.
Every event — autocapture interaction, autocapture screen, or a manual screen(_:) / track(_:) — routes to one Userpilot instance using a single three-tier rule:
Explicit userpilot: argument, when the API exposes one (for example View.userpilotScreen(_:userpilot:)).
Anchored owner, when something in the UI hierarchy claims the originating UI (Config.attach(viewControllerClasses:), Config.attach(windows:), Config.attach(bundles:)).
Default — the instance that claimed isDefault (defaults to true).
If none of those resolve to a live instance, the event is a silent no-op.There is no fan-out. In the single-instance case the only registered instance claims the default automatically (isDefault defaults to true), so nothing in your integration changes.
If you ship an SDK that uses Userpilot internally, initialize from inside your SDK facade. The factory is idempotent — re-calls with the same token return the existing instance.
public final class AcmeSDK { public static let shared = AcmeSDK() private let acmeUserpilot: Userpilot private init() { let config = Userpilot.Config(token: "ACME") .defaultInstance(false) .enableScreenAutoCapture() .enableInteractionAutoCapture() .attach(bundles: [Bundle(for: AcmeSDK.self)]) acmeUserpilot = Userpilot(config: config) } public func identifyAcmeUser(_ id: String) { acmeUserpilot.identify(userId: id) }}
Key points:
isDefault defaults to true. Every Config attempts to claim the default role on registration unless you opt out. Vendor SDKs must call .defaultInstance(false) so they do not compete for that single slot. When every instance opts out, there is no default and un-anchored events are dropped.
Default resolution is claim-based, not registration-order-based — the instance that successfully holds the isDefault claim becomes the SDK’s default fallback. Init order between host and vendor does not matter when the vendor opts out; only one claimant is allowed at a time, and a second conflicting claim is rejected.
attach(bundles:) teaches the autocapture router which UI events belong to your tenant.
Keep a strong reference to your instance (for example a stored property on your facade). The registry holds instances weakly.
Once the vendor SDK opts out and anchors its UI, the host app does nothing special for default resolution:
let config = Userpilot.Config(token: "HOST") .enableScreenAutoCapture() .enableInteractionAutoCapture() // no .defaultInstance(true) needed — isDefault defaults to truelet hostUserpilot = Userpilot(config: config)AcmeSDK.shared.identifyAcmeUser("acme-99")
Both instances are now live and independent. Init order does not affect which tenant is default as long as the vendor opts out with .defaultInstance(false).
Only one instance can hold the default role at a time. An instance with isDefault left at its default (true) claims that role on registration when the role is unclaimed. If the role is already held, the new claim is rejected (a warning is logged) and the existing claimant keeps the role.This is claim-based, not registration-order-based: registering first does not make an instance the default unless it also opts in, and there is no first-registered fallback when every instance opts out.Correct setup: the host leaves isDefault at its default; every embedded vendor calls .defaultInstance(false). The host then holds the default role regardless of init order.Misconfiguration: if two instances both leave isDefault = true, whichever registers while the role is still unclaimed becomes the default; any later conflicting claim is rejected. Do not rely on init order — always opt vendor instances out.If no instance claims the default role (every instance called .defaultInstance(false)), un-anchored events are dropped rather than attributed to an arbitrary tenant. Keep the default of true on the host app so it owns un-anchored events.Surviving instances are not auto-promoted when the default is torn down. Call Userpilot(config:) again with a config that leaves isDefault at its default to reclaim the role.For manual API calls, keep and pass the explicit Userpilot instance you created.
Autocapture events are attributed to the instance that owns the originating UI. The SDK walks the responder chain from the touched view up to the nearest UIViewController and checks each registered instance’s claimed scope, in this priority order:
attach(viewControllerClasses:) — view controller class match (subclass-aware).
attach(windows:) — the view controller’s containing window matches.
UIHostingController lives in com.apple.SwiftUI, so its bundle never matches a vendor claim. The SDK walks viewController.parent outward from hosting and container view controllers until it finds an ownable view controller. This usually works when SwiftUI views are nested inside a UIKit container in your bundle.For pure SwiftUI vendor UI with no UIKit boundary, prefer .attach(windows:) on a vendor-owned overlay window, or pass userpilot: explicitly on SwiftUI screen-tracking modifiers.
The View.userpilotScreen(_:userpilot:) modifier accepts an optional explicit userpilot: argument:
struct AcmeSettings: View { let acmeUserpilot: Userpilot var body: some View { VStack { /* … */ } .userpilotScreen("Acme.Settings", userpilot: acmeUserpilot) }}
If userpilot: is passed, the event publishes on that instance. Otherwise it publishes on the default instance. If neither resolves, the event is a no-op.
By default, autocapture events publish only on the instance that owns the originating UI. A vendor-owned screen or tap is reported to the vendor tenant only.If the host app wants autocapture events that originate inside embedded vendor SDKs, opt in on the host (default) instance:
Autocapture events that resolve to a non-default instance are published to that instance and forwarded to the default instance.
The flag is read only on the resolved default instance. Setting it on a vendor instance has no effect.
Forwarded events are delivered unchanged through the host’s publisher — associated with the host’s user/session and reported to the host backend. There is no extra tagging.
The host’s own events are never duplicated to itself, and forwarding never re-routes, so there is no fan-out loop.
Routing still decides the owning tenant; forwarding only adds a copy to the default when the default opted in.
Userpilot(config:) is a get-or-create factory. Calling it twice for the same token returns the same instance. The isDefault flag on a repeat call is ignored when the instance already exists — the original default claim (or lack thereof) is preserved:
let a = Userpilot(config: .init(token: "HOST")) // claims default (isDefault defaults true)let b = Userpilot(config: .init(token: "HOST"))// a and b share the same dependency container. The supplied config on `b` is discarded.
This protects against accidental double initialization from SceneDelegate / AppDelegate overlap.
Each Userpilot instance owns its own dedicated overlay UIWindow. When an experience triggers, it presents on that window, not on the host app’s key window:
Two instances can present experiences simultaneously on different window levels.
Touches outside any presented experience pass through so the underlying app stays interactive.
Window levels are deterministic and stable across launches.
PushNotificationAutoConfig registers one monitor per Userpilot instance:
Token registration fans out to every monitor so each instance can forward the token to its backend.
Notification responses use the payload app_token to route directly to the matching Userpilot instance. Older payloads without app_token fall back to trying registered monitors until one claims the response.
Static autocapture flags. UIKit method swizzles install once per process for the union of all instances’ enabled features. Autocapture uses each instance’s config to filter events at delivery time.
The default fallback is not thread-locked to a tenant. It always points at the default claimant (isDefault). To act on a specific tenant, keep and pass the explicit Userpilot instance you created. When no instance holds the default role, there is no first-registered fallback.
stopAutoCapture() / resumeAutoCapture() are per-instance methods.
Userpilot.enableAutomaticPushConfig() is process-wide — calling it from any instance enables it for all.
SwiftUI ownership can be ambiguous with no UIKit container in your bundle. Prefer .attach(windows:) or pass userpilot: explicitly.
Two instances with the same token never happens through the public factory — Userpilot(config:) is idempotent.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"Userpilot Knowledge Base","colors":{"primary":"#6765e8","light":"#9a98f0","dark":"#343374"},"logo":{"light":"https://mintcdn.com/userpilot/KtUQBkEo7Hf3bjCu/up-logo-dark.svg?fit=max\u0026auto=format\u0026n=KtUQBkEo7Hf3bjCu\u0026q=85\u0026s=ed5988b05e17770537d7327506be349c","dark":"https://mintcdn.com/userpilot/KtUQBkEo7Hf3bjCu/up-logo-light.svg?fit=max\u0026auto=format\u0026n=KtUQBkEo7Hf3bjCu\u0026q=85\u0026s=2558daac7455ff6275b45a01cecb8ca9"},"favicon":"https://mintcdn.com/userpilot/KtUQBkEo7Hf3bjCu/up-favicon.svg?fit=max\u0026auto=format\u0026n=KtUQBkEo7Hf3bjCu\u0026q=85\u0026s=bd3fb42ae91a32d13d543fed45a8b88e","footer":{"socials":{"twitter":"https://linkedin.com/company/teamuserpilot","facebook":"https://facebook.com/userpilot","linkedin":"https://linkedin.com/company/teamuserpilot"},"links":[{"header":"Support","items":[{"label":"support@userpilot.com","href":"mailto:support@userpilot.com"}]}]},"seo":{"metatags":{"canonical":"https://docs.userpilot.com","og:site_name":"Userpilot Knowledge Base","og:type":"website","og:image":"https://docs.userpilot.com/up-logo-dark.svg","twitter:card":"summary_large_image","twitter:site":"@usaborpilot"}},"styling":{"latex":false},"navigation":{"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"userpilot","hasAudioNarration":false,"actualSubdomain":"userpilot","customDomains":["docs.userpilot.com"],"gitSource":{"type":"github","owner":"userpilot","repo":"docs","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"feedback":{"edits":true,"issues":true,"thumbs":true},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6af1aa6212241f5ef5b8694e","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"Platform","count":137},{"language":"default","tag":"Developer","count":88},{"language":"default","tag":"Installation","count":76},{"language":"default","tag":"Mobile","count":68},{"language":"default","tag":"In App Engagement","count":56},{"language":"default","tag":"APIs","count":42},{"language":"default","tag":"Configure","count":23},{"language":"default","tag":"Endpoints","count":20},{"language":"default","tag":"Bulk Export","count":17},{"language":"default","tag":"Integrations","count":14}]},"assistantConfig":{},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":":root{--primary: 103 101 232;--primary-light: 225 224 250;--primary-dark: 103 101 232;--background-light: 255 255 255;--background-dark: 9 13 13;--gray-50: 243 247 246;--gray-100: 238 242 241;--gray-200: 222 226 226;--gray-300: 206 210 209;--gray-400: 158 163 162;--gray-500: 112 116 115;--gray-600: 80 84 83;--gray-700: 62 67 66;--gray-800: 37 41 40;--gray-900: 23 27 26;--gray-950: 10 14 13;--header: 128 127 236;--hover-btn: 52 51 116;--accent: 103 101 232}header#header>div>div{color:rgb(var(--header))}body :is(.dark\\:bg-primary-light:is(.dark *)){background:rgb(var(--accent))}body :is(.dark\\:bg-primary-light\\/10:is(.dark *)){background:rgb(var(--hover-btn))}"}],"page":{"pagePath":"developer/installation/mobile/ios/multi-instance","slug":"/developer/installation/mobile/ios/multi-instance","pageMetadata":{"title":"Multi-Instance","description":"Run multiple independent Userpilot instances in the same iOS app","keywords":["Userpilot","iOS","Mobile","Multi-Instance","Multi-Tenant","SDK","developer"],"href":"/developer/installation/mobile/ios/multi-instance"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Run multiple independent Userpilot instances in the same iOS app\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,hr:`hr`,li:`li`,ol:`ol`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Tip}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Tip)_missingMdxReference(`Tip`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`Run multiple independent Userpilot instances in the same process — for example when your app integrates Userpilot directly and also embeds a vendor SDK that bundles Userpilot for its own users.`}),`\n`,_jsx(_components.p,{children:`Each instance keeps its own analytics, autocapture routing, storage, and experience UI without interfering with the others.`}),`\n`,_jsxs(Tip,{children:[_jsx(_components.p,{children:_jsx(_components.strong,{children:`Note`})}),_jsxs(_components.p,{children:[`If you only have one Userpilot instance in your app, nothing changes. Keep using the `,_jsx(_components.code,{children:`Userpilot`}),` instance returned by `,_jsx(_components.code,{children:`Userpilot(config:)`}),`. The SDK still resolves unattributed autocapture and screen-tracking events through the instance that claimed the default role (`,_jsx(_components.code,{children:`isDefault`}),`, which defaults to `,_jsx(_components.code,{children:`true`}),`).`]})]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`quick-reference`,children:`Quick Reference`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.strong,{children:`Scenario`})}),_jsx(_components.th,{children:_jsx(_components.strong,{children:`Use`})})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Single instance (host app only)`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Userpilot(config:)`}),` — `,_jsx(_components.code,{children:`isDefault`}),` defaults to `,_jsx(_components.code,{children:`true`}),`, so the host claims default automatically`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Vendor SDK that embeds Userpilot`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Userpilot(config:)`}),` inside the vendor facade with `,_jsx(_components.code,{children:`.defaultInstance(false)`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Re-initialize idempotently`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`Userpilot(config:)`}),` again — returns the existing instance for the same token`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Userpilot.Config.isDefault`}),` defaults to `,_jsx(_components.strong,{children:_jsx(_components.code,{children:`true`})}),`. The host application does not need to call `,_jsx(_components.code,{children:`.defaultInstance(true)`}),` — a plain `,_jsx(_components.code,{children:`Userpilot.Config(token:)`}),` already claims the default role. Embedded vendor SDKs `,_jsx(_components.strong,{children:`must`}),` call `,_jsx(_components.code,{children:`.defaultInstance(false)`}),` so they do not compete for that role.`]}),`\n`,_jsxs(_components.p,{children:[`The two initialization entry points that used to exist (`,_jsx(_components.code,{children:`Userpilot(config:)`}),` and `,_jsx(_components.code,{children:`Userpilot.create(config:)`}),`) are collapsed into a single `,_jsx(_components.code,{children:`Userpilot(config:)`}),`. An instance claims the default role on registration when the role is unclaimed. Subsequent calls with the same token return the existing instance. A second instance with a `,_jsx(_components.strong,{children:`different`}),` token that also leaves `,_jsx(_components.code,{children:`isDefault`}),` at its default cannot displace an existing claimant — the SDK logs a warning and un-anchored events keep routing to whoever already holds the role.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`event-routing`,children:`Event Routing`}),`\n`,_jsxs(_components.p,{children:[`Every event — autocapture interaction, autocapture screen, or a manual `,_jsx(_components.code,{children:`screen(_:)`}),` / `,_jsx(_components.code,{children:`track(_:)`}),` — routes to one Userpilot instance using a single three-tier rule:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[`Explicit `,_jsx(_components.code,{children:`userpilot:`}),` argument`]}),`, when the API exposes one (for example `,_jsx(_components.code,{children:`View.userpilotScreen(_:userpilot:)`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Anchored owner`}),`, when something in the UI hierarchy claims the originating UI (`,_jsx(_components.code,{children:`Config.attach(viewControllerClasses:)`}),`, `,_jsx(_components.code,{children:`Config.attach(windows:)`}),`, `,_jsx(_components.code,{children:`Config.attach(bundles:)`}),`).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Default`}),` — the instance that claimed `,_jsx(_components.code,{children:`isDefault`}),` (defaults to `,_jsx(_components.code,{children:`true`}),`).`]}),`\n`]}),`\n`,_jsx(_components.p,{children:`If none of those resolve to a live instance, the event is a silent no-op.`}),`\n`,_jsxs(_components.p,{children:[`There is no fan-out. In the single-instance case the only registered instance claims the default automatically (`,_jsx(_components.code,{children:`isDefault`}),` defaults to `,_jsx(_components.code,{children:`true`}),`), so nothing in your integration changes.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`single-instance-integration`,children:`Single-Instance Integration`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"YOUR_TOKEN\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`logging`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enabled`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableScreenAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableInteractionAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` userpilot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: config) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// isDefault defaults to true → claims default`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`identify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`userId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"user-123\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`eventName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Added to Cart\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`No `,_jsx(_components.code,{children:`.defaultInstance(true)`}),` is required — `,_jsx(_components.code,{children:`isDefault`}),` already defaults to `,_jsx(_components.code,{children:`true`}),`, so the host app’s plain `,_jsx(_components.code,{children:`Config`}),` claims the default role on init.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`multi-instance-integration`,children:`Multi-Instance Integration`}),`\n`,_jsx(Heading,{level:`3`,id:`vendor-sdk`,children:`Vendor SDK`}),`\n`,_jsxs(_components.p,{children:[`If you ship an SDK that uses Userpilot internally, initialize from inside your SDK facade. The factory is `,_jsx(_components.strong,{children:`idempotent`}),` — re-calls with the same token return the existing instance.`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`19`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`19`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` final`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` class`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` AcmeSDK`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` static`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` shared `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` AcmeSDK`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` private`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` acmeUserpilot: Userpilot`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` private`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`() {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ACME\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`defaultInstance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableScreenAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableInteractionAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`attach`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`bundles`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Bundle`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: AcmeSDK.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)])`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` acmeUserpilot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: config)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` public`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` func`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:` identifyAcmeUser`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#8250DF`,\"--shiki-dark\":`#DCDCAA`},children:`_`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:` id`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`String`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`) {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` acmeUserpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`identify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`userId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: id)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`Key points:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`isDefault`}),` defaults to `,_jsx(_components.code,{children:`true`}),`.`]}),` Every `,_jsx(_components.code,{children:`Config`}),` attempts to claim the default role on registration unless you opt out. Vendor SDKs `,_jsx(_components.strong,{children:`must`}),` call `,_jsx(_components.code,{children:`.defaultInstance(false)`}),` so they do not compete for that single slot. When every instance opts out, there is no default and un-anchored events are dropped.`]}),`\n`,_jsxs(_components.li,{children:[`Default resolution is `,_jsx(_components.strong,{children:`claim-based, not registration-order-based`}),` — the instance that successfully holds the `,_jsx(_components.code,{children:`isDefault`}),` claim becomes the SDK’s default fallback. Init order between host and vendor does not matter when the vendor opts out; only one claimant is allowed at a time, and a second conflicting claim is rejected.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`attach(bundles:)`})}),` teaches the autocapture router which UI events belong to your tenant.`]}),`\n`,_jsxs(_components.li,{children:[`Keep a `,_jsx(_components.strong,{children:`strong reference`}),` to your instance (for example a stored property on your facade). The registry holds instances weakly.`]}),`\n`]}),`\n`,_jsx(Heading,{level:`3`,id:`host-app-+-embedded-vendor`,children:`Host app + embedded vendor`}),`\n`,_jsx(_components.p,{children:`Once the vendor SDK opts out and anchors its UI, the host app does nothing special for default resolution:`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`7`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`7`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` config `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"HOST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableScreenAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableInteractionAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:` // no .defaultInstance(true) needed — isDefault defaults to true`})}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hostUserpilot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: config)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`AcmeSDK.`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#9CDCFE`},children:`shared`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`identifyAcmeUser`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"acme-99\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Both instances are now live and independent. Init order does not affect which tenant is default as long as the vendor opts out with `,_jsx(_components.code,{children:`.defaultInstance(false)`}),`.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`the-default-instance`,children:`The Default Instance`}),`\n`,_jsxs(_components.p,{children:[`Only `,_jsx(_components.strong,{children:`one`}),` instance can hold the default role at a time. An instance with `,_jsx(_components.code,{children:`isDefault`}),` left at its default (`,_jsx(_components.code,{children:`true`}),`) claims that role on registration `,_jsx(_components.strong,{children:`when the role is unclaimed`}),`. If the role is already held, the new claim is `,_jsx(_components.strong,{children:`rejected`}),` (a warning is logged) and the `,_jsx(_components.strong,{children:`existing claimant keeps the role`}),`.`]}),`\n`,_jsxs(_components.p,{children:[`This is `,_jsx(_components.strong,{children:`claim-based`}),`, not registration-order-based: registering first does not make an instance the default unless it also opts in, and there is no first-registered fallback when every instance opts out.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Correct setup:`}),` the host leaves `,_jsx(_components.code,{children:`isDefault`}),` at its default; every embedded vendor calls `,_jsx(_components.code,{children:`.defaultInstance(false)`}),`. The host then holds the default role `,_jsx(_components.strong,{children:`regardless of init order`}),`.`]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.strong,{children:`Misconfiguration:`}),` if two instances both leave `,_jsx(_components.code,{children:`isDefault = true`}),`, whichever registers `,_jsx(_components.strong,{children:`while the role is still unclaimed`}),` becomes the default; any later conflicting claim is rejected. Do not rely on init order — always opt vendor instances out.`]}),`\n`,_jsxs(_components.p,{children:[`If `,_jsx(_components.strong,{children:`no`}),` instance claims the default role (every instance called `,_jsx(_components.code,{children:`.defaultInstance(false)`}),`), un-anchored events are dropped rather than attributed to an arbitrary tenant. Keep the default of `,_jsx(_components.code,{children:`true`}),` on the host app so it owns un-anchored events.`]}),`\n`,_jsxs(_components.p,{children:[`Surviving instances are `,_jsx(_components.strong,{children:`not`}),` auto-promoted when the default is torn down. Call `,_jsx(_components.code,{children:`Userpilot(config:)`}),` again with a config that leaves `,_jsx(_components.code,{children:`isDefault`}),` at its default to reclaim the role.`]}),`\n`,_jsxs(_components.p,{children:[`For manual API calls, keep and pass the explicit `,_jsx(_components.code,{children:`Userpilot`}),` instance you created.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`autocapture-routing`,children:`Autocapture Routing`}),`\n`,_jsxs(_components.p,{children:[`Autocapture events are attributed to the instance that owns the originating UI. The SDK walks the responder chain from the touched view up to the nearest `,_jsx(_components.code,{children:`UIViewController`}),` and checks each registered instance’s claimed scope, in this priority order:`]}),`\n`,_jsxs(_components.ol,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`attach(viewControllerClasses:)`})}),` — view controller class match (subclass-aware).`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`attach(windows:)`})}),` — the view controller’s containing window matches.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`attach(bundles:)`})}),` — `,_jsx(_components.code,{children:`Bundle(for: VC.class)`}),` identifier matches.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Default fallback`}),` — routes to the instance that claimed `,_jsx(_components.code,{children:`isDefault`}),`, or is dropped when no default exists.`]}),`\n`]}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:_jsx(_components.strong,{children:`Vendor situation`})}),_jsx(_components.th,{children:_jsx(_components.strong,{children:`Recommended attach`})})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Vendor UI lives in its own framework`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`.attach(bundles: [Bundle(for: AcmeSDK.self)])`})})]}),_jsxs(_components.tr,{children:[_jsxs(_components.td,{children:[`Vendor presents on a custom `,_jsx(_components.code,{children:`UIWindow`})]}),_jsx(_components.td,{children:_jsx(_components.code,{children:`.attach(windows: [acmeWindow])`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Vendor UI is mixed into the host bundle (rare)`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`.attach(viewControllerClasses: [AcmeViewController.self])`}),` per view controller`]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Pure SwiftUI vendor view inside a generic hosting controller`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`.attach(windows:)`}),` on the vendor overlay window, or `,_jsx(_components.code,{children:`.attach(viewControllerClasses:)`}),` on a wrapper view controller`]})]})]})]}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`.attach(...)`}),` calls are additive — call them as many times as needed and they stack into a single `,_jsx(_components.code,{children:`Config`}),`.`]}),`\n`,_jsx(Heading,{level:`3`,id:`swiftui-ownership`,children:`SwiftUI ownership`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`UIHostingController`}),` lives in `,_jsx(_components.code,{children:`com.apple.SwiftUI`}),`, so its bundle never matches a vendor claim. The SDK walks `,_jsx(_components.code,{children:`viewController.parent`}),` outward from hosting and container view controllers until it finds an ownable view controller. This usually works when SwiftUI views are nested inside a UIKit container in your bundle.`]}),`\n`,_jsxs(_components.p,{children:[`For pure SwiftUI vendor UI with no UIKit boundary, prefer `,_jsx(_components.code,{children:`.attach(windows:)`}),` on a vendor-owned overlay window, or pass `,_jsx(_components.code,{children:`userpilot:`}),` explicitly on SwiftUI screen-tracking modifiers.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`swiftui-screen-events`,children:`SwiftUI Screen Events`}),`\n`,_jsxs(_components.p,{children:[`The `,_jsx(_components.code,{children:`View.userpilotScreen(_:userpilot:)`}),` modifier accepts an optional explicit `,_jsx(_components.code,{children:`userpilot:`}),` argument:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`8`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`8`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`struct`}),_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#4EC9B0`},children:` AcmeSettings`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#4EC9B0`},children:`View `}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` acmeUserpilot: Userpilot`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:` var`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` body: `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#C586C0`},children:`some`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` View {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` VStack`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` { `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`/* … */`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`userpilotScreen`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"Acme.Settings\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`, `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: acmeUserpilot)`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`If `,_jsx(_components.code,{children:`userpilot:`}),` is passed, the event publishes on that instance. Otherwise it publishes on the default instance. If neither resolves, the event is a no-op.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`forwarding-events-to-the-host`,children:`Forwarding Events to the Host`}),`\n`,_jsxs(_components.p,{children:[`By default, autocapture events publish only on the instance that owns the originating UI. A vendor-owned screen or tap is reported to the `,_jsx(_components.strong,{children:`vendor`}),` tenant only.`]}),`\n`,_jsxs(_components.p,{children:[`If the host app wants autocapture events that originate inside embedded vendor SDKs, opt in on the `,_jsx(_components.strong,{children:`host (default) instance`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`6`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`6`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hostConfig `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"HOST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableScreenAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableInteractionAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`allowReceiveEventsFromExternalSource`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hostUserpilot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: hostConfig)`})]}),`\n`]})})}),`\n`,_jsx(_components.p,{children:`When enabled:`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[`Autocapture events that resolve to a `,_jsx(_components.strong,{children:`non-default`}),` instance are published to that instance `,_jsx(_components.strong,{children:`and`}),` forwarded to the default instance.`]}),`\n`,_jsxs(_components.li,{children:[`The flag is read `,_jsx(_components.strong,{children:`only on the resolved default instance`}),`. Setting it on a vendor instance has no effect.`]}),`\n`,_jsx(_components.li,{children:`Forwarded events are delivered unchanged through the host’s publisher — associated with the host’s user/session and reported to the host backend. There is no extra tagging.`}),`\n`,_jsx(_components.li,{children:`The host’s own events are never duplicated to itself, and forwarding never re-routes, so there is no fan-out loop.`}),`\n`]}),`\n`,_jsx(_components.p,{children:`Routing still decides the owning tenant; forwarding only adds a copy to the default when the default opted in.`}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`idempotent-initialization`,children:`Idempotent Initialization`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`Userpilot(config:)`}),` is a get-or-create factory. Calling it twice for the same token returns the same instance. The `,_jsx(_components.code,{children:`isDefault`}),` flag on a repeat call is ignored when the instance already exists — the original default claim (or lack thereof) is preserved:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` a `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: .`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"HOST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// claims default (isDefault defaults true)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` b `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: .`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`init`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"HOST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`))`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:\"// a and b share the same dependency container. The supplied config on `b` is discarded.\"})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`This protects against accidental double initialization from `,_jsx(_components.code,{children:`SceneDelegate`}),` / `,_jsx(_components.code,{children:`AppDelegate`}),` overlap.`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`experience-presentation`,children:`Experience Presentation`}),`\n`,_jsxs(_components.p,{children:[`Each `,_jsx(_components.code,{children:`Userpilot`}),` instance owns its own dedicated overlay `,_jsx(_components.code,{children:`UIWindow`}),`. When an experience triggers, it presents on that window, not on the host app’s key window:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`Two instances can present experiences simultaneously on different window levels.`}),`\n`,_jsx(_components.li,{children:`Touches outside any presented experience pass through so the underlying app stays interactive.`}),`\n`,_jsx(_components.li,{children:`Window levels are deterministic and stable across launches.`}),`\n`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`push-notifications`,children:`Push Notifications`}),`\n`,_jsxs(_components.p,{children:[_jsx(_components.code,{children:`PushNotificationAutoConfig`}),` registers one monitor per Userpilot instance:`]}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Token registration`}),` fans out to every monitor so each instance can forward the token to its backend.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Notification responses`}),` use the payload `,_jsx(_components.code,{children:`app_token`}),` to route directly to the matching `,_jsx(_components.code,{children:`Userpilot`}),` instance. Older payloads without `,_jsx(_components.code,{children:`app_token`}),` fall back to trying registered monitors until one claims the response.`]}),`\n`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`limitations`,children:`Limitations`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Static autocapture flags.`}),` UIKit method swizzles install once per process for the union of all instances’ enabled features. Autocapture uses each instance’s config to filter events at delivery time.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`The default fallback is not thread-locked to a tenant.`}),` It always points at the default claimant (`,_jsx(_components.code,{children:`isDefault`}),`). To act on a specific tenant, keep and pass the explicit `,_jsx(_components.code,{children:`Userpilot`}),` instance you created. When no instance holds the default role, there is no first-registered fallback.`]}),`\n`,_jsxs(_components.li,{children:[_jsxs(_components.strong,{children:[_jsx(_components.code,{children:`stopAutoCapture()`}),` / `,_jsx(_components.code,{children:`resumeAutoCapture()`})]}),` are per-instance methods.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:_jsx(_components.code,{children:`Userpilot.enableAutomaticPushConfig()`})}),` is process-wide — calling it from any instance enables it for all.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`SwiftUI ownership`}),` can be ambiguous with no UIKit container in your bundle. Prefer `,_jsx(_components.code,{children:`.attach(windows:)`}),` or pass `,_jsx(_components.code,{children:`userpilot:`}),` explicitly.`]}),`\n`,_jsxs(_components.li,{children:[_jsx(_components.strong,{children:`Two instances with the same token`}),` never happens through the public factory — `,_jsx(_components.code,{children:`Userpilot(config:)`}),` is idempotent.`]}),`\n`]}),`\n`,_jsx(_components.hr,{}),`\n`,_jsx(Heading,{level:`2`,id:`complete-example`,children:`Complete Example`}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`18`,language:`swift`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`swift`,children:_jsxs(_components.code,{language:`swift`,numberOfLines:`18`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// AppDelegate.swift (host app)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hostConfig `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"HOST\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`logging`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enabled`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`true`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableScreenAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableInteractionAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` hostUserpilot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: hostConfig) `}),_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// isDefault defaults to true → claims default`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#6E7781`,\"--shiki-dark\":`#6A9955`},children:`// AcmeSDK.swift (vendor SDK)`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` vendorConfig `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` Userpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`token`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"ACME\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`defaultInstance`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:`false`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableScreenAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`enableInteractionAutoCapture`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`()`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` .`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`attach`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`bundles`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: [`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`Bundle`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`for`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: AcmeSDK.`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`self`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)])`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#569CD6`},children:`let`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` acmeUserpilot `}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D4D4D4`},children:`=`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:` Userpilot`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`config`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: vendorConfig)`})]}),`\n`,_jsx(_components.span,{className:`line`}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`hostUserpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`identify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`userId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"host-42\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`acmeUserpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`identify`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`userId`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"acme-99\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`acmeUserpilot.`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`track`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`(`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#DCDCAA`},children:`eventName`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"vendor_action\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`)`})]}),`\n`]})})})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Multi-Instance","description":"Run multiple independent Userpilot instances in the same iOS app","keywords":["Userpilot","iOS","Mobile","Multi-Instance","Multi-Tenant","SDK","developer"],"href":"/developer/installation/mobile/ios/multi-instance"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Quick Reference","slug":"quick-reference","depth":2,"children":[]},{"title":"Event Routing","slug":"event-routing","depth":2,"children":[]},{"title":"Single-Instance Integration","slug":"single-instance-integration","depth":2,"children":[]},{"title":"Multi-Instance Integration","slug":"multi-instance-integration","depth":2,"children":[{"title":"Vendor SDK","slug":"vendor-sdk","depth":3,"children":[]},{"title":"Host app + embedded vendor","slug":"host-app-+-embedded-vendor","depth":3,"children":[]}]},{"title":"The Default Instance","slug":"the-default-instance","depth":2,"children":[]},{"title":"Autocapture Routing","slug":"autocapture-routing","depth":2,"children":[{"title":"SwiftUI ownership","slug":"swiftui-ownership","depth":3,"children":[]}]},{"title":"SwiftUI Screen Events","slug":"swiftui-screen-events","depth":2,"children":[]},{"title":"Forwarding Events to the Host","slug":"forwarding-events-to-the-host","depth":2,"children":[]},{"title":"Idempotent Initialization","slug":"idempotent-initialization","depth":2,"children":[]},{"title":"Experience Presentation","slug":"experience-presentation","depth":2,"children":[]},{"title":"Push Notifications","slug":"push-notifications","depth":2,"children":[]},{"title":"Limitations","slug":"limitations","depth":2,"children":[]},{"title":"Complete Example","slug":"complete-example","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":["/_mintlify/custom/userpilot/3ace2e9458eac66f/.prettierrc.js","/_mintlify/custom/userpilot/27d7e6557bc674e7/plausible.js","/_mintlify/custom/userpilot/222114e09e9d43ba/scripts/generate-kb-manifest.js","/_mintlify/custom/userpilot/7588c52f105b4ce6/scripts/check-nav.js","/_mintlify/custom/userpilot/77c4aabf1776912c/scripts/check-redirects.js","/_mintlify/custom/userpilot/c4efe6226e95d900/scripts/lib/docs-lib.js","/_mintlify/custom/userpilot/8278790c2c1428e5/scripts/precommit.js","/_mintlify/custom/userpilot/826df8c2727af7c1/scripts/seo-audit.js"],"subdomain":"userpilot","siteName":"Userpilot Knowledge Base","title":"Multi-Instance - Userpilot Knowledge Base","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-09-28T20:58:47.270Z","originalFileLocation":"developer/installation/mobile/ios/multi-instance.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"system\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Run multiple independent Userpilot instances in the same iOS app\">\u003cmeta data-mint-head name=\"application-name\" content=\"Userpilot Knowledge Base\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Multi-Instance - Userpilot Knowledge Base\">\u003cmeta data-mint-head property=\"og:description\" content=\"Run multiple independent Userpilot instances in the same iOS app\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Userpilot Knowledge Base\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://docs.userpilot.com/up-logo-dark.svg\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Multi-Instance - Userpilot Knowledge Base\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Run multiple independent Userpilot instances in the same iOS app\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://docs.userpilot.com/up-logo-dark.svg\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/userpilot/aR1cLyV1TsYivBqB/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Userpilot Knowledge Base\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#6765e8\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/developer/installation/mobile/ios/multi-instance.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.userpilot.com/#organization\",\"name\":\"Userpilot Knowledge Base\",\"url\":\"https://docs.userpilot.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/userpilot/KtUQBkEo7Hf3bjCu/up-logo-dark.svg?fit=max\u0026auto=format\u0026n=KtUQBkEo7Hf3bjCu\u0026q=85\u0026s=ed5988b05e17770537d7327506be349c\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.userpilot.com#website\",\"name\":\"Userpilot Knowledge Base\",\"url\":\"https://docs.userpilot.com\",\"publisher\":{\"@id\":\"https://docs.userpilot.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance#webpage\",\"url\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance\",\"name\":\"Multi-Instance\",\"description\":\"Run multiple independent Userpilot instances in the same iOS app\",\"dateModified\":\"2026-09-28T20:58:47.270Z\",\"isPartOf\":{\"@id\":\"https://docs.userpilot.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Installation\",\"item\":\"https://docs.userpilot.com/developer/installation/web\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Mobile\",\"item\":\"https://docs.userpilot.com/developer/installation/mobile/overview\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"iOS\",\"item\":\"https://docs.userpilot.com/developer/installation/mobile/ios/installation\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Multi-Instance\",\"item\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance#article\",\"headline\":\"Multi-Instance\",\"name\":\"Multi-Instance\",\"description\":\"Run multiple independent Userpilot instances in the same iOS app\",\"url\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance\",\"mainEntityOfPage\":{\"@id\":\"https://docs.userpilot.com/developer/installation/mobile/ios/multi-instance#webpage\"},\"image\":\"https://docs.userpilot.com/up-logo-dark.svg\",\"dateModified\":\"2026-09-28T20:58:47.270Z\",\"keywords\":\"Userpilot, iOS, Mobile, Multi-Instance, Multi-Tenant, SDK, developer\",\"publisher\":{\"@id\":\"https://docs.userpilot.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.userpilot.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Userpilot Knowledge Base\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"Userpilot Knowledge Base\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/developer/installation/mobile/ios/multi-instance.md","siteName":"Userpilot Knowledge Base","nav":{"global":null,"tabs":[{"tab":"Platform","pages":[{"title":"Platform","href":"/getting-started/what-is-userpilot"}]},{"tab":"Integrations","pages":[{"title":"Integrations","href":"/integrations/overview"}]},{"tab":"Developer","groups":[{"group":"Installation","icon":"gear-code","pages":[{"group":"Web","pages":[{"title":"Web Installation","sidebarTitle":"Overview","href":"/developer/installation/web"},{"title":"Agent SDK Installation","sidebarTitle":"Agents SDK","href":"/agent-sdk-installation"},{"group":"SDK Settings","icon":"sliders","pages":[{"title":"Callbacks","href":"/developer/installation/sdk/settings/callbacks"},{"title":"Integrations Interfaces","sidebarTitle":"Integration Interfaces","href":"/developer/installation/sdk/settings/integrations_interfaces"},{"title":"Auto-Capture Privacy Settings","href":"/developer/installation/sdk/settings/privacy"}]}]},{"group":"Mobile","pages":[{"title":"Install Userpilot Mobile SDK","sidebarTitle":"Overview","href":"/developer/installation/mobile/overview"},{"title":"Mobile Autocapture Screen Migration","href":"/developer/installation/mobile/mobile-autocapture-screen-migration"},{"group":"iOS","pages":[{"title":"iOS SDK","sidebarTitle":"Installation","href":"/developer/installation/mobile/ios/installation"},{"title":"Callbacks","href":"/developer/installation/mobile/ios/callbacks"},{"title":"Push Notifications","href":"/developer/installation/mobile/ios/push-notifications"},{"title":"Custom URL Scheme","href":"/developer/installation/mobile/ios/custom_scheme"},{"title":"Auto Capture","description":"Configure auto capture for the Userpilot iOS SDK","href":"/developer/installation/mobile/ios/auto-capture"},{"title":"Multi-Instance","href":"/developer/installation/mobile/ios/multi-instance"},{"title":"Fonts","description":"Configure system and custom fonts in the Userpilot iOS SDK","href":"/developer/installation/mobile/ios/fonts"},{"title":"Userpilot SDK features","sidebarTitle":"Features","href":"/developer/installation/mobile/ios/features"},{"title":"Userpilot iOS SDK Release Notes","href":"/developer/installation/mobile/ios/mobile-ios-release-notes"}]},{"group":"Android","pages":[{"title":"Android SDK","sidebarTitle":"Installation","href":"/developer/installation/mobile/android/installation"},{"title":"Callbacks","href":"/developer/installation/mobile/android/callbacks"},{"title":"Push Notifications","href":"/developer/installation/mobile/android/push-notifications"},{"title":"Custom URL Scheme","href":"/developer/installation/mobile/android/custom_scheme"},{"title":"Auto Capture","href":"/developer/installation/mobile/android/auto-capture"},{"title":"Multi-Instance","href":"/developer/installation/mobile/android/multi-instance"},{"title":"Fonts","href":"/developer/installation/mobile/android/fonts"},{"title":"Userpilot SDK features","sidebarTitle":"Features","href":"/developer/installation/mobile/android/features"},{"title":"Userpilot Android SDK Release Notes","href":"/developer/installation/mobile/android/mobile-android-release-notes"}]},{"group":"Flutter","pages":[{"title":"Flutter Plugin","sidebarTitle":"Installation","href":"/developer/installation/mobile/flutter/installation"},{"title":"Updating to Swift Package Manager","sidebarTitle":"Updating to SPM","href":"/developer/installation/mobile/flutter/updating-to-spm"},{"title":"Callbacks","href":"/developer/installation/mobile/flutter/callbacks"},{"title":"Push Notifications","href":"/developer/installation/mobile/flutter/push-notifications"},{"title":"Custom URL Scheme","href":"/developer/installation/mobile/flutter/custom_scheme"},{"title":"Auto Capture","href":"/developer/installation/mobile/flutter/auto-capture"},{"title":"Fonts","href":"/developer/installation/mobile/flutter/fonts"},{"title":"Userpilot SDK features","sidebarTitle":"Features","href":"/developer/installation/mobile/flutter/features"},{"title":"Userpilot Flutter SDK Release Notes","href":"/developer/installation/mobile/flutter/mobile-flutter-release-notes"}]},{"group":"React Native","pages":[{"title":"React Native Module","sidebarTitle":"Installation","href":"/developer/installation/mobile/react-native/installation"},{"title":"Callbacks","href":"/developer/installation/mobile/react-native/callbacks"},{"title":"Push Notifications","href":"/developer/installation/mobile/react-native/push-notifications"},{"title":"Custom URL Scheme","href":"/developer/installation/mobile/react-native/custom_scheme"},{"title":"Auto Capture","href":"/developer/installation/mobile/react-native/auto-capture"},{"title":"Auto Screen Tracking With React Navigation","href":"/developer/installation/mobile/react-native/auto-track-screens"},{"title":"Fonts","href":"/developer/installation/mobile/react-native/fonts"},{"title":"Userpilot React Native with Expo","href":"/developer/installation/mobile/react-native/expo"},{"title":"Custom URL Scheme with Expo","sidebarTitle":"Expo Custom URL Scheme","href":"/developer/installation/mobile/react-native/expo_custom_scheme"},{"title":"Expo","href":"/developer/installation/mobile/mobile-expo-push-notification"},{"title":"Custom Fonts with Expo","href":"/developer/installation/mobile/react-native/expo_custom_fonts"},{"title":"Userpilot SDK features","sidebarTitle":"Features","href":"/developer/installation/mobile/react-native/features"},{"title":"Userpilot React Native SDK Release Notes","href":"/developer/installation/mobile/react-native/mobile-react-native-release-notes"}]},{"group":"Capacitor","pages":[{"title":"Ionic Capacitor plugin","sidebarTitle":"Installation","href":"/developer/installation/mobile/capacitor/installation"},{"title":"Updating to Swift Package Manager","sidebarTitle":"Updating to SPM","href":"/developer/installation/mobile/capacitor/updating-to-spm"},{"title":"Callbacks","href":"/developer/installation/mobile/capacitor/callbacks"},{"title":"Push Notifications","href":"/developer/installation/mobile/capacitor/push-notifications"},{"title":"Custom URL Scheme","href":"/developer/installation/mobile/capacitor/custom_scheme"},{"title":"Auto Capture","href":"/developer/installation/mobile/capacitor/auto-capture"},{"title":"Fonts","href":"/developer/installation/mobile/capacitor/fonts"},{"title":"Userpilot SDK features","sidebarTitle":"Features","href":"/developer/installation/mobile/capacitor/features"},{"title":"Userpilot Capacitor SDK Release Notes","href":"/developer/installation/mobile/capacitor/mobile-capacitor-release-notes"}]},{"group":"Cordova","pages":[{"title":"Cordova plugin","sidebarTitle":"Installation","href":"/developer/installation/mobile/cordova/installation"},{"title":"Callbacks","href":"/developer/installation/mobile/cordova/callbacks"},{"title":"Push Notifications","href":"/developer/installation/mobile/cordova/push-notifications"},{"title":"Custom URL Scheme","href":"/developer/installation/mobile/cordova/custom_scheme"},{"title":"Auto Capture","href":"/developer/installation/mobile/cordova/auto-capture"},{"title":"Userpilot SDK features","sidebarTitle":"Features","href":"/developer/installation/mobile/cordova/features"},{"title":"Userpilot Cordova SDK Release Notes","href":"/developer/installation/mobile/cordova/mobile-cordova-release-notes"}]},{"group":"MAUI","pages":[{"title":"MAUI SDK","sidebarTitle":"Installation","href":"/developer/installation/mobile/maui/installation"},{"title":"Callbacks","href":"/developer/installation/mobile/maui/callbacks"},{"title":"Push Notifications","href":"/developer/installation/mobile/maui/push-notifications"},{"title":"Custom URL Scheme","href":"/developer/installation/mobile/maui/custom_scheme"},{"title":"Auto Capture","href":"/developer/installation/mobile/maui/auto-capture"},{"title":"Userpilot SDK features","sidebarTitle":"Features","href":"/developer/installation/mobile/maui/features"},{"title":"Userpilot MAUI SDK Release Notes","href":"/developer/installation/mobile/maui/mobile-maui-release-notes"}]},{"group":"Segment","pages":[{"title":"Analytics iOS Userpilot","href":"/developer/mobile-segment/mobile-segment-ios"},{"title":"Analytics Kotlin Userpilot","href":"/developer/mobile-segment/mobile-segment-android"},{"title":"Analytics ReactNative Userpilot","href":"/developer/mobile-segment/mobile-segment-react-native"}]}]},{"title":"Production and Staging Evironments","sidebarTitle":"Production and Staging","href":"/developer/installation/production-staging"},{"title":"Self-hosting the SDK","href":"/developer/installation/self-host"},{"title":"Anonymous Users","href":"/developer/installation/anonymous-user"}]},{"group":"Security","icon":"lock","pages":[{"title":"Content Security Policy (CSP)","sidebarTitle":"Content Security Policy ","href":"/developer/security/csp"},{"title":"Subresource Integrity (SRI)","href":"/developer/security/sri"}]},{"group":"Data sync","icon":"users","pages":[{"title":"Data sync overview","sidebarTitle":"Overview","href":"/data-sync/overview"},{"title":"Prerequisites","sidebarTitle":"Prerequisites","href":"/data-sync/prerequisites"},{"title":"Understanding Your Data","sidebarTitle":"Understanding Your Data","href":"/data-sync/understand-data"},{"title":"Event Schema","sidebarTitle":"Event Schema","href":"/data-sync/event-schema"},{"title":"Setup and configuration","sidebarTitle":"Setup and configuration","href":"/data-sync/setup-and-configuration"},{"title":"Troubleshooting","sidebarTitle":"Troubleshooting","href":"/data-sync/troubleshooting"},{"title":"Frequently Asked Questions","sidebarTitle":"FAQ","href":"/data-sync/faq"}]},{"group":"Advanced","pages":[{"title":"JavaScript SDK","href":"/developer/installation/SDK-APIs"},{"title":"Identify vs Reload","href":"/developer/identify-vs-reload"},{"title":"Custom Domain Hosting","href":"/developer/custom-domain"}]}]},{"tab":"APIs","pages":[{"title":"APIs","href":"/api-references/overview"}]}]},"basePath":"","title":"Multi-Instance - Userpilot Knowledge Base","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":[],"chunks":[]}