What .NET MAUI Can Do for Frontend and Web Developers

Let’s say you have a great web application – it runs fine in the browser, but for some reason the customer wants an app that’s native to mobile or desktop.

Enter .NET MAUI, which stands for .NET Multiplatform App UI. It’s a cross-platform framework for building native mobile and desktop apps using C# and XAML.

Microsoft calls it the “next evolution of Microsoft’s Xamarin”. It shares much in common with Flutter, Google’s cross-platform, open-source UI software development kit that supports applications for Android, iOS, Linux, macOS, Windows, Google Fuchsia, and the web from a single codebase.

Microsoft states that .NET MAUI is intended for developers who want:

  • Write cross-platform apps in XAML and C# from a single shared code base in Visual Studio.
  • Share UI layout and design across platforms.
  • Share code, tests and business logic across platforms.

However, what is not mentioned is that .NET MAUI will allow frontend and web developers to turn their web apps into a near-metal mobile or desktop app that can run on Windows or Mac, explained Sam Basu , a senior developer attorney at Progress Software and host of the .NET Dev Show on Twitch. Linux is not yet supported by the .NET MAUI.

Progress has worked with .NET MAUI and Microsoft from “day zero,” Basu said, and has used .NET MAUI to build apps in the iOS and Android app stores. What Progress offers with .NET MAUI is a polished performance UI, so developers don’t have to hard-code the entire UI. His Telerik DevCraft includes libraries and tools for .NET MAUI.

Also Read :  India’s Punjab to embrace Web 3.0, unveils committee to explore its potential

“If your customers want to see the same experience on desktop or mobile, then this is an easy way out; and also for developers not to reinvent the wheel and come up with a whole new user interface and experience,” Basu told TNS at Progress Software’s Progress 360 developer conference last week.

A native app has a native UI, native performance to ensure speed, and native access to all device APIs, he said. For Apple products, being native means the app is in Swift or Objective C; for Android it means Java or Kotlin. On Windows, of course, that means .NET, he explained.

“It’s difficult for companies because now they have to maintain three different code bases for a single app,” he said. “So today, ideally, we’re looking for cross-platform solutions where I can have a single thing running anywhere.”

In addition to converting apps for Windows, .NET MAUI leverages Mac Catalyst for the ability to convert apps to iOS.

Bringing .NET and JavaScript worlds closer

.NET MAUI brings the worlds of .NET and JavaScript a little closer together, he added.

“It uses a little thing called a web view, which is essentially a browser component,” he said. “If you’ve invested in JavaScript or anything modern web that you’re doing with Angular, React or Vue, now they can all come and work on desktop and mobile too.”

While there are already single-page frameworks for converting web apps into mobile apps, these options don’t allow developers to tap into some of the native features of a mobile platform – like the camera or the accelerometer on your phone. Also, single-page framework apps aren’t always allowed in app stores, he added, which can limit the apps’ exposure.

Also Read :  How to block web fonts to improve privacy

“They’re not in the application stores and they don’t have access to all of the devices, things like camera, geolocation, accelerometer, all of our device APIs,” he said. “That’s something you get from .NET MAUI, pretty much free.”

With JavaScript, it’s still in a web shell, he added. .NET MAIU allows developers to take an Angular or React app and bundle it into a desktop or mobile app with a performance-optimized runtime because developers can choose what the application needs and only do that with the app bundle up.

“The runtime is really tailored to the application and the specific things of .NET it uses, so it just gives you what you need. So that’s how they keep it small,” Basu said.

By using .NET MAUI, the code bundles the essence of what is needed by the web app, but the code is paired to run faster. In comparison, Electron packs everything — HTML, CSS, JavaScript — all web assets into one shell with Node.js as the runtime, he explained. He pointed to Slack and other Electron apps, adding that Electron is battle-hardened but can also be tenacious.

“Electron gives you full access to things on the desktop that you might not need. An electron on mobile doesn’t work really well because it’s a big app pack. Electron is primarily for the desktop,” he said.

Also Read :  Top 10 Companies to Hire Mobile App Developers for Startups and Enterprises

With .NET MAUI, the conversion doesn’t leave the app dependent on Node.js, allowing it to create a more native experience in a smaller footprint.

“We can simply rely on .NET to bootstrap our app,” explains Basu. “Because we don’t support the browser component, because we don’t support the runtime, it’s just a little lighter and loads faster. As long as you have a browser on your device via mobile or desktop you should be good.”

How .NET MAUI differs from alternatives

Other options include using React Native and NativeScript, he added.

“These are platforms that allow developers to write web things and then eventually turn around and write a native mobile app,” he said. “It’s much, much easier for .NET developers.”

It also differs from Flutter in a few ways, as explained by Vince Giacoppo, technical project lead at developer recruitment agency Protovate. Giacoppo noted that .NET MAUI doesn’t support web, but “developers can use the Blazor framework to provide a bridge to using MAUI resources. “

It’s still early for .NET MAUI, Basu warned.

“We have companies and businesses that are taking it and looking at this as a way to write their next cross-platform app,” he said.

Disclosure: Progress Software paid Loraine Lawson to attend his Boston conference.

group Created with Sketch.

Source link