Search code examples
swiftadmobbannerinterstitial

I need a list of AdMob Functions SWIFT


I've looked all over google's AdMob site, I just want a list of all the inbuilt functions I can use for banners and interstitials. eg. adViewDidReceiveAd() interstitialDidDismissScreen()

If anyone knows where I can find this, please let me know.


Solution

  • This is bannerView functions where you have to implement GADBannerViewDelegate to be able to use it (don't forget to set the delegate for your banner as myBanner.delegate = self so they will be called).

    func adViewDidReceiveAd(bannerView: GADBannerView!) {
    
    }
    func adViewDidDismissScreen(bannerView: GADBannerView!) {
    
    }
    func adViewWillDismissScreen(bannerView: GADBannerView!) {
    
    }
    func adViewWillPresentScreen(bannerView: GADBannerView!) {
    
    }
    func adViewWillLeaveApplication(bannerView: GADBannerView!) {
    
    }
    func adView(bannerView: GADBannerView!, didFailToReceiveAdWithError error: GADRequestError!) {
    
    }
    

    And for interstitial delegates you will need to implement GADInterstitialDelegate to able to use it.(don't forget to set the delegate for your interstitlal as interstitial.delegate = self so they will be called).

    func interstitialDidReceiveAd(ad: GADInterstitial!) {
    
    }
    func interstitialDidDismissScreen(ad: GADInterstitial!) {
    
    }
    func interstitialWillDismissScreen(ad: GADInterstitial!) {
    
    }
    func interstitialWillPresentScreen(ad: GADInterstitial!) {
    
    }
    func interstitialWillLeaveApplication(ad: GADInterstitial!) {
    
    }
    func interstitial(ad: GADInterstitial!, didFailToReceiveAdWithError error: GADRequestError!) {
    
    }
    

    Implement these after class declaration, ex: class test:GADInterstitialDelegate {}