Latest 0.1.1
Homepage https://github.com/scaledrone/scaledrone-swift
License MIT
Platforms ios 8.0, osx 10.10, tvos 9.0, requires ARC
Dependencies Starscream
Authors

Scaledrone Swift Client (WIP)

Usage

import UIKit

class ViewController: UIViewController, ScaledroneDelegate, ScaledroneRoomDelegate {

    let scaledrone = Scaledrone(channelID: "KtJ2qzn3CF3svSFe")

    override func viewDidLoad() {
        super.viewDidLoad()
        scaledrone.delegate = self
        scaledrone.connect()
    }

    func scaledroneDidConnect(scaledrone: Scaledrone, error: NSError?) {
        print("Connected to Scaledrone channel", scaledrone.clientID)
        let room = scaledrone.subscribe(roomName: "notifications")
        room.delegate = self
    }

    func scaledroneDidReceiveError(scaledrone: Scaledrone, error: NSError?) {
        print("Scaledrone error")
    }

    func scaledroneDidDisconnect(scaledrone: Scaledrone, error: NSError?) {
        print("Scaledrone disconnected")
    }

    func scaledroneRoomDidConnect(room: ScaledroneRoom, error: NSError?) {
        print("Scaledrone connected to room", room.name)
    }

    func scaledroneRoomDidReceiveMessage(room: ScaledroneRoom, message: String) {
        print("Room received message:", message)
    }
}

Installation

CocoaPods

Check out Get Started tab on cocoapods.org.

To use Starscream in your project add the following ‘Podfile’ to your project

pod 'Scaledrone', '~> 0.1.0'

Then run:

pod install

ToDo:

  • JWT authentication
  • Automatic reconnection
  • Sending messages
  • Observable rooms

Latest podspec

{
    "name": "Scaledrone",
    "version": "0.1.1",
    "summary": "Scaledrone Swift Client (in Alpha stages)",
    "homepage": "https://github.com/scaledrone/scaledrone-swift",
    "license": "MIT",
    "authors": {
        "Scaledrone": "[email protected]"
    },
    "source": {
        "git": "https://github.com/ScaleDrone/Scaledrone-Swift.git"
    },
    "requires_arc": true,
    "source_files": "scaledrone-swift/Scaledrone.swift",
    "platforms": {
        "ios": "8.0",
        "osx": "10.10",
        "tvos": "9.0"
    },
    "dependencies": {
        "Starscream": [
            "~> 2.1.0"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This