From the course: Introduction to Xamarin.Forms

Unlock this course with a free trial

Join today to access over 22,400 courses taught by industry experts.

Implementing cross-platform abstractions

Implementing cross-platform abstractions - Xamarin Tutorial

From the course: Introduction to Xamarin.Forms

Implementing cross-platform abstractions

- [Instructor] Xamarin Forms has some really useful API's but it doesn't expose everything from the platform. In fact, it is very likely there will be some feature you need to use which is not available to your shared code. For these cases we have to put a little architecture thought into our application. We will want to use the APIs available in the platform specific project but somehow invoke them from our shared code. For example, consider dialing the phone. All three platForms have support for this feature but each one accomplishes it slightly differently and to fully control it we would want to write that code uniquely per platform. Let's take a look at what Xamarin Forms has to offer for situations such as this. First you'll want to create some form of abstraction. That might be an interface or a base class, but something to represent the feature you want to use in your shared code. Best Practice dictates that we build an abstraction implemented by the target platform which…

Contents