Implementing platform-specific code
In the realm of .NET MAUI application development, there are numerous instances where we might need to write platform-specific code. In this section, we will examine the guidelines for implementing such code. Following that, we will explore the two most common scenarios that necessitate writing platform-specific code in this chapter. The first scenario involves accessing platform features that are not readily available in .NET MAUI APIs. The second scenario may require creating custom controls or customizing existing controls.
Before delving into how to access platform APIs, it’s important to distinguish between the terms .NET MAUI API and platform API. In Chapter 1, Getting Started with .NET MAUI, we have the following architecture diagram of a .NET MAUI application (Figure 7.1).
Figure 7.1: .NET MAUI architecture
Since most of the components in the architectural diagram are open-source, I’ve numbered the components...