Inversion of Control (IoC) with Xamarin.Forms

The Inversion of Control (IoC) principle is very a useful technique when writing cross-platform applications.

So why should we use it?

Sharing 100% of the code would be great, but it is not entirely possible; we still require some implementation from platform-specific features (for example different platform services, hardware, cameras). A way to tackle this problem is via an IoC container. Using the IoC principle, we use an abstraction for the functionality in our shared code and pass an implementation of the abstraction into our shared code. Our IoC containers handle the instantiation of an object's dependency tree. We can register objects to their inherited interfaces and allow containers to pass ...

Get Xamarin Blueprints now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.