f78af68fb2
Add support for binding constructors in protocols. Given the api definition: ```cs [Protocol] public interface Protocol { [Abstract] [Export ("init")] IntPtr Constructor (); [Export ("initWithValue:")] IntPtr Constructor (IntPtr value); [BindAs ("Create")] [Export ("initWithPlanet:")] IntPtr Constructor (); } ``` we're binding it like this: ```cs [Protocol ("Protocol")] public interface IProtocol : INativeObject { [Export ("init")] public static T CreateInstance<T> () where T: NSObject, IProtocol { /* default implementation */ } [Export ("initWithValue:")] public static T CreateInstance<T> () where T: NSObject, IProtocol { /* default implementation */ } [Export ("initWithPlanet:")] public static T Create<T> () where T: NSObject, IProtocol { /* default implementation */ } } ``` Also add documentation and tests. Fixes https://github.com/xamarin/xamarin-macios/issues/14039. --------- Co-authored-by: Manuel de la Pena <mandel@microsoft.com> Co-authored-by: Alex Soto <alex@soto.dev> |
||
---|---|---|
.. | ||
Makefile | ||
bgen-tests.csproj |