Extend .NET MAUI application with iOS Extensions

Extend .NET MAUI application with iOS Extensions

09 August 2022

.NET MAUI/Xamarin

Buy Me A Coffee

Hello!

Today, we will create a small .NET MAUI application and extend it with iOS Share App Extension.

App extensions let you extend custom functionality and content beyond your app and make it available to users while they’re interacting with other apps or the system.

I hope you already have a valid environment. Read this article on how to set up .NET MAUI.

If you prefer a video tutorial you can find it on YouTube:

Extend .NET MAUI application with iOS Extensions

So let's start!

  1. Create a new .NET MAUI project.
  2. Create a new Xamarin iOS Application.
  3. Create a new App Extension and select your Xamarin iOS app from step 2. Create iOS Extension
  4. Open App Extension csproj file and replace the content:
<Project Sdk="Microsoft.NET.Sdk">
    <PropertyGroup>
        <TargetFrameworks>net6.0-ios</TargetFrameworks>
        <OutputType>Library</OutputType>
        <ApplicationId>YOUR-APPLICATION-ID-FROM-INFO.PLIST</ApplicationId>
        <ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
        <ApplicationVersion>1</ApplicationVersion>
    </PropertyGroup>

    <PropertyGroup>
        <IsAppExtension>true</IsAppExtension>
        <IsWatchExtension>false</IsWatchExtension>
    </PropertyGroup>
</Project>
  1. Open the .NET MAUI Application csproj file and add a reference to App Extension:
<ProjectReference Include="PATH-TO-EXTENSION.csproj">
	<IsAppExtension>true</IsAppExtension>
	<IsWatchApp>false</IsWatchApp>
</ProjectReference>
  1. (Optional) Now Xamarin iOS Application can be deleted.

That's it. As a result, you should receive such app:

iOS Extension

The full code can be found on GitHub.

Happy coding!

Buy Me A Coffee

Related:

AppIcon Badge with .NET MAUI

The article demonstrates how to add the AppIcon badge number with .NET MAUI.

Prepare .NET MAUI application with CommunityToolkit.MAUI to release

The article describes how to configure .NET MAUI CommunityToolkit to avoid crashes at runtime.

An unhandled error has occurred. Reload

🗙