Xamarin.iOS and Xamarin.Android have the same class functionality.
This class is implemented slightly differently depending on the characteristics of each device.
I would like to refer to these classes from PCL and generate an instance.
However,
because the above class cannot be found during implementation and compilation.
This will result in an error.
Use each PCL resource from Xamarin.iOS and Xamarin.Android resources
I can refer to it, but can't I do the opposite?
If you know, please let me know.
Here,
The answers in may be helpful.
However, this method is to "generate instances on Android or iOS, and use the common interface of the generated instances on the PCL side", so
I'm going to refer to these classes from PCL and generate an instance
It may not fit the purpose of .
(Strictly speaking, it is not possible to generate instances of classes on each platform side from the PCL side.)
Another method is called "Bait and Switch."
There are three assembly (DLL file name) classes with exactly the same name for reference from the PCL project, for reference from the Android project, and for reference from the iOS project.
For PCL projects, see 1. for Android projects and 3. for iOS projects.
Then, since the class implemented in 2. is used to run Android apps and 3. is used to run iOS apps, PCL seems to call each platform-specific implementation.
Please refer to the links below for more information on this technique.
© 2024 OneMinuteCode. All rights reserved.