Bug 33523 - Bindings reference documentation is wrong for categories
Summary: Bindings reference documentation is wrong for categories
Status: RESOLVED FIXED
Alias: None
Product: Documentation
Classification: Xamarin
Component: MonoTouch (show other bugs)
Version: unspecified
Hardware: PC Mac OS
: --- normal
Target Milestone: ---
Assignee: CraigD
URL:
Depends on:
Blocks:
 
Reported: 2015-08-31 19:18 UTC by Adam Kemp
Modified: 2017-05-25 23:39 UTC (History)
1 user (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description Adam Kemp 2015-08-31 19:18:24 UTC
The documentation here: https://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/binding_objc_libs/#Binding_Class_Extensions

has outdated information. The new way to do this for unified projects is something like this:

    [Category, BaseType (typeof (NSString))]
    interface NSStringDrawingExtensions {
            [Export ("drawAtPoint:withFont:")]
            CGSize DrawString (CGPoint point, UIFont font);
    }

There should also probably be an example of binding a property. Example:

@interface UIView (MyIn)
@property (nonatomic, strong) NSString *name;
@end

Would need two separate methods:

  [Category, BaseType(typeof(UIView))]
  interface UIView_MyIn
  {        
    [Export ("name")]
    string Name();

    [Export("setName:")]
    void SetName(string name);
  }
Comment 1 CraigD 2017-05-25 23:39:01 UTC
this _seems_ like it was addressed (the unified fix, at least). the engineering team has added additional examples to the page.

Note You need to log in before you can comment on or make changes to this bug.