SwiftUI
Integrating Banner Ads using SwiftUI
import bidapp
struct ExampleSwiftUIWrapper: UIViewRepresentable
{
func makeUIView(context: Context) -> MAAdView
{
let adView = BIDBannerView.banner(
with: BIDAdFormat.banner_320x50 as! BIDAdFormat,
delegate: bannerDelegate
)
adView.delegate = context.coordinator
// Set background or background color for banners to be fully functional
adView.backgroundColor = BACKGROUND_COLOR
return adView
}
func updateUIView(_ uiView: MAAdView, context: Context) {}
func makeCoordinator() -> Coordinator
{
Coordinator()
}
}Last updated