Forum Xamarin Xamarin.iOS

Question on preferred DI and IOC pattern

JohnHJohnH GBMember ✭✭✭✭✭

Hi guys,
I have a question on how to structure my code for a TDD multi platform project. My specific question is where I need to write common helpers that dont fit into a PCL (invalid namespaces) so writing them in shared projects. This is an issue when the interface and concrete class are defined in the shared project, as soon as I reference the shared project from a PCL wont build due to the way shared projects work. Also, shared projects cannot reference other projects so cannot define the interface outside of the shared project.
I could define the concrete class in the shared project, define the interface in a PCL, then inherit from the concrete class in both my .iOS and .Droid projects thus implementing the interface and register for DI. Just seems like a long way round.

What do others do?


Sign In or Register to comment.