The Blaze Sample provides practical examples of how to integrate WSC Sports' BlazeSDK into your iOS application. It includes multiple sample modules that demonstrate different aspects of the SDK, from basic widget implementation to advanced features like universal links, push notifications, and custom styling.
Download the project zip file or clone the repository using git:
git clone https://github.com/WSCSports/blaze-sample-ios-v2.git
cd blaze-sample-ios-v2The BlazeSDK requires an API key to function. You need to add your API key to the AppConfig.xcconfig file:
- Open the
BlazeSample/Core/AppConfig.xcconfigfile - Replace the
BLAZE_API_KEYvalue with your API key:
// BlazeSDK API Key
BLAZE_API_KEY = your_api_key_here
- Open
blaze-sample-ios-v2.xcodeprojin Xcode - Ensure the correct Development Team is selected and Bunde Id is confugurated
- Select a target device or simulator
- Connect an iOS device or start a simulator
- Click the "Build and Run" button (β+R)
The BlazeSDK is initialized through a dedicated BlazeSDKInteractor singleton class that manages the SDK lifecycle and configuration. Here's how the initialization is structured:
1. SwiftUI App initialization:
// In BlazeSampleApp.swift
import SwiftUI
@main
struct BlazeSampleApp: App {
// register app delegate for Firebase setup
@UIApplicationDelegateAdaptor(AppDelegate.self) var delegate
var body: some Scene {
WindowGroup {
AppNavigatorView(viewFactory: DefaultAppViewFactory())
}
}
init() {
BlazeSDKInteractor.shared.initBlazeSDK()
}
}2. BlazeSDKInteractor implementation:
// BlazeSDKInteractor.swift
import BlazeSDK
final class BlazeSDKInteractor {
static var shared: BlazeSDKInteractor = BlazeSDKInteractor()
private let blazeSdk = Blaze.shared
func initBlazeSDK() {
blazeSdk.initialize(
apiKey: ConfigManager.blazeApiKey,
cachingSize: ConfigManager.defaultCacheSize,
prefetchingPolicy: .Default,
geo: nil
) { [weak self] result in
self?.handleBlazeSdkInitalResult(for: result)
}
setupBlazeGlobalDelegate()
}
private func handleBlazeSdkInitalResult(for result: BlazeResult) {
switch result {
case .success:
Logger.shared.log("SDK initialized successfully!")
case .failure(let error):
Logger.shared.log("Error message in blaze sdk: \(error.errorMessage)", level: .error)
}
}
}3. Configuration management:
// ConfigManager.swift
enum ConfigManager {
static var blazeApiKey: String {
getValue(for: "BLAZE_API_KEY")
}
static var defaultCacheSize: Int {
Int(getValue(for: "BLAZE_CACHE_SIZE")) ?? 500
}
private static func getValue(for key: String) -> String {
guard let value = Bundle.main.infoDictionary?[key] as? String else {
fatalError("Missing config value for key: \(key)")
}
return value
}
}This architecture provides:
- Centralized configuration: All SDK settings are managed through xcconfig files
- Error handling: Proper initialization result handling with logging
- Singleton pattern: Single point of SDK interaction throughout the app
- Delegate management: Automatic setup of global SDK delegates
- Firebase integration: Uses UIApplicationDelegateAdaptor for Firebase setup
- Lazy initialization: SDK is initialized when the main view appears, ensuring proper app lifecycle
BlazeSDK can be integrated using multiple approaches:
| Integration Type | Instructions |
|---|---|
| Swift Package Manager | Instructions |
| CocoaPods | Instructions |
| XCFrameworks | Instructions |
What it demonstrates:
- Implementation of various widget types (Stories, Moments, Videos)
- Row and Grid layout options
- Live video filtering (Videos widget filtered to live/upcoming/ended stream content)
- Mixed widgets (multiple widgets on the same screen)
- Runtime editing capabilities:
- Data source editing (label names, order types)
- Layout style customization
- Real-time UI updates
Key Features:
- Custom appearance settings
- Status indicators, including per-stream-state (live/upcoming/ended) styling
- Badge management
- Item style overrides
What it demonstrates:
- Universal links handling
- Push notification integration
- Direct content playback (stories, moments, videos)
- Firebase Cloud Messaging integration
Key Features:
- Universal link simulation
- Play content by label expression
- Play single items by ID
What it demonstrates:
- SwiftUI integration with BlazeSDK
- Modern UI implementation patterns
- Declarative UI approach for Blaze widgets
What it demonstrates:
- Advertisement integration within Blaze content
- Ad placement and management
Key Features:
- Google Ad Manager integration for custom native and banner ads (GAM)
- Interactive Media Ads integration (IMA)
What it demonstrates:
- Custom search screen built with BlazeSDK, matching the layout and behavior of the SDK's built-in search screen
- Coordinating three widget types (Stories, Moments, Videos) from a single
BlazeDataSourceType.search(searchText:)data source - Unified load-state aggregation via a shared
BlazeWidgetDelegate - Suggestions grid shown while the search field is empty
Key Features:
UIStatemachine (empty / loading / content / noResults / error)- Animated section transitions
- Both push and modal navigation modes
BlazeMomentsWidgetGridViewsuggestions grid with 3-column layout
What it demonstrates:
- Custom player appearance
- Style overrides and theming
- Player behavior customization
What it demonstrates:
- Moments container implementation
- Container-specific features and customization
What it demonstrates:
- SDK-wide configuration options
- Global behavior settings
- Centralized customization
The project uses the AppConfig.xcconfig file for SDK parameter configuration:
// BlazeSDK API Key
BLAZE_API_KEY = your_api_key
// Labels for different widgets
BLAZE_STORIES_ROW_LABEL = stories-main
BLAZE_STORIES_GRID_LABEL = stories-main
BLAZE_MOMENTS_ROW_LABEL = moments-main
BLAZE_MOMENTS_GRID_LABEL = moments-main
BLAZE_VIDEOS_ROW_LABEL = video-long-form
BLAZE_VIDEOS_GRID_LABEL = video-long-form
BLAZE_VIDEOS_LIVE_ROW_LABEL = match
// Ad settings
BLAZE_AD_UNIT = /123456789/CustomNativeUnitTest
BLAZE_TEMPLATE_ID = 123456
// Cache settings
BLAZE_CACHE_SIZE = 500
-
API Key Not Working:
- Verify the API key is correctly added to
AppConfig.xcconfig - Ensure the key format matches:
BLAZE_API_KEY = your_key - Check that the key is valid and not expired
- Verify the API key is correctly added to
-
Build Errors:
- Ensure iOS SDK is updated to the latest version
- Clean the project (β+Shift+K) and rebuild
- Check internet connection for dependency downloads
-
Runtime Errors:
- Verify the BlazeSDK is properly initialized
- Check Xcode console for specific error messages
- Ensure minimum SDK requirements are met
- Check individual sample README files for module-specific guidance
- Review the BlazeSDK documentation
- Contact WSC Sports support for API key issues
- iOS 15.0 or higher
- Xcode 13.0 or higher
- Swift 5.5 or higher
This project is licensed under the terms specified in the LICENSE file.
Note: Each sample module contains its own detailed README with specific implementation details and usage instructions. Navigate to the respective sample directories for more information.