Skip to Content
Swift SDKGuidesZero-Config SDK

Zero-Config SDK

One line to initialize Vio. No config files, no duplicate API keys, no flags. The backend delivers everything at runtime.

import VioCore VioSDK.configure(apiKey: "your-api-key")

Available since v0.2.0-beta.


Integration

App startup

import VioCore @main struct MyApp: App { init() { VioSDK.configure(apiKey: "your-api-key") } var body: some Scene { WindowGroup { ContentView() } } }

When user opens a stream

struct PlayerView: View { let contentId: String var body: some View { VideoPlayer(...) .task { await VioSDK.setContent(id: contentId) } .onDisappear { VioSDK.disconnect() } .overlay { VioEngagementOverlay() } } }

That’s the full integration. No JSON file, no additional configuration.


What the SDK fetches at startup

On VioSDK.configure(apiKey:), the SDK calls GET /v1/sdk/config?apiKey=<apiKey> once and caches the response:

{ "webSocketBaseURL": "wss://api.vio.live", "restAPIBaseURL": "https://api.vio.live", "theme": { "primaryColor": "#F5153B" }, "commerceApiKey": "...", "featureFlags": { "lineup": true, "payments": true, "polls": true }, "localization": { "defaultLanguage": "no" }, "availableMarkets": ["NO", "SE", "DK"] }

All runtime configuration — theme, market availability, feature flags, commerce credentials — is delivered by the backend. No app update is needed to change any of these.


Eliminated in v0.2.0-beta

Before v0.2.0-betav0.2.0-beta+
vio-config.json in bundle✅ Removed
campaignApiKey (duplicate of apiKey)✅ Removed
autoDiscover: true flag✅ Always on
ConfigurationLoader.loadConfiguration()✅ Replaced by VioSDK.configure()
setBroadcastContext(BroadcastContext(...))✅ Simplified to VioSDK.setContent(id:)

Migrating from v0.1.x

Three changes, everything else is identical:

1. Remove vio-config.json from Copy Bundle Resources.

2. Replace initialization:

// Before ConfigurationLoader.loadConfiguration(userCountryCode: "NO") // After VioSDK.configure(apiKey: "your-api-key")

3. Replace broadcast context:

// Before await CampaignManager.shared.setBroadcastContext( BroadcastContext(broadcastId: contentId) ) // After await VioSDK.setContent(id: contentId)

Components, engagement flow, WebSocket, and all UI remain unchanged.


Next Steps

Last updated on