'How can I add code for iOS native only and call it when necessary in xamarin app?

I am creating a demo project with xamarin and in that, I want to make a function which I can put in iOS native side and use that particular function when I needed and get a callback from the function from iOS native. I have checked but did not find any sufficient thing which can work with me. I want to call the below code for iOS only and need its response back to xamarin code.

 UIApplication.shared.open(redirectUrl, options: [:], completionHandler: { success in
    if success {
        // Handle success.
    } else {
        // Handle failure. Most likely app is not present on the user's device. You can redirect to App Store using these links:
       
    }
})

I am open to anything which can fix my issue for calling this function. If I can call it in xamarin then also please provide me suggestion so that I can put it in xamarin file.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source