Latest 1.1.0
Homepage https://github.com/Elgatomontes/SwiftJavascriptBridge
License BSD
Platforms ios 8.0, requires ARC
Authors

[CI Status](https://travis-ci.org/Gaston Montes/SwiftJavascriptBridge)
Version
License
Platform

An iOS bridge for sending messages between Swift and Javascript.

SwiftJavascriptBridge is a Swift interface for bridging between WKWebView (Swift) and WebKit (Javascript).

SwiftJavascriptBridge can be use to send message from Swift to Javascript, from Javascript to Swift or to receive messages in Swift from Javascript or in Javascript from Swift.

Requirements

SwiftJavascriptBridge Version Minimum iOS Target Minimum OS X Target Notes
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.

Get Started

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

If an 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:

pod 'SwiftJavascriptBridge'

Freezing to a specific Pod version:

pod 'SwiftJavascriptBridge', '1.1.0'

Using logical operators:

  • '> 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.

Using optimistic operators:

  • '~> 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.

Installation

SwiftJavascriptBridge is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod "SwiftJavascriptBridge"

Communication

Pin It on Pinterest

Share This