docs-maui
docs-maui copied to clipboard
Binding an objective-c library
trafficstars
Xamarin doc: https://learn.microsoft.com/en-us/xamarin/ios/platform/binding-objective-c/
.NET MAUI sample: https://github.com/Sweekriti91/maui_ios_binding
Binding Obj-C - https://docs.microsoft.com/en-us/xamarin/ios/platform/binding-objective-c/ Updated the sample here : https://github.com/Sweekriti91/maui_ios_binding
Steps followed :
Steps
-
Convert csproj file to SDK style.
- add the
<IsBindingProject>true</IsBindingProject>project property - Delete
AssemblyInfo.csOR keep old AssemblyInfo.cs file and set<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
- add the
-
Update for .NET 7 TFMs.
-
For iOS, Known API Changes :
- All references to
System.nint,System.nuintandSystem.nfloat-> change tonative int,native uintandSystem.NFloat - All methods on
System.nintandSystem.nuint-> change to either equivalent calls onnative intandnative uint - If needed, add these new types
NativeIntegerAttributeandCompilerGeneratedAttribute - All objects that inherit from either
Foundation.NSObjectorObjCRuntime.DisposableObjectthat have constructors of the form.ctor (IntPtr) or .ctor (IntPtr, bool)-> change theIntPtrreferences toObjCRuntime.NativeHandle. - All objects that inherit from
Foundation.NSObjectthat haveClassHandleorHandleproperties of typeIntPtr-> change to typeObjCRuntime.NativeHandle AutoGeneratedtag remove from ApiDefinitions
- All references to
-
Build and fix build errors.
Resources
Xamarin.iOS -> .net7-ios - Project-file-properties - #11863