HybridKit 0.0.2

HybridKit 0.0.2

LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Dec 2014

Maintained by Clay Allsopp, Mert Dümenci, Clay Allsopp.

Depends on:
SVProgressHUD~> 1.0
HexColors~> 2.0
TransitionKit~> 2.1
BlocksKit~> 2.2

HybridKit 0.0.2

  • By
  • Mert Dumenci and Clay Allsopp

HybridKit for iOS

HybridKit is a simple, extensible messaging system for your web/native hybrid mobile apps.

Using HybridKit for JavaScript, you can send commands from your web page to your native app for processing.


HybridKit uses command handlers for handling commands sent using the JavaScript library. HybridKit ships with useful defaults, or you can write completely new ones.


HybridKit for iOS requires CocoaPods. Add it to your Podfile:

pod 'HybridKit'

Run pod install and you're off!


You can utilize HybridKit by using HYWebViewController instead of UIViewController. HYWebViewController will be ready to catch commands by registering the default command handlers automatically.

Setup HYWebViewController and load a URL.

HYWebViewController *webViewController = [[HYWebViewController alloc] initWithParams:@{@"url" : @"http://google.com"}];

// or

HYWebViewController *webViewController = [[HYWebViewController alloc] init];
webViewController.url = [NSURL URLWithString:@"http://google.com"];

[self presentViewController:webViewController animated:YES completion:nil];

Built-in Commands

By default, HybridKit includes the following commands: alert, open_url, set_url, set_url_refresh, set_title, set_scroll_enabled, set_background_color, deceleration_rate, trigger_event, and javascript.

For more information about the built-in handlers, check the HybridKit-JS Wiki.

Custom Command Handlers

You can create new command handlers for custom commands invoked using the JavaScript library easily.

Simply create a HYWebViewCommand subclass and override the handleCommandString:dictionary & respondsToCommandString methods:

@interface HideNavigationBarHandler : HYWebViewCommand

@implementation HideNavigationBarHandler
-(void)handleCommandString:(NSString *)commandString dictionary:(NSDictionary *)commandDictionary {
    if ([commandString isEqualToString:@"hide_navbar"]) {
        self.webViewController.navigationController.navigationBarHidden = [commandDictionary[@"hidden"] boolValue];

- (BOOL)respondsToCommandString:(NSString *)commandString {
    return [commandString isEqualToString:@"hide_navbar"];

Register the new command handler to a HYWebViewController instance.

[hybridKitViewController registerCommandHandler:[HideNavigationBarHandler new]];

Invoke your new command using the JavaScript library.

HybridKit.runCommand("hide_navbar", {hidden: true});


Mert Dümenci

Clay Allsopp


HybridKit for iOS is available under the MIT license. See the LICENSE file for more info.