Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
lawrence_shaun_introducing_net_maui_build_and_deploy_crosspl.pdf
Скачиваний:
36
Добавлен:
26.06.2023
Размер:
5.15 Mб
Скачать

Chapter 1 Introduction to .NET MAUI

when the common API provided by .NET MAUI may be limited down to the least amount of crossover between each platform and doesn’t provide everything we need. It is worth noting that your application will render differently on each platform as it utilizes the platform specific controls and therefore their look and feel.

Other frameworks such as Flutter opt to render their own types directly rather than mapping across to the implementations provided by each platform. These frameworks provide a common look and feel across each platform. This is a hotly contested topic but I personally believe that making applications fit in with the platform they are running on is a big benefit.

Why Use .NET MAUI?

There are several reasons why you should consider using .NET MAUI for your next application: a large number of supported platforms, increased code sharing capabilities, an emphasis on allowing developers to build applications that fit their style, great performance, and many more. Let’s take a look at them.

Supported Platforms

.NET MAUI provides official support for all of the following platforms:

•\

Android 5.0 (API level 21) and above

•\

iOS 11.0 and above

•\

macOS 10.15 and above (using Mac Catalyst) **

•\

Windows desktop

** MacCatalyst allows native Mac apps to be built and share code with iPad apps. This is an Apple technology that allows developers to shared code between Mac and iPad. For further reference, go to the Apple documentation at https://developer.apple.com/mac-catalyst/.

8

Chapter 1 Introduction to .NET MAUI

.NET MAUI provides community-driven support for

•\ Tizen: The implementation is provided by Samsung.

I thoroughly recommend checking out the documented list of supported platforms in case it has changed since the time of writing. The list can be found at https://learn.microsoft.com/dotnet/maui/supported-platforms.

Code Sharing

A fundamental goal of all cross-platform frameworks is to enable developers to focus on achieving their main goals by reducing the effort required to support multiple platforms. This is achieved by sharing common code across all platforms. Where I believe .NET MAUI excels over alternative frameworks is in the first four characters of its name; Microsoft has pushed hard to produce a single .NET that can run anywhere.

Being a full stack developer myself, I typically need to work on web-­ based back ends as well as mobile applications, .NET allows me to write code that can be compiled into a single library. This library can then be shared between the web and client applications, further increasing the code sharing possibilities and ultimately reducing the maintenance effort.

I have given talks based on a mobile game (www.superwordsearch. com) I built using Xamarin.Forms, where I boasted that we were able to write 96% of our code in our shared project. I have not yet converted this across to .NET MAUI; however, initial investigations show that this number will only increase.

There are further possibilities for sharing code between web and client, such as the use of .NET MAUI Blazor, which provides the use of web-based technologies inside a .NET MAUI application. While I won’t be covering

.NET MAUI Blazor in detail in this book, Microsoft does provide some really great documentation and guides on what it is and how to build your first application with the technology at ­https://learn.microsoft.com/ aspnet/core/blazor/hybrid/tutorials/maui.

9