Quantcast
Channel: Recent Threads — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 204402

Binding iOS protocol

$
0
0

Hi,

one should think that I understood Bindings by now, but whenever it comes to iOS I face new adventures.

I created an objective-c framework that contains just one single class which has a header and main file.
This file defines a protocol in its header.

#import <Foundation/Foundation.h>
@protocol MyDelegate <NSObject>
    @required
    -(void) method1:(NSInteger *)value;
    -(void) method2:(NSString*) value;
    -(void) method3:(NSString*) value;
@end
@interface MyClass : NSObject
    +(void)addDelegate:(id <MyDelegate>)delegate;
@end

Then I want to only bind the delegate, I don't care for the MyClass (for the moment).
So what I defined is

[Protocol, Model]
[BaseType(typeof(NSObject))]
interface MyDelegate
{
    [Abstract]
    [Export("method1:")]
    public void Method1(int value);

    [Abstract]
    [Export("method2:")]
    public void  Method(string value);

    [Abstract]
    [Export("method3:")]
    public void Method3(string value);
}

If I build the binding project all is fine. If I build the iOS project that integrates the binding, all is fine.
However the MyDelegate class simply doesn't appear in the iOS project. It is not existent.

If I remove the [Protocol,Model] from the top of the definition I get an error telling me the class MyDelegate couldn't be found.
But I can confirm 100% that the framework contains the corresponding header file.

What am I doing wrong here?

Thank you!


Viewing all articles
Browse latest Browse all 204402

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>