1

When using gobind via gomobile on iOS for an interface type, a golang function returning an error results in 2 impacts to the class in Objective C (example below):

  • The inclusion of a NSError pointer passed in
  • The method returns a boolean

I can infer how to use the NSError pointer, it's a standard objective C practice. But what value should I be returning for the boolean? TRUE on error, FALSE on success? The opposite? Something else? I can't seem to find documentation anywhere.

Example

An interface like this:

type A interface {
  DoThing(data *DataType) error
}

Get's an objective C interface like this:

@interface PackageA : NSObject <goSeqRefInterface, PackageA> {
}
@property(strong, readonly) _Nonnull id _ref;
- (nonnull instancetype)initWithRef:(_Nonnull id)ref;

// Important bit is here:
- (BOOL)doThing:(data* _Nullable)DataType error:(NSError* _Nullable* _Nullable)error;
@end
scosman
  • 2,343
  • 18
  • 34

0 Answers0