1 Subscribe to presence channels

To receive presence events from other users in real-time, subscribe to the associated presence channels.

Click to copy the blue snippets and then paste them into your code.

AppDelegate.swift

import UIKit
import PubNub
import PubNubBridge


@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?
    var client: PubNub?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
        self.client = PubNub.client()
        self.client?.addListener(self)
        self.client?.subscribeToPresenceChannels(["lobby"])
        return true
    }
}