Reputation: 392
I developed a swift framework as xcframework & created xamarin binding for it. In the framework the call is made as a singleton class
MyFramework.shared.start()
The shared is a singleton instance
static let shared = MyFramework()
After making dll in Xamarin and calling the start method it crashes because shared in null. The ApiDefinition.cs
file is provided below. Can someone help on how to make the shared instance allocated.
using Foundation;
using ObjCRuntime;
// @interface LeapCreator : NSObject
[BaseType(typeof(NSObject), Name = "_TtC14MyFrameworkSDK11MyFramework")]
[Protocol]
interface MyFramework
{
// @property (readonly, nonatomic, strong, class) MyFramework * _Nonnull shared;
[Static]
[Export("shared", ArgumentSemantic.Strong)]
MyFramework Shared { get; }
// -(void)start:(NSString * _Nonnull)apiKey;
[Export("start:")]
void Start(string apiKey);
}
Upvotes: 0
Views: 103