Search code examples
iosswiftbannermopub

How to use mopub banner in swiftui


I was wondering if anyone knew how to use mopub in swiftui. I have been trying and I'm wondering if anyone knows how to use a banner ad with Mopub in swiftui. Thanks.


Solution

  • Since MoPub does not provide SwiftUI specific UI right now (they have stated that they have no plans supporting it), you need to use UIViewRepresentable classes for representing UIKit views in SwiftUI.

    If you want to give it a try yourself, start from here.

    Also there are great examples out there that you can check for MoPub:

    For example this or this.