bind: update doc to include objective-C interface type support.

Also mention the current limitation in byte slice binding.
golang/go#12113.

Change-Id: Ie75780c2d203431ca26a188dfdb8f000f6805c18
Reviewed-on: https://go-review.googlesource.com/13531
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This commit is contained in:
Hyang-Ah (Hana) Kim 2015-08-11 11:58:54 -04:00 коммит произвёл Hyang-Ah Hana Kim
Родитель 0f9ce16152
Коммит 73792b1db2
1 изменённых файлов: 32 добавлений и 2 удалений

Просмотреть файл

@ -121,7 +121,35 @@ The Java implementation can be used like so:
Myfmt.Printer printer = new SysPrint();
Myfmt.PrintHello(printer);
Objective-C support for interfaces will be available soon.
For Objective-C binding, gobind generates a protocol that declares
methods corresponding to Go interface's methods.
@protocol GoMyfmtPrinter
- (void)Print:(NSString*)s;
@end
FOUNDATION_EXPORT void GoMyfmtPrintHello(id<GoMyfmtPrinter> p0);
Any Objective-C classes conforming to the GoMyfmtPrinter protocol can be
passed to Go using the GoMyfmtPrintHello function:
@interface SysPrint : NSObject<GoMyfmtPrinter> {
}
@end
@implementation SysPrint {
}
- (void)Print:(NSString*)s {
NSLog("%@", s);
}
@end
The Objective-C implementation can be used like so:
SysPrint* printer = [[SysPrint alloc] init];
GoMyfmtPrintHello(printer);
Type restrictions
@ -134,7 +162,9 @@ Supported types include:
- String and boolean types.
- Byte slice types.
- Byte slice types. Note the current implementation does not
support data mutation of slices passed in as function arguments.
(https://golang.org/issues/12113)
- Any function type all of whose parameters and results have
supported types. Functions must return either no results,