Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

Migrate your Chat iOS SDK to Conversations


(information)

Info

If you are not using >=4.0.0 of our Chat SDK (or later), please follow the appropriate migration guides to get to v4+ before following this guide.

We are happy you decided to migrate your Programmable Chat iOS SDK to Conversations. It is a great decision and this guide will simplify the process a lot. The bulk of the work is primarily renaming, which will be covered here. You should also review this companion guide that covers the high-level changes and new APIs in Conversations.


Update your CocoaPods or Carthage dependency

update-your-cocoapods-or-carthage-dependency page anchor
CocoaPodsCarthage

_10
# Replace
_10
_10
pod "TwilioChatClient"
_10
_10
# with
_10
_10
pod "TwilioConversationsClient"


SwiftObjective-C

_10
import TwilioChatClient
_10
_10
// becomes
_10
_10
import TwilioConversationsClient


  • TCHTwilioChatClient becomes TCHTwilioConversationsClient
  • TCHChannel becomes TCHConversation
  • TCHMember becomes TCHParticipant
  • TCHClientSynchronizationStatusChannelsListCompleted becomes TCHClientSynchronizationStatusConversationsListCompleted

Intermediate accessor objects were removed so your code will look cleaner.

Client

client page anchor
SwiftObjective-C

_10
TwilioChatClient.chatClient(withToken:properties:delegate:completion:)
_10
_10
// becomes
_10
_10
TwilioConversationsClient.conversationsClient(withToken:properties:delegate:completion:)

SwiftObjective-C

_10
TwilioChatClient.users.subscribedUser(withIdentity:completion:)
_10
_10
// becomes
_10
_10
TwilioConversationsClient.subscribedUser(withIdentity:completion:)

SwiftObjective-C

_10
Channel.member(withIdentity:)
_10
_10
// becomes
_10
_10
Conversation.participant(withIdentity:)

SwiftObjective-C

_15
TwilioChatClient.channels.subscribedChannels()
_15
// becomes
_15
TwilioConversationsClient.myConversations()
_15
_15
//-------------------------------------------------------------
_15
_15
TwilioChatClient.channels.createChannel(options:completion:)
_15
// becomes
_15
TwilioConversationsClient.createConversation(options:completion:)
_15
_15
//-------------------------------------------------------------
_15
_15
TwilioChatClient.channels.channel(withSidOrUniqueName:completion:)
_15
// becomes
_15
TwilioConversationsClient.conversation(withSidOrUniqueName:completion:)

SwiftObjective-C

_15
Channel.members.members(completion:)
_15
// becomes
_15
Conversation.participants()
_15
_15
//-------------------------------------------------------------
_15
_15
Channel.members.add(byIdentity:completion:)
_15
// becomes
_15
Conversation.addParticipant(byIdentity:attributes:completion:)
_15
_15
//-------------------------------------------------------------
_15
_15
Channel.members.remove(_:completion:)
_15
// becomes
_15
Conversation.removeParticipant(_:completion:)

SwiftObjective-C

_69
Channel.messages. sendMessage(with:completion:)
_69
// becomes
_69
Conversation.sendMessage(with:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.removeMessage(_:completion:)
_69
// becomes
_69
Conversation.removeMessage(_:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.getLastMessages(withCount:completion:)
_69
// becomes
_69
Conversation.getLastMessages(withCount:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.getMessagesBefore(_:withCount:completion:)
_69
// becomes
_69
Conversation.getMessagesBefore(_:withCount:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.getMessagesAfter(_:withCount:completion:)
_69
// becomes
_69
Conversation.getMessagesAfter(_:withCount:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.message(withIndex:completion:)
_69
// becomes
_69
Conversation.message(withIndex:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.message(forConsumptionIndex:completion:)
_69
// becomes
_69
Conversation.message(forReadIndex:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.lastConsumedMessageIndex
_69
// becomes
_69
Channel.lastReadMessageIndex
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.setLastConsumedMessageIndex(_:completion:)
_69
// becomes
_69
Conversation.setLastReadMessageIndex(_:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.advanceLastConsumedMessageIndex(_:completion:)
_69
// becomes
_69
Conversation.advanceLastReadMessageIndex(_:completion:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.setAllMessagesConsumedWithCompletion(_:)
_69
// becomes
_69
Conversation.setAllMessagesReadWithCompletion(_:)
_69
_69
//-------------------------------------------------------------
_69
_69
Channel.messages.setNoMessagesConsumedWithCompletion(_:)
_69
// becomes
_69
Conversation.setAllMessagesUnreadWithCompletion(_:)


Remove or replace unsupported methods

remove-or-replace-unsupported-methods page anchor
  • Channels subscribedChannelsSortedBy
  • Channels userChannelDescriptorsWithCompletion
  • Channels publicChannelDescriptorsWithCompletion
  • Members inviteByIdentity:completion:

SwiftObjective-C

_10
// added
_10
Conversation.addParticipant(byAddress:proxyAddress:attributes:completion:)
_10
_10
// added
_10
Conversation.removeParticipant(byIdentity:completion:)


Added aggregated delivery receipts

added-aggregated-delivery-receipts page anchor
  • You can get delivery receipts for each SMS or WhatsApp message to understand the current status of delivery.

Added conversation state

added-conversation-state page anchor

Conversations now have state.

  • Added update reason TCHConversationUpdateState .
  • Current state of conversation you can get by calling Conversation.state()

Rename consumptionHorizon to readHorizon

rename-consumptionhorizon-to-readhorizon page anchor
  • Update reasons
    • TCHChannelUpdateLastConsumedMessageIndex becomes TCHConversationUpdateLastReadMessageIndex
    • TCHParticipantUpdateLastConsumedMessageIndex becomes TCHParticipantUpdateLastReadMessageIndex
    • TCHParticipantUpdateLastConsumedTimestamp becomes TCHParticipantUpdateLastReadTimestamp
  • Channel.getUnconsumedMessagesCountWithCompletion becomes Conversation.getUnreadMessagesCountWithCompletion
  • Member.lastConsumedMessageIndex becomes Participant.lastReadMessageIndex
  • Member.lastConsumptionTimestamp becomes Participant.lastReadTimestamp
  • Member.lastConsumptionTimestampAsDate becomes Participant.lastReadTimestampAsDate

There are no more streams used to download media. Instead, you'll retrieve a temporary data URL to download it.

SwiftObjective-C

_10
getMediaContentTemporaryUrl(completion:)


  • Public conversations are unavailable for Conversations SDK, conversationWithSidOrUniqueName returns an error if the conversation is public.
  • TCHChannelType is removed.
  • Instead of removed subscribedChannelsSortedBy method simply sort the list returned from myConversations .
  • TCHChannelDescriptor , TCHUserDescriptor were removed. Use TCHConversation and TCHUser objects instead.
  • Paginators were removed
  • Invites are not supported by Conversations SDK. Use addParticipantByIdentity and addParticipantByAddress instead.
  • TCHConversationStatus could be now either joined or notParticipating .

Rate this page: