Question: I have a ad banner integrate in swiftUI with UIViewControllerRepresentable but i doesn't know to add event like adViewDidReceiveAd(). I have learn on <https://developer.apple.com/tutorials/swiftui/interfacing-with-uikit> but the event adViewDidReceiveAd never start

```
   struct GADBannerViewController: UIViewControllerRepresentable {

func makeCoordinator() -> GADBannerViewController.Coordinator {
    GADBannerViewController.Coordinator()
   }

func makeUIViewController(context: Context) -> UIViewController {
    let view = GADBannerView(adSize: kGADAdSizeBanner)
    let viewController = UIViewController()
    view.adUnitID = "ca-app-pub-3940256099942544/2934735716"
    view.rootViewController = viewController
    viewController.view.addSubview(view)
    viewController.view.frame = CGRect(origin: .zero, size: kGADAdSizeBanner.size)
    view.load(GADRequest())
    return viewController
}

func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}

class Coordinator: NSObject, GADBannerViewDelegate {
   func  adViewDidReceiveAd(_ bannerView: GADBannerView){
    print("AAAAAAAAA")
    }

   func adView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: GADRequestError) {
            print(error)
        }

}

}

```

Answer: 
```
import SwiftUI
import UIKit
import GoogleMobileAds    

final class GADBannerViewController: UIViewControllerRepresentable  {

    func makeUIViewController(context: Context) -> UIViewController {
        let view = GADBannerView(adSize: kGADAdSizeBanner)
        let viewController = UIViewController()
        view.adUnitID = "ca-app-pub-3940256099942544/2934735713"
        view.rootViewController = viewController
        view.delegate = viewController
        viewController.view.addSubview(view)
        viewController.view.frame = CGRect(origin: .zero, size: kGADAdSizeBanner.size)
        view.load(GADRequest())
        return viewController
    }
    func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}
}

extension UIViewController: GADBannerViewDelegate {
    public func adViewDidReceiveAd(_ bannerView: GADBannerView) {
        print("ok ad")
    }

    public func adView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: GADRequestError) {
       print("fail ad")
       print(error)
    }
}

```
I find the solution, I post here for others : 

```
import SwiftUI
import UIKit
import GoogleMobileAds

final class GADBannerViewController: UIViewControllerRepresentable  {

    func makeUIViewController(context: Context) -> UIViewController {
        let view = GADBannerView(adSize: kGADAdSizeBanner)

        let viewController = UIViewController()
        view.adUnitID = "ca-app-pub-3940256099942544/2934735713"
        view.rootViewController = viewController
        view.delegate = viewController
        viewController.view.addSubview(view)
        viewController.view.frame = CGRect(origin: .zero, size: kGADAdSizeBanner.size)
        view.load(GADRequest())

        return viewController
    }

    func updateUIViewController(_ uiViewController: UIViewController, context: Context) {}

}

extension UIViewController: GADBannerViewDelegate {
    public func adViewDidReceiveAd(_ bannerView: GADBannerView) {
        print("ok ad")
    }

    public func adView(_ bannerView: GADBannerView, didFailToReceiveAdWithError error: GADRequestError) {
        print("fail ad")
        print(error)
    }
}

```