I'm developing a Xamarin library that contains Core (.NET Standard 2.0), Android and iOS libraries to display a custom page.
So there is a CustomPage class in the core and a page renderer on each mobile OS for this page. So far no problems.
Now I wanted to use this libraries in a Xamarin Forms application. I'm referencing the library projects in the Xam Forms solution and add a reference on each platform to the target library.
While I tested this on Android everything worked fine. On iOS there is a linker problem which strips my library out as part of the iOS linker optimization. (There is no direct reference to any code in the iOS library. Only the page renderer is used with an indirect access over the "Assembly: ExportRenderer(..)" attribute).
Only when I access any direct code from the iOS library then the iOS library is linked too.
I've tried to add the "[Assembly: Preserve]" to the AssemblyInfo.cs in the iOS library but this does not help.
Any solution here that doesn't need direct code references?