PusherPlatform 0.7.3

PusherPlatform 0.7.3

TestsTested βœ—
LangLanguage SwiftSwift
License MIT
ReleasedLast Release Jan 2020
SPMSupports SPM βœ—

Maintained by Pusher.

PusherPlatform (pusher-platform-swift)

Build Status CocoaPods Carthage Twitter GitHub license

Table of Contents



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!

# Replace `<Your Target Name>` with your app's target name.
target '<Your Target Name>' do
  pod 'PusherPlatform'

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"

Swift Package Manager

Swift Package Manager is a tool for managing the distribution of Swift code. It’s integrated with the Swift build system to automate the process of downloading, compiling, and linking dependencies.

Manual Xcode integration

To integrate PusherPlatform into your Xcode project using Swift Package Manager, in your Xcode choose File > Swift Packages > Add Package Dependency... and provide the following URL:


Swift Package Manager dependency

To add PusherPlatform as a dependency of your own package use the follwing code:

dependencies: [
    .package(url: "https://github.com/pusher/pusher-platform-swift.git", from: "0.7.3")

Getting started

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 and requestWithRetry for standard HTTP requests
  • subscribe for subscriptions
  • subscribeWithResume 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.