Aravind G S
Aravind G S

Reputation: 392

Static property of swift framework becomes null in xamarin binding

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

Answers (0)

Related Questions