Inherits from NSObject
Declared in STWNativeBridge.h
STWNativeBridge.m

Overview

STWNativeBridge is the collection of methods which interacts with the webView with Framework’s specific manner.

Properties

mainQueue

The main thread queue.

@property (nonatomic, retain) NSOperationQueue *mainQueue

Discussion

The main thread queue.

Declared In

STWNativeBridge.h

operationQueue

The background thread queue.

@property (nonatomic, retain) NSOperationQueue *operationQueue

Discussion

The background thread queue.

Declared In

STWNativeBridge.h

repository

The repository of Straw Services which are active on the webView.

@property (nonatomic, retain) STWServiceRepository *repository

Discussion

The repository of Straw Services which are active on the webView.

Declared In

STWNativeBridge.h

viewController

The viewController in which the webView placed.

@property (nonatomic, assign) UIViewController *viewController

Discussion

The viewController in which the webView placed.

Declared In

STWNativeBridge.h

webView

The webView to bridge

@property (nonatomic, assign) UIWebView *webView

Discussion

The webView to bridge

Declared In

STWNativeBridge.h

Instance Methods

createServiceCallFromUrlRequest:

Creates Service Call object from url and webView.

- (STWServiceCall *)createServiceCallFromUrlRequest:(NSURLRequest *)request

Parameters

request

the url request

Return Value

generated Service Call object

Discussion

Creates Service Call object from url and webView.

Declared In

STWNativeBridge.h

executeRequest:

Execute the Straw URL request.

- (void)executeRequest:(NSURLRequest *)request

Parameters

request

the request to execute

Discussion

Execute the Straw URL request.

Declared In

STWNativeBridge.h

initWithWebView:withViewController:

Initialize with webView and the viewController.

- (instancetype)initWithWebView:(UIWebView *)webView withViewController:(UIViewController *)viewController

Parameters

webView

the webView

viewController

the viewController

Return Value

the instance of the class

Discussion

Initialize with webView and the viewController.

Declared In

STWNativeBridge.h

isStrawURLRequest:

Check if the requested URL is straw custom scheme or not.

- (BOOL)isStrawURLRequest:(NSURLRequest *)request

Parameters

request

url request to check

Return Value

if the url is of straw custom scheme or not

Discussion

Check if the requested URL is straw custom scheme or not.

Declared In

STWNativeBridge.h

loadService:

Load the service instance from the class object.

- (void)loadService:(Class<STWService>)serviceClass

Parameters

serviceClass

the service class to load

Discussion

Load the service instance from the class object.

The resulted service instance will be stored in the repository.

Declared In

STWNativeBridge.h

sendData:withCallId:withSuccess:withKeepAlive:

Send the data back to Browser

- (void)sendData:(NSDictionary *)data withCallId:(NSString *)callId withSuccess:(BOOL)isSuccess withKeepAlive:(BOOL)keepAlive

Parameters

data

data to send

callId

callId of Service Method call

isSuccess

Service Method call succeeded or not

keepAlive

It should keep the JS callback alive or not

Discussion

Send the data back to Browser

Declared In

STWNativeBridge.h