How do you call native iOS (Objective-C/Swift) libraries from MAUI?
Short answer
Use a .NET for iOS binding library with ApiDefinition and Structs files describing the native framework, then reference it from Platforms/iOS. Objective-C binds directly; Swift usually needs an Objective-C-compatible interface. Objective Sharpie can generate a starting binding.
Advertisement
AModel answer
Use a .NET for iOS binding library with ApiDefinition and Structs files describing the native framework, then reference it from Platforms/iOS. Objective-C binds directly; Swift usually needs an Objective-C-compatible interface. Objective Sharpie can generate a starting binding.
var analytics = new Vendor.Analytics();
analytics.TrackEvent("purchase");Real-world example
An iOS-only analytics framework is bound with Objective Sharpie and invoked from iOS platform code.
Likely follow-ups
- What is Objective Sharpie? | Why do Swift libraries need extra work?
Related topics