In this installment of the nine-part Mastering Xamarin.Forms Development series, learn how to leverage dependency services to include platform-specific functionality in your apps.
- [Instructor] By now you've seen and experienced how phenomenal the Xamarin Forms platform is for creating mobile applications that work across Android, iOS and Windows, including the reality that almost all of your code is shared across all these platforms. But the reality is every platform still exposes important and sometimes critical functionality that's not directly assessable in the high level platform APIs. This is where the concepts of dependency injection and dependency services really come to the rescue. The ability to create and expose features that are implemented differently for each platform but need to be accessed easily through a simple shared interface is one more area that the Xamarin Forms platform really shines.
I'm Scott J. Peterson and this is Mastering Xamarin Forms Development Dependency Services. So the concepts of dependency injection and dependency services aren't new or specific to Xamarin Forms. But Xamarin Forms really takes these concepts to the next level, making it extremely easy for developers to create apps that can do anything that a native app can do and still maintain the concept of shared code, either in a shared solution or in a PCL. The magic of Xamarin Forms creates a scenario where the service finds the correct implementation of the interface for each platform's specific project.
So like most of the sessions in this series, we're going to be spending most of our time in Visual Studio 2017 in code. Let's take a quick look at what we're going to cover in this session. First we're going to talk about some basic dependency service concepts to make sure we're all on the same page. Now we're going to talk about the four dependencies that are really required to implement a dependency service. The interface, the implementation, the registration and calling a dependency service. Now we're going to flip back over to Visual Studio in newsreader Paperboy app that we've been creating this series and actually create a simple dependency service and walk through all the working parts.
Now we're going to talk about some more in depth platform dependent concepts and some common scenarios for real world dependency services in mobile application development with Xamarin Forms. Now we're going to flip back over to Visual Studio and actually implement some of these platform dependent services in our newsreader Paperboy app. And then finally we're going to talk about a couple of advanced scenarios. Some scenarios that may leverage OS and platform specific services to a little bit of that greater degree than some of the more common scenarios and then flip back over to Visual Studio and actually walk through implementing an advanced scenario in our Xamarin Forms Paperboy app.
And as always we'll finish up with some great next steps.
- Dependency service concepts
- Implementation concepts
- Registration concepts
- Calling a dependency service
- Creating a dependency service
- Platform-dependent concepts
- Implementing platform-dependent services
- Advanced scenarios