Over the course of a couple years of developing in Xamarin, I've made a bunch of ContentViews (such as a custom Switch) as well as a few Effects with platform-specific implementations for a number of apps. I'd like to consolidate these into a single library that I can then use in other Xamarin projects. However, I haven't been able to find very clear documentation on how to accomplish this. Obviously, all the shared code can go into a single, or multiple, shared class libraries. But what about the platform-specific renderers or effect implementations? Do I put those in a separate library? Or do I keep them in the same one but make the inclusion of dependencies such as Xamarin.Forms.Android conditional depending on what platform(s) the library is being built for?
I've noticed that Xamarin.Forms seems to detect this automatically. The Xamarin.Forms NuGet added to an Android project seems to pick up the Android dependenceis, but not the iOS ones. How is this set up?
The easy solution is to just add everything to a single library, including all the dependencies, but that seems sloppy to me. Is there anyone else that has attempted to make a library of custom views, effects, etc with platform specific code?