appceleratorappcelerator-hyperloop

Hyperloop not generating javascript binding for @protocol header


I have the following definition in my shared.h file that is included in a custom framework I am developing.

__attribute__((swift_name("FivestarsPayEventListener")))
@protocol SharedFivestarsPayEventListener
@required
- (void)onFivestarsPayEventFivestarsPayEvent:(SharedFivestarsPayEvent *)fivestarsPayEvent __attribute__((swift_name("onFivestarsPayEvent(fivestarsPayEvent:)")));
@end;

When I build the project, most of the bindings are generated (they are annotated with @interface).

Why is appcelerator not generating the bindings for the @protocol annotated header?

You can see that many of the other javascript bindings are generated. For example, sharedaction which is defined like this

__attribute__((objc_subclassing_restricted))
__attribute__((swift_name("Action")))
@interface SharedAction : SharedKotlinEnum<SharedAction *>
+ (instancetype)alloc __attribute__((unavailable));
+ (instancetype)allocWithZone:(struct _NSZone *)zone __attribute__((unavailable));
- (instancetype)initWithName:(NSString *)name ordinal:(int32_t)ordinal __attribute__((swift_name("init(name:ordinal:)"))) __attribute__((objc_designated_initializer)) __attribute__((unavailable));
@property (class, readonly) SharedAction *getFullPath __attribute__((swift_name("getFullPath")));
@property (class, readonly) SharedAction *removeFile __attribute__((swift_name("removeFile")));
@property (class, readonly) SharedAction *writeToFile __attribute__((swift_name("writeToFile")));
@property (class, readonly) SharedAction *writeBytesToFile __attribute__((swift_name("writeBytesToFile")));
@property (class, readonly) SharedAction *readFile __attribute__((swift_name("readFile")));
@property (class, readonly) SharedAction *readFileCompressed __attribute__((swift_name("readFileCompressed")));
@property (class, readonly) SharedAction *getFiles __attribute__((swift_name("getFiles")));
@end;

enter image description here


Solution

  • An interface is where you define the members and methods of the class. You must are responsible for the implementation too. A protocol is like an interface for java.

    Additional information added by @dazza5000:

    The protocol definition could still be generated by Hyperloop, but it is not. I had manually create the interface implementation and then I could use them with the rest of the hyperloop generated bindings.