DEV Community

loading...
Cover image for .Net core host builder for Xamarin? Yes please!

.Net core host builder for Xamarin? Yes please!

atleastitry profile image Matt Hope Originally published at matt-h.dev Updated on ・1 min read

This year I decided to embark on the journey of developing a .Net Core style host builder for Xamarin. I had previously seen examples using the HostBuilder provided by the .Net Core framework. While this approach was perfectly fine and works as intended, I found myself wanting something a little more integrated with Xamarin. Enter Hostly, a framework that provides end-users with a custom Ihost tailored to Xamarin.Forms. It's as simple as running a few lines of code in your entry class (FormsAppCompatActivity in Android, or FormsApplicationDelegate in iOS):

new XamarinHostBuilder().UseApplication<App>()
.UsePlatform(this)
.Build()
.StartAsync();

Using Hostly opens up access to a rich set of useful features when developing a Xamarin app. A few of those being:

  • Navigation Middleware
  • Lifecycle Middleware (In progress)
  • Dependency Injection
  • EF.Core
  • Hosted services

Try it out for yourself here

Discussion (0)

pic
Editor guide