BlackHawk is a Cordova compatible javascript-native reflection bridge based on fast and sexy WKWebView written in pure Swift, with incredible high performance.
##Incredible High Performance
###Let's test a shooting game called "萌战姬"
####Cordova:
####BlackHawk:
###That's tons of progress.
###Let's test "萌战姬" on iPhone 4S
- Device: iPhone 4S
####Cordova:
- fps: 15-18
- fps when explosion: 1-5
- ScreenShot
####BlackHawk:
- fps: 26-30
- fps when explosion: 15-20
- ScreenShot
####BlackHawk makes "萌战姬" can be played on iPhone 4S now.
##Features
####Basic Features
BlackHawk is a Cordova like software that provides a javascript to native reflection bridge, written in pure Swift, aimed to provide a modern, hight-performance replacement of Cordova on iOS platform. BlackHawk uses WKWebView in Apple's new WebKit Framework with pure Swift Language.
####High Performance BlackHawk can reduce the cost of RAM and CPU significantly, especially for complicated HTML5 pages.
##Cordova Compatible
The ultimate goal of BlackHawk is being a complete replacement of Cordova on iOS platform, so that BlackHawk is fully compatible with Cordova's javascript API.
####Check-list of BlackHawk plugins:
- Console
- Accelerometer
- Bluetooth (waitting for supporting iOS8)
- Vibration
- Device (already built in)
- Device Orientation
##Requirements
- iOS 8.0 +
- Xcode 7 beta 6 (Swift 2.0)
##Architecture
##How to Use
###include as sub project
Drag BlackHawk/BlackHawk.xcodeproj into your project as a sub project.
###copy files
Copy www
directory to your project, and add it to Build Phases
> Copy Bundle Resources
.
###write some code
In anywhere you want to show a BlackHawk View Controller:
import UIKit
import BlackHawk
class ViewController: BlackHawkViewController {
... ...
###run on devices
If you want to run your project on a device, just do one thing:
###That's it!
##What can BlackHawk be?
BlackHawk is cordova compatible, actually it's a javascript-native reflection bridge, cordova compatible layer is just one of many layers on it.
Obviously you can build your own layer based on your own protocol. Maybe next killer Hybrid Development Framework will be made by you!
##Make a plugin for BlackHawk
If you want to build a plugin named Nothing
, you need to do 3 steps to make your plugin run:
-
new a javascript file named
Nothing.js
inwww/plugins
directory -
add
Nothing
to the params of self.runPluginJS(["Base"]) in BlackHawkViewController class. -
do everything you want in
Nothing.js
, new a Swift file or not depends on you. If you want, just see:// js code Queue.push(Task.init(Queue.length, onSuccess, onError)); window.webkit.messageHandlers.BlackHawk.postMessage({ className: 'NothingClassName', functionName: 'functionName', taskId: Queue.length - 1, data: 'nothing' });
##Contribution
If you have any suggestions please open an issue, and you are very welcome to fork and submit pull requests.
####Plugins for BlackHawk will be best news!
##LICENSE BlackHawk is open-sourced software licensed under the MIT license.
Copyright (c) 2015 Leqicheng Inc. 乐其橙科技(北京)有限公司