Create iOS slim bindings for MAUI. USE FOR: slim iOS binding, Native Library Interop, Swift/Objective-C wrappers, XcodeGen project.yml, Podfile, CocoaPods static linking, BUILD_LIBRARY_FOR_DISTRIBUTION, XcodeProject MSBuild, `@objc`/`[Export]` selector crashes, async completion handlers. DO NOT USE FOR: Android bindings, general MAUI apps, or NuGet packaging.
When to use this skill
Activate this skill when the user asks:
How do I create iOS bindings for a native library?
How do I wrap an iOS SDK for use in .NET MAUI?
How do I create slim bindings for iOS?
How do I use Native Library Interop for iOS?
How do I bind a Swift library to .NET?
How do I use Objective Sharpie for iOS bindings?
How do I integrate an xcframework into .NET MAUI?
How do I create a Swift wrapper for a native iOS library?
How do I update iOS bindings when the native SDK changes?
How do I fix iOS binding build errors?
How do I expose native iOS APIs to C#?
How do I handle CocoaPods dependencies in iOS bindings?
How do I handle Swift Package Manager dependencies?
Overview
This skill guides the creation of Native Library Interop (Slim Bindings) for iOS. This modern approach creates a thin native Swift/Objective-C wrapper exposing only the APIs you need from a native iOS library, making bindings easier to create and maintain.
When to Use Slim Bindings vs Traditional Bindings
Scenario
Recommended Approach
Need only a subset of library functionality
Slim Bindings
Easier maintenance when SDK updates
Slim Bindings
Prefer working in Swift/Objective-C for wrapper
Slim Bindings
Better isolation from breaking changes
Slim Bindings
Need entire library API surface
Traditional Bindings
Creating bindings for third-party developers
Traditional Bindings
Already maintaining traditional bindings
Traditional Bindings
Inputs
Parameter
Required
Example
Notes
libraryName
yes
FirebaseMessaging, Lottie
Name of the native iOS library to bind
bindingProjectName
yes
MyBinding.MaciOS
Name for the C# binding project
dependencySource
no
cocoapods, spm, xcframework
How the native library is distributed
targetFrameworks
no
net10.0-ios;net10.0-maccatalyst
Target frameworks (default: latest .NET iOS + Mac Catalyst)
exposedApis
no
List of specific APIs
Which native APIs to expose (helps scope the wrapper)
Project Structure
MyBinding/
macios/
native/
MyBinding/ # Xcode project
MyBinding.xcodeproj/
project.pbxproj
MyBinding/
DotnetMyBinding.swift # Swift wrapper implementation
Podfile # If using CocoaPods
Package.swift # If using Swift Package Manager
MyBinding.MaciOS.Binding/
MyBinding.MaciOS.Binding.csproj
ApiDefinition.cs
sample/
MauiSample/ # Sample MAUI app
MauiSample.csproj
MainPage.xaml.cs
README.md
Clean up the generated output: add [Async] attributes, [NullAllowed] for nullable types, remove [Verify] attributes after review, and remove InitWithCoder constructors.
Step 8: Build the Final Binding
dotnet build -c Release
Step 9: Use in Your MAUI App
Add a conditional <ProjectReference>, initialize in MauiProgram.cs with #if IOS || MACCATALYST, and use [Async]-generated methods with await.
Updating Bindings When Native SDK Changes
Update native dependency version (CocoaPods: pod update, SPM: update version, or replace xcframework)
Update Swift wrapper if APIs changed
Clean and rebuild: dotnet clean && dotnet build
Regenerate Objective Sharpie output and diff with existing ApiDefinition.cs
Merge changes: add new bindings, update signatures, preserve custom attributes.