Group 7 Handling Platform Differences
Group 7 Handling Platform Differences
Differences
(Android, iOS, Web)
By:
Jyrillen Segobre
Angel Ann Gonzaga
Mark Leonel De Isidro
Introduction
NET MAUI plays a crucial role in simplifying cross-
platform development by enabling developers to use a single
codebase to build native applications for Android, iOS,
Windows, macOS, and even the Web via Blazor Hybrid. It
bridges platform differences through a unified API, platform-
specific handlers, and extensibility options, ensuring that apps
not only look and feel native but also leverage unique platform
capabilities. By streamlining development and reducing
duplication, .NET MAUI significantly improves productivity,
consistency, and performance in multi-platform application
development.
.Net MAUI Supported
platforms:
Cuztomization:
• Developers can modify default handlers
to change behavior or appearance.
Example: Customize the corner radius of a
Button specifically for iOS.
Handling Platform-Specific Code
1. In .Net MAUI, we can use preprocessor directives like #if ANDROID, #if IOS, or #if
WINDOWS to include platform-specific code within a shared file.
Example:
2. Dependency Injection:
• Abstract platform-specific services behind shared interfaces.
• Example:
- File system operations differ for Android, Ios, and Web but are
abstracted through a shared interface IFileService.
Web Integration with Blazor Hybrid
What is Blazor Hybrid
• A feature that allows developers to embed Blazor (web-based) components within a
.NET MAUI app. It combines the strengths of native apps with the flexibility of web
development.
How it Works?
• Blazor components are written in C# and rendered as HTML/CSS within a WebView
control.
• These components can run within a native container in .NET MAUI, functioning
seamlessly across platforms like Android, iOS, Windows, and macOS.
Limitation
• No direct browser-based deployment from .NET MAUI (yet); relies on Blazor for web
functionality.
Styling and Theming Across Platforms
• Testing Tools:
Use NUnit, MSTest, or XUnit for shared logic.Platform-
specific tests for Android, iOS, or browser functionality.
• Cross-Platform Debugging:
Debug Android, iOS, and Web applications directly in
Visual Studio.
Thank You!