Skip to contentSkip to navigationSkip to topbar
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
1
# Replace
2
3
pod "TwilioChatClient"
4
5
# with
6
7
pod "TwilioConversationsClient"
8

SwiftObjective-C
1
import TwilioChatClient
2
3
// becomes
4
5
import TwilioConversationsClient
6

  • 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
1
TwilioChatClient.chatClient(withToken:properties:delegate:completion:)
2
3
// becomes
4
5
TwilioConversationsClient.conversationsClient(withToken:properties:delegate:completion:)
6
7
SwiftObjective-C
1
TwilioChatClient.users.subscribedUser(withIdentity:completion:)
2
3
// becomes
4
5
TwilioConversationsClient.subscribedUser(withIdentity:completion:)
6
SwiftObjective-C
1
Channel.member(withIdentity:)
2
3
// becomes
4
5
Conversation.participant(withIdentity:)
6
SwiftObjective-C
1
TwilioChatClient.channels.subscribedChannels()
2
// becomes
3
TwilioConversationsClient.myConversations()
4
5
//-------------------------------------------------------------
6
7
TwilioChatClient.channels.createChannel(options:completion:)
8
// becomes
9
TwilioConversationsClient.createConversation(options:completion:)
10
11
//-------------------------------------------------------------
12
13
TwilioChatClient.channels.channel(withSidOrUniqueName:completion:)
14
// becomes
15
TwilioConversationsClient.conversation(withSidOrUniqueName:completion:)
16
SwiftObjective-C
1
Channel.members.members(completion:)
2
// becomes
3
Conversation.participants()
4
5
//-------------------------------------------------------------
6
7
Channel.members.add(byIdentity:completion:)
8
// becomes
9
Conversation.addParticipant(byIdentity:attributes:completion:)
10
11
//-------------------------------------------------------------
12
13
Channel.members.remove(_:completion:)
14
// becomes
15
Conversation.removeParticipant(_:completion:)
16
SwiftObjective-C
1
Channel.messages. sendMessage(with:completion:)
2
// becomes
3
Conversation.sendMessage(with:completion:)
4
5
//-------------------------------------------------------------
6
7
Channel.messages.removeMessage(_:completion:)
8
// becomes
9
Conversation.removeMessage(_:completion:)
10
11
//-------------------------------------------------------------
12
13
Channel.messages.getLastMessages(withCount:completion:)
14
// becomes
15
Conversation.getLastMessages(withCount:completion:)
16
17
//-------------------------------------------------------------
18
19
Channel.messages.getMessagesBefore(_:withCount:completion:)
20
// becomes
21
Conversation.getMessagesBefore(_:withCount:completion:)
22
23
//-------------------------------------------------------------
24
25
Channel.messages.getMessagesAfter(_:withCount:completion:)
26
// becomes
27
Conversation.getMessagesAfter(_:withCount:completion:)
28
29
//-------------------------------------------------------------
30
31
Channel.messages.message(withIndex:completion:)
32
// becomes
33
Conversation.message(withIndex:completion:)
34
35
//-------------------------------------------------------------
36
37
Channel.messages.message(forConsumptionIndex:completion:)
38
// becomes
39
Conversation.message(forReadIndex:completion:)
40
41
//-------------------------------------------------------------
42
43
Channel.messages.lastConsumedMessageIndex
44
// becomes
45
Channel.lastReadMessageIndex
46
47
//-------------------------------------------------------------
48
49
Channel.messages.setLastConsumedMessageIndex(_:completion:)
50
// becomes
51
Conversation.setLastReadMessageIndex(_:completion:)
52
53
//-------------------------------------------------------------
54
55
Channel.messages.advanceLastConsumedMessageIndex(_:completion:)
56
// becomes
57
Conversation.advanceLastReadMessageIndex(_:completion:)
58
59
//-------------------------------------------------------------
60
61
Channel.messages.setAllMessagesConsumedWithCompletion(_:)
62
// becomes
63
Conversation.setAllMessagesReadWithCompletion(_:)
64
65
//-------------------------------------------------------------
66
67
Channel.messages.setNoMessagesConsumedWithCompletion(_:)
68
// 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
1
// added
2
Conversation.addParticipant(byAddress:proxyAddress:attributes:completion:)
3
4
// added
5
Conversation.removeParticipant(byIdentity:completion:)
6

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
1
getMediaContentTemporaryUrl(completion:)
2

  • Public conversations are unavailable for Conversations SDK, conversationWithSidOrUniqueName returns an error if the conversation is public.
  • TCHChannelType is removed.
  • Instead of removed subscribedChannelsSortedBy method, 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.

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.