Publishing a JSON object to a channel is really easy. Here is an an example to get you started.
Click to copy the blue snippets and then paste them into your code.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?.publish(["announcement": "Welcome to PubNub!"], toChannel: "announcements", withCompletion: { (status) -> Void in if !status.error { // Message successfully published to specified channel. } else{ // Handle message publish error. Check 'category' property // to find out possible reason because of which request did fail. // Review 'errorData' property (which has PNErrorData data type) of status // object to get additional information about the issue. // // Request can be resent using: status.retry() } }) return true } }