A THEOplayer hosted in SwiftUI via a small UIViewRepresentable, with the
FastPix THEOplayer SDK (THEOplayerWrapper) attached for playback analytics.
open FastPixTHEOSwiftUIExample.xcodeprojPick a Simulator (or your device), press ▶ Run, tap a sample stream, then
open dashboard.fastpix.com → your workspace to
watch views appear. The project references the SDK as a local Swift package at
../.., so it builds against this checkout. First open resolves THEOplayer's
binary framework over the network — let it finish.
static let workspaceKey = "1029207880411545601" // dashboard.fastpix.com → Workspaces
static let theoLicense = "YOUR_THEOPLAYER_LICENSE" // portal.theoplayer.com → SDKs → iOStheoLicenseis required for playback. THEOplayer licenses are bound to a bundle id — create one forcom.fastpix.datasdk.theo.swiftui(or change the bundle id to match your license). With the placeholder in place the app runs but shows a red "Add your THEOplayer license to play" badge and the player stays black.workspaceKeyselects the FastPix workspace analytics are sent to.
| File | Role |
|---|---|
PlayerView.swift |
Owns the THEOplayer + tracker in an ObservableObject (@StateObject); attaches in .onAppear, tears down in .onDisappear. A UIViewRepresentable hosts THEOplayer's UIKit view. |
HomeView.swift |
Landing list of sample streams. |
Config.swift |
Workspace key, THEOplayer license, and sample streams. |
App.swift |
App entry point. |
THEOplayer is a UIKit view (
addAsSubview(of:)), so SwiftUI wraps it in aUIViewRepresentable. The player and tracker live in anObservableObject, not the View struct — SwiftUI recreates View structs on every render, which would churn the player.