Skip to main content

BBNativeRenderer

struct BBNativeRenderer: View

A SwiftUI wrapper for BBNativeRendererView (outstream/ad renderer).

Use this for /r/ (renderer) embed URLs that include an appConfig section. For /a/ (ad-unit) or /p/ (playout) URLs, use BBNativePlayer instead.

Minimal usage (fire-and-forget, auto-cleanup)

BBNativeRenderer(jsonUrl: "https://demo.bbvms.com/r/native_sdk_renderer.json")
.aspectRatio(16/9, contentMode: .fit)

Full control

struct RendererScreen: View {
@State private var rendererState = BBRendererState()

var body: some View {
BBNativeRenderer(
jsonUrl: "https://demo.bbvms.com/r/native_sdk_renderer.json",
state: rendererState
)
.aspectRatio(16/9, contentMode: .fit)
.onDisappear { rendererState.destroy() }
}
}

Important: When using the init(jsonUrl:options:state:) initializer, call BBRendererState/destroy() from .onDisappear to ensure timely cleanup. The convenience init(jsonUrl:options:) handles this automatically.