CocoaPods is a dependency manager for Cocoa projects and is our recommended method of installing PusherPlatform and its dependencies.
If you don't already have the Cocoapods gem installed, run the following command:
$ gem install cocoapods
Then run pod init
to create your Podfile
(if you don't already have one).
Next, add the following lines to it:
source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0' # change this if you're not making an iOS app!
use_frameworks!
# Replace `<Your Target Name>` with your app's target name.
target '<Your Target Name>' do
pod 'PusherPlatform'
end
Then, run the following command:
$ pod install
If you find that you're not having the most recent version installed when you run pod install
then try running:
$ pod repo update
$ pod install
Also you'll need to make sure that you've not got the version of PusherPlatform locked to an old version in your Podfile.lock
file.
Carthage is a decentralized dependency manager that automates the process of adding frameworks to your Cocoa application.
You can install Carthage with Homebrew using the following command:
$ brew update
$ brew install carthage
To integrate PusherPlatform into your Xcode project using Carthage, specify it in your Cartfile
:
github "pusher/pusher-platform-swift"
TODO
First we need to have an instance of an Instance
. To create an Instance
we need to pass in a locator
, serviceName
, and serviceVersion
. You can get your instance locator from the dashboard.
let instance = Instance(locator: "instanceLocator", serviceName: "service-name", serviceVersion: "service-version")
The Instance
instance allows you to interact with the service using the Elements protocol. The high level methods it exposes are:
request
andrequestWithRetry
for standard HTTP requestssubscribe
for subscriptionssubscribeWithResume
for subscriptions that you can resume from the last received event ID
There are a set of tests for the library that can be run using the standard method (Command-U in Xcode).
The tests also get run on Bitrise.
- Found a bug? Please open an issue.
- Have a feature request. Please open an issue.
- If you want to contribute, please submit a pull request (preferrably with some tests 🙂 ).
PusherPlatform is released under the MIT license. See LICENSE for details.
PusherPlatform uses code from the following repositories:
The individual licenses for these libraries are included in the relevant source files.