How can i fix error: Type 'YandexInter' does not conform to protocol 'UIViewControllerRepresentable'

I wrote the code. But i got error: Type 'YandexInter' does not conform to protocol 'UIViewControllerRepresentable'. How can i fix it? My code:

struct YandexInter : UIViewControllerRepresentable {
    
   func makeUIViewController(context: Context) -> YMAInterstitialAd
        {
            
            let adViewAdIn = YMAInterstitialAd(adUnitID: "R-M-2248734-1")
            
            adViewAdIn.delegate = context.coordinator

            adViewAdIn.load()

            return adViewAdIn
        }

        func updateUIViewController(_ uiView: YMAInterstitialAd, context: Context) {}

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

    class Coordinator: NSObject, YMAInterstitialAdDelegate
    {
        var interstitialYandexAd: YMAInterstitialAd!
        
        func loadInterstitial(){
                //self.interstitialYandexAd = YMAInterstitialAd(adUnitID: "R-M-2248734-1")
                //self.interstitialYandexAd?.load()
                self.interstitialYandexAd.delegate = self
            }
        
        func interstitialAdDidLoad(_ interstitialYandexAd: YMAInterstitialAd) {
      
            let scenes = UIApplication.shared.connectedScenes
            let windowScene = scenes.first as? UIWindowScene
            let window = windowScene?.windows.first
            let root = window?.rootViewController
          
            self.interstitialYandexAd.present(from: root!)
          
            print("Loaded Adv.")
              
        }
        
        func interstitialAdDidFail(toLoad interstitialYandexAd: YMAInterstitialAd, error: Error) {
            
            print("Loading failed. Error: \(error)")
        }
         
         func interstitialAdDidFail(toPresent interstitialAd: YMAInterstitialAd, error: Error) {
             print("Presenting failed. Error: \(error)")
             
         }

    }
}

That error means you haven't implemented all the required functions from the protocol. Is it possible you've missed out:

func sizeThatFits(ProposedViewSize, uiViewController: Self.UIViewControllerType, context: Self.Context) -> CGSize?

and

static func dismantleUIViewController(Self.UIViewControllerType, coordinator: Self.Coordinator)?

I'm guessing as I've not used this one before.

I've never used, so I'm guessing, but it seems control is never initialised.

I would change as follows:

Modify:

    func makeCoordinator() -> Coordinator {
        Coordinator(self)
    }

Add the init:

        var interstitialYandexAd: YMAInterstitialAd   // No Implicitely unwrapped optional IUO

        init(_ control: YMAInterstitialAd) {
            interstitialYandexAd = control
        }

Credit to https://stackoverflow.com/questions/61483839/swiftui-type-does-not-conform-to-protocol-uiviewrepresentable

How can i fix error: Type 'YandexInter' does not conform to protocol 'UIViewControllerRepresentable'
 
 
Q