danielrhodes / Swift-ActionCableClient

ActionCable is a new WebSocket server being released with Rails 5 which makes it easy to add real-time features to your app. This Swift client makes it dead-simple to connect with that server, abstracting away everything except what you need to get going.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support Objective-C API

tin4g opened this issue · comments

How can it generate umbrella headers like Starscream?

## Carthage/.../Starscream.framework/Headers/Starscream-Swift.h ##

...

SWIFT_CLASS("_TtC10Starscream9WebSocket")
@interface WebSocket : NSObject <NSStreamDelegate>
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSString * _Nonnull ErrorDomain;)
+ (NSString * _Nonnull)ErrorDomain;
@property (nonatomic, strong) OS_dispatch_queue * _Nonnull callbackQueue;
@property (nonatomic, copy) NSArray<NSString *> * _Nullable optionalProtocols;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSUpgradeName;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSUpgradeValue;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSHostName;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSConnectionName;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSConnectionValue;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSProtocolName;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSVersionName;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSVersionValue;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSKeyName;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerOriginName;
@property (nonatomic, readonly, copy) NSString * _Nonnull headerWSAcceptName;
@property (nonatomic, readonly) NSInteger BUFFER_MAX;
@property (nonatomic, readonly) uint8_t FinMask;
@property (nonatomic, readonly) uint8_t OpCodeMask;
@property (nonatomic, readonly) uint8_t RSVMask;
@property (nonatomic, readonly) uint8_t MaskMask;
@property (nonatomic, readonly) uint8_t PayloadLenMask;
@property (nonatomic, readonly) NSInteger MaxFrameSize;
@property (nonatomic, readonly) NSInteger httpSwitchProtocolCode;
@property (nonatomic, readonly, copy) NSArray<NSString *> * _Nonnull supportedSSLSchemes;
@property (nonatomic, copy) void (^ _Nullable onConnect)(void);
@property (nonatomic, copy) void (^ _Nullable onDisconnect)(NSError * _Nullable);
@property (nonatomic, copy) void (^ _Nullable onText)(NSString * _Nonnull);
@property (nonatomic, copy) void (^ _Nullable onData)(NSData * _Nonnull);
@property (nonatomic, copy) void (^ _Nullable onPong)(NSData * _Nullable);
@property (nonatomic, copy) NSDictionary<NSString *, NSString *> * _Nonnull headers;
@property (nonatomic) BOOL voipEnabled;
@property (nonatomic) BOOL disableSSLCertValidation;
@property (nonatomic, copy) NSArray<NSNumber *> * _Nullable enabledSSLCipherSuites;
@property (nonatomic, copy) NSString * _Nullable origin;
@property (nonatomic) NSInteger timeout;
@property (nonatomic, readonly) BOOL isConnected;
@property (nonatomic, readonly, copy) NSURL * _Nonnull currentURL;
/**
  Used for setting protocols.
*/
- (nonnull instancetype)initWithUrl:(NSURL * _Nonnull)url protocols:(NSArray<NSString *> * _Nullable)protocols OBJC_DESIGNATED_INITIALIZER;
- (nonnull instancetype)initWithUrl:(NSURL * _Nonnull)url writeQueueQOS:(NSQualityOfService)writeQueueQOS protocols:(NSArray<NSString *> * _Nullable)protocols;
/**
  Connect to the WebSocket server on a background thread.
*/
- (void)connect;
/**
  Write a string to the websocket. This sends it as a text frame.
  If you supply a non-nil completion block, I will perform it when the write completes.
  \param string The string to write.

  \param completion The (optional) completion handler.

*/
- (void)writeWithString:(NSString * _Nonnull)string completion:(void (^ _Nullable)(void))completion;
/**
  Write binary data to the websocket. This sends it as a binary frame.
  If you supply a non-nil completion block, I will perform it when the write completes.
  \param data The data to write.

  \param completion The (optional) completion handler.

*/
- (void)writeWithData:(NSData * _Nonnull)data completion:(void (^ _Nullable)(void))completion;
/**
  Write a ping to the websocket. This sends it as a control frame.
  Yodel a   sound  to the planet.    This sends it as an astroid. http://youtu.be/Eu5ZJELRiJ8?t=42s
*/
- (void)writeWithPing:(NSData * _Nonnull)ping completion:(void (^ _Nullable)(void))completion;
/**
  Delegate for the stream methods. Processes incoming bytes
*/
- (void)stream:(NSStream * _Nonnull)aStream handleEvent:(NSStreamEvent)eventCode;
- (nonnull instancetype)init SWIFT_UNAVAILABLE;
@end

...