Code Snippet: Convert Xamarin.Forms ImageSource to Native Image
I'll share with you one code snippet that I like to use when I create some custom controls for Xamarin.Forms.
As big fan of the native experiences Im always trying to take advantage of the current types that Xamarin.Forms have allowing devs to use the extended controls and new components with the common types used on the framework, but sometimes Xamarin have some hidden implementations that are either private or internal like the way of getting a native image from an ImageSource type as you can see here(iOS):
So for this kind of cases we can find a good solution to still use the Xamarin.Forms types and implement on your side, I'll share a piece of code that can be used on either Shared & Multi-target projects and with a single line of code you'll be able to get a native representation of an ImageSource type:
As you can see is very simple to achieve it and with this you can implement good things like this one that I created as an example: