NuGet gold nuggets - packages which are in my almost every Xamarin project
While Xamarin delivers a nice set of controls and functionalities with Xamarin.Forms, there is always room for improvement. This is where NuGet packages come in!
Luckily there is a very active and alive community behind Xamarin which can provide you with all the necessary plugins. Underneath you will find a list of the ones I use in almost everyone of my projects in varying combinations.
If you have any recommendations which I have missed please let me know!
Xamarin.Plugins.Settings #
This plugin by James Montemagno provides corss platform (user) settings. It supports simple types (strings, integers, booleans, etc.) and is available for both shared projects and PCL projects. If using a PCL, you need to install the NuGet package on both your PCL project as well as the client projects.
Setup is super simple and is described on the homepage as well as a text file which comes with the NuGet.
Available for iOS, Android and Windows.
Xamarin.Plugins.Connectivity #
Another plugin by James (see above), basically anything he touches is something you want to have or take a look at so keep that in mind.
This plugin provides you with everything you need regarding network connectivity. You can check if you have a (internet) connection, ping a certain server and also it provides you with events if something in the network changes. If using a PCL, you need to install the NuGet package on both yourPCL project as well as the client projects.
Available for iOS, Android and Windows.
FreshMvvm #
Read more on how to use MVVM with FreshMvvm in my blogpost about this.
Lightweight, easy to use MVVM framework which perfectly complements the MVVM capabilities Xamarin.Forms already has. It supports ViewModel to ViewModel navigation, automatically wires BindingContext and page events, provides a simple IoC container with constructor injection, and more!
FreshMvvm has been created by Michael Ridland, a Xamarin consultant and MVP which is very open to suggestion.
Available for iOS, Android and Windows.
FreshEssentials #
Again by Michael, he also brings you the essentials NuGet package. This contains everything you’ve probably done by hand in most of your Xamarin.Forms apps. It provides you with a BindablePicker, InverseBooleanConverter and SegmentedButton for iOS amongst others. It will probably grow larger over time.
PropertyChanged.Fody #
Want to know how to use this plugin? Have a look at my blogpost about this.
INotifyPropertyChanged made easy! No longer implement that same interface in all of your classes and repeat the same steps over and over. With this package you can just add the propertychanged functionality with a class attribute! Also you can attribute your properties to get some more control over when the propertychanged gets fired. It will all be done for you at compile time!
This isn’t limited to Xamarin by the way, but comes in very handy!
FFImageLoading #
A library which helps you with easily scaling down images, caching them, applying transformations, etc.
Available for iOS, Android and Windows.
ACR.UserDialogs #
Based on popular libraries on Android, iOS and Windows this library provides you with an easy wat to show alerts, loading indicators, ActionSheets, messagebars and everything else you can come up with!
It is very easy to use, don’t forget to put the initialiser for your Android project!
Available for iOS, Android and UWP. Partial Windows 8/8.1 implementation which you can of course add yourself by a pull request.
Refit #
Read more on Refit and how to use it in my blogpost about it.
If you have already created some apps you’re probably used to calling REST API’s. Although all of them are different, the way you call them and interact with them is very similair, which makes you type out the same functionality multple times. No more! With this library your REST calling class is generated automagically!
Just define an interface with all the methods you need, attribute them with the endpoint names and HTTP verbs and you are ready to go!
Not just available for iOS, Android and Windows, but also Xamarin.Mac and .net 4.5 desktop apps! Awesome!
Polly #
Polly is a library which takes exception handling to a new level! You can easily retry for multiple times, wait a bit before you retry, defines policies and all of this in a fluent syntax! This comes in rather handy if you’re working with not always stable connections and you might want to retry a couple of times before handing the error to your user.
Also this one is available for all app platforms as well as on desktops.
There are probably a lot more I might of missed and/or don’t know of yet. Please let me know if you have any additions which I might include in a next post and make all of our lives a bit easier!
Missing a NuGet? #
Is there a package missing that I should know of? Please don’t hesitate to let me know!