Is MAUI the End of Xamarin?

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hi there I'm James and today we're going to look at framework from Microsoft that looks set to replace xamarin and that's called Maui Maui is an acronym and it's short for multi-platform app UI and that name gives us some insight into the problem that Maui is trying to solve it was released by Microsoft in May 2022 and it allows developers to build native applications for multiple platforms using a single code base so you can write your code in c-sharp and then you can deploy it to different platforms including iOS Android Windows and Mac OS now if you're familiar with mobile development you might be thinking isn't this what xamarin does and you'd be right xamarin is another framework for Microsoft that allows developers to build native applications for multiple platforms using a single code base xamarin's been around since 2011 and it was acquired by Microsoft in 2016. xamarin.forms is a popular UI toolkit that allows developers to build a shared UI across IOS and Android and this was a game changer for many developers as they can now create apps faster and with fewer resources so what's the difference between Maui and xamarin well let me show you by creating a new Maui project in order to create a Maui project in Visual Studio you need to be using visual studio 2022 version 17.3 or greater so start by opening up your version of Visual Studio 2022 and upgrading it to the latest version so I'm going to do that here from the menu and then start the upgrade now this can take a while to download and to install all of the updates so I'll just speed up this section of video for you here all right next you have to make sure that you have the multi-platform app UI workload installed so to do that open up the visual studio installer and click modify on here then down here under dot net multi-platform app UI development click that and install that so I'm going to click this modify button and just wait for this to install great with all of that installed you can open up a new project and you'll notice here that we have the Maui project type so go ahead and create a project using this and I'm going to create the selecting.net6 not.net7 just because it's a long time support version of.net so step through the wizard and this is where we can see the first major difference between xamarin and Maui unlike xamarind that has separate projects in here for each of the Frameworks that you're targeting with your build a new Maui project just has this single unified project file in the solution Explorer here if we open up this Maui program.cs file you can see it this is fairly similar to what you'll get in xamarin or in any other.net program CS file so there's this build object being created and that lets us set up dependency injection and all of that other good stuff there next if we open up this mainpage.xaml file you can see this is how we Define the user interface in Maui so there's a scroll View and then there's a vertical stack layout in here and then there's an image and a label all defined in this file here Maui uses this XML syntax that should look familiar if you've been using xamarin forms um it's also similar to how WPF applications used to be created um they used to create user interfaces on windows so hopefully this won't be an enormous learning curve for you when it comes to piecing together user interfaces if we expand this item in solution Explorer you can see here that there's a Code behind file here that contains the code for this layout in this main page class here this XML and code file pairing is also not a million miles away from how Native Android apps are created in Android Studio in fact I've done a fair bit of native Android development in the past and this XML syntax with the c-sharp file backing it here this is actually fairly similar to the activity and Associated JavaScript class that you get when you build a native Android app Java is not that different to c-sharp either so if you're coming here directly from Android development then this should have a relatively shallow learning curve as well okay so the next thing to look at is this platforms folder here this is where you have platform specific configuration for all of the platforms that we'll be targeting with our code so under Android you can see that we've got this Android manifest file also under iOS we have the info.plist property list file Visual Studio actually provides this nice configuration window for the iOS settings which is also very handy when configuring the iOS build windows down here also has an app manifest and this is for deploying your app to the Microsoft store so you know when you keep seeing that little shopping basket thing in Windows and it lets you install some programs directly from there that is the Microsoft Windows App Store basically and you can distribute your app into that as well as providing like a download link and which is a more traditional way of installing it on Windows okay if you click the drop down next to this play button you can see all the options we have for debugging our program as well I can click play on Windows and when that opens up it will tell me that I need to enable development mode on Windows to run this in debug mode so you can follow the guide that's linked here to do that if you want I'm not going to do that now I'm actually going to look at some of the other options so if you open this back up again you can see that we've got Android emulator in here as an option now if you have an Android emulator installed on your machine then you'll be able to access it from Visual Studio here and you'll be able to run your app on the local emulator and you'll see that it opens up a development version of my application now one cool thing about my apps running in development like this is that they have hot reloading so you can change something in the layout here I'm just going to change something in the UI and when you change that and save it it will instantly update in the app running inside the emulator so that's pretty cool to have this hot reloading it makes development a lot quicker when you're building things with Maui so there you have it Maui is an exciting new framework that offers some compelling improvements over xamarin but is Maui the so-called xamarin killer well it's not quite that simple while Maui does have some advantages over xamarin it's not a direct replacement for xamarin in fact Microsoft has stated that they will continue to support xamarin for the foreseeable future furthermore Microsoft has provided a clear migration path for existing Sam Moon forms projects to transition over to Maui so that means that developers that are currently using xamarin can smoothly transition to Maui when they're ready to do so you don't need to do that today that's absolutely fine it's essential to consider that Maui is still relatively new and developers May face some challenges or lack of resources compared to the more mature xamarin ecosystem but as Maui continues to evolve it's likely to gain more traction it's likely to become a popular choice for cross-platform app development so that's it from this quick look at Maui don't forget to subscribe to my channel for more videos not just on C sharp and the.net ecosystem but also on more General programming tips Frameworks career advice for software developers that sort of thing my name is James Charlesworth and why not check out the other video up here and I will see you next time foreign [Music]
Info
Channel: Train To Code
Views: 7,169
Rating: undefined out of 5
Keywords: csharp, dotnet, dotnet maui tutorial
Id: iuqwVDyy14M
Channel Id: undefined
Length: 8min 21sec (501 seconds)
Published: Mon Apr 03 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.