ApiDefinition.cs 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. using System;
  2. using UIKit;
  3. using Foundation;
  4. using ObjCRuntime;
  5. using CoreGraphics;
  6. namespace Urho.iOS
  7. {
  8. // The first step to creating a binding is to add your native library ("libNativeLibrary.a")
  9. // to the project by right-clicking (or Control-clicking) the folder containing this source
  10. // file and clicking "Add files..." and then simply select the native library (or libraries)
  11. // that you want to bind.
  12. //
  13. // When you do that, you'll notice that MonoDevelop generates a code-behind file for each
  14. // native library which will contain a [LinkWith] attribute. MonoDevelop auto-detects the
  15. // architectures that the native library supports and fills in that information for you,
  16. // however, it cannot auto-detect any Frameworks or other system libraries that the
  17. // native library may depend on, so you'll need to fill in that information yourself.
  18. //
  19. // Once you've done that, you're ready to move on to binding the API...
  20. //
  21. //
  22. // Here is where you'd define your API definition for the native Objective-C library.
  23. //
  24. // For example, to bind the following Objective-C class:
  25. //
  26. // @interface Widget : NSObject {
  27. // }
  28. //
  29. // The C# binding would look like this:
  30. //
  31. // [BaseType (typeof (NSObject))]
  32. // interface Widget {
  33. // }
  34. //
  35. // To bind Objective-C properties, such as:
  36. //
  37. // @property (nonatomic, readwrite, assign) CGPoint center;
  38. //
  39. // You would add a property definition in the C# interface like so:
  40. //
  41. // [Export ("center")]
  42. // CGPoint Center { get; set; }
  43. //
  44. // To bind an Objective-C method, such as:
  45. //
  46. // -(void) doSomething:(NSObject *)object atIndex:(NSInteger)index;
  47. //
  48. // You would add a method definition to the C# interface like so:
  49. //
  50. // [Export ("doSomething:atIndex:")]
  51. // void DoSomething (NSObject object, int index);
  52. //
  53. // Objective-C "constructors" such as:
  54. //
  55. // -(id)initWithElmo:(ElmoMuppet *)elmo;
  56. //
  57. // Can be bound as:
  58. //
  59. // [Export ("initWithElmo:")]
  60. // IntPtr Constructor (ElmoMuppet elmo);
  61. //
  62. // For more information, see http://developer.xamarin.com/guides/ios/advanced_topics/binding_objective-c/
  63. //
  64. }