Native Library Interop, formerly referred to as "Slim Bindings", refers to a pattern for accessing native SDKs in .NET MAUI apps, including .NET for Android, .NET for iOS, and .NET for Mac Catalyst apps. This repository provides a starting point for developers looking to get started with creating new bindings or consuming existing bindings constructed via Native Library Interop.
All Native Library Interop bindings and samples are contributed by you, our amazing .NET community, and maintained by a core set of maintainers.
All of the documentation for CommunityToolkit.Maui.NativeLibraryInterop
can be found here on Microsoft Learn:
https://learn.microsoft.com/dotnet/communitytoolkit/maui/native-library-interop
Create your own binding via native library interop by copying the contents of template
and following the getting started instructions in the documentation.
The top-level directories in this repo contains sample MaciOS and/or Android bindings for and sample .NET MAUI apps consuming specific libraries. Get started with Native Library Interop using the Facebook, Firebase Analytics, Firebase Messaging, and Google Cast samples in this repository:
-
Submodule or clone this repo.
-
Navigate to the appropriate directory for the binding you're interested in using or building from, and read the README in the relevant directory for instructions on how to build and configure in your .NET app. Make modifications as you wish.
e.g. To leverage Firebase Messaging APIs on your .NET MAUI, .NET for iOS, and .NET for Mac Catalyst apps, navigate tofirebase/macios/Firebase.MaciOS.Binding
. -
Add a project reference to your MAUI app pointing to the path where you have cloned the repo
e.g. For Firebase Messaging, add to your csproj:<ProjectReference Include="<YourPathToClonedRepo>\firebase\macios\Firebase.MaciOS.Binding\Firebase.MaciOS.Binding.csproj" />
OR build the binding projects and consume the .dll assembly artifacts.
-
Use the binding in your .NET app! See sample usage in the
Sample
.NET MAUI apps included in each of the relevant directories. Note: There are no plans for shipping NuGets at this time.
For more information and guidance, check out the documentation.
If you are interested in contributing, please open an issue and articulate what you wish to contribute.
There are two main ways in which you might consider contributing to this project:
- Expanding the API Surface for existing bindings: Modify an existing binding in this repository by expanding its API surface and exposing more functionality that would benefit the majority of developers.
- Adding new bindings: Share with the community a binding you have created for a library that is not already in this repository.
Please keep in mind that for a contribution to be considered, it:
- Must be broadly applicable and beneficial to a wide audience of .NET developers (e.g., an internal company's native SDK would not be a good candidate)
- Must align with this repository's existing structure and conventions
- May require some collaboration with maintainers to refine the API surface changes
- GoneMobile.io: Slim Bindings Podcast Episode
- MonkeyFest 2020: Bridge the gap with Bindings to native iOS and Android SDK's
As a part of the .NET Foundation, we have adopted the .NET Foundation Code of Conduct. Please familiarize yourself with that before participating with this repository. Thanks!
This project is supported by the .NET Foundation.
A special thank you to the original authors for their hard work and dedication to this project:
Your efforts are highly valued and appreciated! ❤️