Getting Started
The BB Channel SwiftUI SDK embeds Blue Billywig video channels in SwiftUI apps with native video playback, Chromecast support, and full navigation (swim lanes, grids, carousels, search, detail pages).
Compatibility
| Requirement | Minimum Version |
|---|---|
| iOS | 16+ |
| Xcode | 15+ |
| Swift | 5.9+ |
Package Access
BBChannelSwiftUI is distributed as a pre-built XCFramework from a private GitHub repository. Contact Blue Billywig to receive access.
To authenticate SPM with a private repo, add your GitHub credentials to ~/.netrc:
machine github.com
login YOUR_GITHUB_USERNAME
password YOUR_GITHUB_PAT
The PAT needs repo scope (read access to private repos).
For CI/CD, set the PAT as a secret and write ~/.netrc in a setup step.
Installation
Add the package via Swift Package Manager:
- In Xcode, go to File > Add Package Dependencies...
- Enter the repository URL:
https://github.com/bluebillywig/channel-sdks - Select Up to Next Major Version and enter the version
- Add
BBChannelSwiftUIto your target
Or add it to your Package.swift:
dependencies: [
.package(url: "https://github.com/bluebillywig/channel-sdks", from: "1.0.0"),
],
targets: [
.target(
name: "YourApp",
dependencies: [
.product(name: "BBChannelSwiftUI", package: "channel-sdks"),
]
),
]
Quick Start
import SwiftUI
import BBChannelSwiftUI
import BBNativePlayerKit_SwiftUI
struct ContentView: View {
@StateObject private var viewModel = BBChannelWithPlayerViewModel()
var body: some View {
BBChannelWithPlayerView(
channelUrl: "https://demo.bbvms.com/ch/1152.json",
viewModel: viewModel,
callbacks: BBChannelCallbacks(
onReady: {
print("Channel loaded")
}
)
)
}
}
BBChannelWithPlayerView renders the channel with a native video player using the Blue Billywig iOS native player, providing hardware-accelerated playback, Chromecast support, and a modal fullscreen player. See Native Player Integration for configuration details including Info.plist setup.
Channel URL
Channel URLs follow this format:
https://{publication}.bbvms.com/ch/{channelId}.json
Where {publication} is your Blue Billywig publication name and {channelId} is the numeric channel ID.
Configuration Options
Pass a BBChannelOptions struct to customize behavior:
let options = BBChannelOptions(
autoPlay: false,
searchBar: true,
noStats: false,
playout: "default",
jwt: "eyJ..."
)
BBChannelView(
channelUrl: "https://demo.bbvms.com/ch/1152.json",
options: options,
viewModel: viewModel,
callbacks: callbacks
)
| Property | Type | Description |
|---|---|---|
autoPlay | Bool? | Auto-play the first video. Default: true. |
searchBar | Bool? | Show the search bar. Default: from channel config. |
noStats | Bool? | Disable analytics/statistics. Default: false. |
playout | String? | Override the playout used for players. |
jwt | String? | JWT for content protection. |
rpcToken | String? | RPC token (legacy, prefer jwt). |
nativePlayerMode | Bool? | Enable native video playback via BBNativePlayerKit. Default: true. |
Events
Handle events via BBChannelCallbacks:
let callbacks = BBChannelCallbacks(
onReady: {
print("Channel is ready")
},
onMediaPlay: { media in
print("Playing: \(media.clipId)")
},
onNavigate: { event in
print("Page: \(event.pageType), can go back: \(event.canGoBack)")
},
onError: { error in
print("Error [\(error.code)]: \(error.message)")
}
)
Navigation
Use the view model to control navigation:
// Navigate to a detail page
viewModel.navigateTo(page: "detail", clipId: "4701337")
// Go back
viewModel.goBack()
// Search
viewModel.search("keyword")
// Check if back navigation is available
if viewModel.canGoBack {
viewModel.goBack()
}
Deep Linking
Open the channel at a specific page by passing initialNavigationState:
BBChannelView(
channelUrl: "https://demo.bbvms.com/ch/1152.json",
initialNavigationState: BBNavigationState(
page: "detail",
clipId: "4701337"
),
viewModel: viewModel,
callbacks: callbacks
)
Supported pages: main, detail (requires clipId), overview (requires clipListId), search (requires query).
Authentication
For content protected with Blue Billywig Content Protection, pass a JWT in options or update it at runtime:
// Via options
let options = BBChannelOptions(jwt: "eyJ...")
// At runtime
viewModel.setJwt("eyJ...")
What's Next
- Native Player Integration — set up native video playback with BBNativePlayerKit
- API Reference — complete type and method reference