Latest 0.0.5
Homepage https://github.com/Nexmo/conversation-ios-sdk
License Apache
Platforms ios 9.0
Dependencies RxCocoa, Gloss, GRDB.swift, Alamofire, Socket.IO-Client-Swift
Authors ,

Nexmo Conversation SDK for iOS

The Conversation SDK is intended to provide a ready solution for developers who want to integrate chat, voice and video in to their apps.

Using the Conversation SDK

Setup

In the Project Navigator, click on "Info.plist" for your target.

  • Add new row and set row type as a dictionary with the name Nexmo
  • Add new row inside Nexmo dictionary called ConversationApplicationID and set it as string type
  • Add your application Id taking from the CLI interface

Creating a conversation session

To start a session, you need to obtain a JWT token from a service you need to build. You use the token to authenticate with the Conversation SDK.

NXMConversationClient.instance.login(token: JWT, callback: { result in
    if (result == .success) {
        // Go to the page you want to display - possibly a list of the user's conversations
    } else {
        // Handle error
    }
})

Create a conversation

let createOp:NXMAsyncOperation = NXMConversationClient.instance.createConversation(name:"My Conversation", callback: { (conversation, success, error) in
      if (success) {
        // Refresh UI
      } else {
        // Handle error
      }
})

Join a conversation

let joinOp:NXMAsyncOperation = conversation.join(callback: { (conversation, success, error) in
    if (success) {
          // Refresh UI
    } else {
          // Handle error
    }
})

Invite a user to a conversation

let inviteOp:NXMAsyncOperation = conversation.invite(user: user, callback: { (conversation, user, success, error) in
    // do something
})

Leave a conversation

let leaveOp:NXMAsyncOperation  = conversation.leave(callback: { (conversation, success, error) in
    // do something
})

Get the list of conversations

var conversations:NXMConversationCollection?  = NXMConversationClient.instance.conversations

Get a list of the conversation’s events

var messages:NXMEventList? = conversation.events

Send a text message

let message = conversation?.createDraftMessage(type: NXMEventBase.NXMEventType.text)
message!.text = myMessageText
do {
    try conversation!.sendMessage(draftMessage: message)
} catch {
    // handle error
}

Logout

Logout disconnects the session.

NXMConversationClient.instance.logout()

Responding to events

Your classes can register handlers to be called when events are received

NXMConversationClient events

  • connectionStatusChanged
  • conversationAdded
  • conversationLeft
NXMConversationClient.instance.conversationAdded.addHandler(self, handler: MyConversationListClass.handleNewConversationEvent)

NXMConversation events

  • newEventReceived
  • newMember
  • memberLeft
  • memberJoined
  • memberInvited
  • membersChanged
  • messageSent
conversation.newEventReceived.addHandler(self, handler: MyConversationMessagesClass.handleNewEventReceived)

NXMMember events

  • stateChanged
  • typingChanged

NXMTextEvent events

  • receiptRecordChanged
  • newReceiptRecord

Push Notifications

Coming soon

Cancelling operations

All methods returning an NXMAsyncOperation may be cancelled before the operation is complete

operation.cancel()

License

Copyright (c) 2016 Nexmo, Inc. All rights reserved. Licensed only under the Nexmo Conversation SDK License Agreement (the "License") located at

By downloading or otherwise using our software or services, you acknowledge that you have read, understand and agree to be bound by the Nexmo Conversation SDK License Agreement and Privacy Policy.

You may not use, exercise any rights with respect to or exploit this SDK, or any modifications or derivative works thereof, except in accordance with the License.

Author

Jodi Humphreys, [email protected]

Latest podspec

{
    "name": "NexmoConversation",
    "version": "0.0.5",
    "license": {
        "type": "Apache"
    },
    "homepage": "https://github.com/Nexmo/conversation-ios-sdk",
    "authors": {
        "Shams Ahmed": "[email protected]",
        "Jodi Humphreys": "[email protected]"
    },
    "social_media_url": "https://twitter.com/Nexmo",
    "documentation_url": "https://github.com/Nexmo/conversation-ios-sdk",
    "summary": "Conversation SDK",
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/Nexmo/conversation-ios-sdk.git",
        "branch": "master"
    },
    "source_files": "NexmoConversation/**/*.{h,m,swift}",
    "exclude_files": "NexmoConversation/Private/**/*.{h,m,swift}",
    "public_header_files": "NexmoConversation/NexmoConversation.h",
    "pod_target_xcconfig": {
        "SWIFT_VERSION": "3.0"
    },
    "dependencies": {
        "RxCocoa": [
            "~> 3.0.1"
        ],
        "Gloss": [
            "~> 1.1.0"
        ],
        "GRDB.swift": [
            "~> 0.90.0"
        ],
        "Alamofire": [
            "~> 4.0.1"
        ],
        "Socket.IO-Client-Swift": [
            "~> 8.1.1"
        ]
    },
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This