I created a Xamarin.Forms project/library. The project/library contains pages, views, renderers and other shareable components.
I then created my main project that will reference the shared project. I added each project (shared, android, ios) as an existing solution project.
The problem is when I try to use ShareProject's custom renderer in my MainShareProject, the implementation in SharedProjectAndroid and SharedProjectiOS is not called. When I call ISomeService in MainShareProject via DependencyService it is null
Solution Structure:
Shared Project Structure (Purpose of SharedProject is to reuse it in other projects)
ShareProject (NET standard library)
custom renderer
ISomeService
SharedProjectAndroid (Reference ShareProject; Xamarin.Android library)
custom renderer implementation
ISomeServiceImpl
ShareProjectiOS (Reference ShareProject; Xamarin.iOS library)
custom renderer implementation
ISomeServiceImpl
Main Project Structure
MainShareProject (Reference ShareProject)
use custom renderer (calls custom renderer constructor in ShareProject but not its implementation
use ISomeService by DependencyService (returns null)
MainProjectAndroid (Reference ShareProject and ShareProjectAndroid)
MainProjectiOS (Reference ShareProject and ShareProjectAndroid)
var someService = DependencyService.Get<SharedProject.ISomeService>(); //returs null
Android
[assembly: Dependency(typeof(SharedProjectiAndroid.SomeService))]
{
public class UserPreference : ISomeService
}