Xamarin (.Net 6) Binding Project for iOS (T1 Autograph Objective C Library).
- Install the .Net ios workload if it has not been done before
- Create two projects (a binding project for the native objective-C lib, a sample which uses the binding project, Framework: .net6.0-ios)
- Download the Autograph library (in this case version 2.0.6, you can download the library for testing purposes here)
- Download the latest sharpie toolkit (here) to create a C#/.Net API file (one or multiple C# classes) to communicate with the Objective-C lib
- Create the API definition class with the following console command (in a new target directory "sharpie")
sharpie bind --output=sharpie --namespace=AutographBinding --sdk=iphoneos15.2 -scope T1Autograph.xcframework/ios-arm64_armv7/T1Autograph.framework/Headers T1Autograph.xcframework/ios-arm64_armv7/T1Autograph.framework/Headers/*.h
- Copy the created
ApiDefinitions.cs
file and the downloaded Autograph objective-C lib (T1Autograph.xcframework) to the root directory of your binding project - Make sure your binding project is a real binding project. Take a look at your csproj file and make sure you made the following changes.
[...] <RootNamespace>AutographBinding</RootNamespace> <AssemblyName>AutographBinding</AssemblyName> <AllowUnsafeBlocks>true</AllowUnsafeBlocks> <IsBindingProject>true</IsBindingProject> <NoBindingEmbedding>true</NoBindingEmbedding> [...] <ItemGroup> <ObjcBindingApiDefinition Include="ApiDefinitions.cs"> <Link>ApiDefinitions.cs</Link> </ObjcBindingApiDefinition> <NativeReference Include="T1Autograph.xcframework" Kind="Framework" /> </ItemGroup> [...]
- Add the Autograph Binding project to the example project