|Platforms||ios 8.0, requires ARC|
|1.1.0||iOS 8.0||OS X 10.10.4||Xcode 7 is required.|
|1.0.1||iOS 8.3||OS X 10.10.4||Xcode 7 is required.|
|1.0.0||iOS 8.3||OS X 10.10.4||Xcode 7 is required.|
1) Download CocoaPods
CocoaPods is a dependency manager for iOS, which automates and simplifies the process of using 3rd-party libraries in your projects.
CocoaPods is distributed as a ruby gem, and is installed by running the following commands in Terminal.app:
$ sudo gem install cocoapods $ pod setup
2) Create Podfile
In the project root folder, run the following command to create a Podfile:
$ pod init YOURXCODEPROJECTFILE
YOURXCODEPROJECTFILE project file is specified or if there is only a single project file in the current directory, targets will be automatically generated based on targets defined in the project.
3) Add dependencies:
An empty Podfile was created, so we are going to add dependencies to the Podfile specifying pods versions:
To use the latest version of a Pod, ommit the version specification:
Freezing to a specific Pod version:
'> 0.1', Any version higher than 0.1.
'>= 0.1', Any version higher or equal to 0.1.
'< 0.1', Any version lower than 0.1.
'<= 0.1', Any version lower or equal to 0.1.
'~> 0.1.0', Version 0.1.0 or higher up to 0.2, not including 0.2.
'~> 0.1', Version 0.1 or higher up to 1.0, not including 1.0.
4) Install dependencies
Install Pods dependencies in your project. Run the following commands:
$ pod install
From now on, be sure to always open the generated Xcode workspace (.xcworkspace) instead of the project file when building your project.
- If you’d like to ask a general question, use Stack Overflow.
- If you found a bug, and can provide steps to reliably reproduce it, open an issue.
- If you have a feature request, open an issue.
- If you want to contribute, submit a pull request.
public func bridgeAddHandler(handlerName: String, handlerClosure: HandlerClosure)
Add Swift ‘handlerName’ handler. Until bridgeLoadScriptFromURL() not called, bridgeAddHandler is going to have no effect. bridgeAddHandler() function can be called at any time, even before the page is loaded.
- handlerName: The name of the Swift handler to add.
public func bridgeRemoveHandler(handlerName: String)
Remove Swift ‘handlerName’ handler. Until bridgeLoadScriptFromURL() not called, bridgeRemoveHandler is going to have no effect.
- handlerName: The name of the Swift handler to remove.
public func bridgeCallFunction(jsFunctionName: String, data: AnyObject?, callBackClosure: HandlerClosure?)
- data: An object that must be converted to a JSON data object. ‘data’ must have the following properties:
- Top level object is an Array or Dictionary
- All objects are String, Double, Int or Float.
- All dictionary keys are Strings.
- Be a Double, Float, Int or String.
An example project is included with this repo. To run the example project, clone the repo, and run
pod installfrom the Example directory first.
Contributors & Forks
Sun, 06 Mar 2016 14:55:05 +0000