title: SwiftUI Google Interstitial admob + Webkit
body: <p>So I am trying to get Interstitial ads working within my app, and I seem to be hitting a dead wall - well the error I get is that I don't have the webkit entitlement, and I can't find how to add it to my app.</p>
  <pre><code>import GoogleMobileAds
  import SwiftUI
  import UIKit
  import WebKit
  
  class InterstitialAd: NSObject {
      var interstitialAd: GADInterstitialAd?
      
      static let shared = InterstitialAd()
      
      func loadAd(withAdUnitId id: String) {
          let req = GADRequest()
          
          GADInterstitialAd.load(withAdUnitID: id, request: req) { interstitialAd, err in
              if let err = err {
                  print(&quot;Failed to load ad with error: \(err.localizedDescription)&quot;)
                  return
              }
              
              self.interstitialAd = interstitialAd
          }
      }
  }
  
  final class InterstitialAdView: NSObject, UIViewControllerRepresentable, GADFullScreenContentDelegate {
      
      let interstitialAd = InterstitialAd.shared.interstitialAd
      @Binding var isPresented: Bool
      var adUnitId: String
      
      init(isPresented: Binding&lt;Bool&gt;, adUnitId: String) {
          self._isPresented = isPresented
          self.adUnitId = adUnitId
          super.init()
          
          interstitialAd?.fullScreenContentDelegate = self
      }
      
      func makeUIViewController(context: Context) -&gt; UIViewController {
          let view = UIViewController()
          
          DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1)) {
              self.showAd(from: view)
          }
          
          return view
      }
  
      func updateUIViewController(_ uiViewController: UIViewController, context: Context) {
          
      }
      
      func showAd(from root: UIViewController) {
          
          if let ad = interstitialAd {
              ad.present(fromRootViewController: root)
          } else {
              print(&quot;Ad not ready&quot;)
              self.isPresented.toggle()
          }
      }
      
      func adDidDismissFullScreenContent(_ ad: GADFullScreenPresentingAd) {
          InterstitialAd.shared.loadAd(withAdUnitId: adUnitId)
          
          isPresented.toggle()
      }
  }
  
  </code></pre>
  <p>however when I add the following into a SwiftUI.View I get no ad showing</p>
  <pre><code>struct MediaPlayerView: SwiftUI.View {
      
      private var fullScreenAd: InterstitialAd?
          init() {
              fullScreenAd = InterstitialAd()
      
          }
      
  </code></pre>
  <p>then</p>
  <pre><code>.onAppear{
                  
                  //RUN AD
                  
                  self.fullScreenAd?.loadAd(withAdUnitId: &quot;ca-app-pub-XXXXXXXXXX/XXXXX&quot;)
                } 
  </code></pre>
  <p>I don't see how I am calling the view - because this clearly is not calling the right function.</p>
  <p>sometimes I am getting the following error
  <code>com.apple.runningboard.assertions.webkit</code>
  But I have no idea how to add that to my entitlements</p>