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.
CocoaPodsCarthage
1# Replace23pod "TwilioChatClient"45# with67pod "TwilioConversationsClient"8
SwiftObjective-C
1import TwilioChatClient23// becomes45import TwilioConversationsClient6
TCHTwilioChatClient
becomesTCHTwilioConversationsClient
TCHChannel
becomesTCHConversation
TCHMember
becomesTCHParticipant
TCHClientSynchronizationStatusChannelsListCompleted
becomesTCHClientSynchronizationStatusConversationsListCompleted
Intermediate accessor objects were removed so your code will look cleaner.
SwiftObjective-C
1TwilioChatClient.chatClient(withToken:properties:delegate:completion:)23// becomes45TwilioConversationsClient.conversationsClient(withToken:properties:delegate:completion:)67
SwiftObjective-C
1TwilioChatClient.users.subscribedUser(withIdentity:completion:)23// becomes45TwilioConversationsClient.subscribedUser(withIdentity:completion:)6
SwiftObjective-C
1Channel.member(withIdentity:)23// becomes45Conversation.participant(withIdentity:)6
SwiftObjective-C
1TwilioChatClient.channels.subscribedChannels()2// becomes3TwilioConversationsClient.myConversations()45//-------------------------------------------------------------67TwilioChatClient.channels.createChannel(options:completion:)8// becomes9TwilioConversationsClient.createConversation(options:completion:)1011//-------------------------------------------------------------1213TwilioChatClient.channels.channel(withSidOrUniqueName:completion:)14// becomes15TwilioConversationsClient.conversation(withSidOrUniqueName:completion:)16
SwiftObjective-C
1Channel.members.members(completion:)2// becomes3Conversation.participants()45//-------------------------------------------------------------67Channel.members.add(byIdentity:completion:)8// becomes9Conversation.addParticipant(byIdentity:attributes:completion:)1011//-------------------------------------------------------------1213Channel.members.remove(_:completion:)14// becomes15Conversation.removeParticipant(_:completion:)16
SwiftObjective-C
1Channel.messages. sendMessage(with:completion:)2// becomes3Conversation.sendMessage(with:completion:)45//-------------------------------------------------------------67Channel.messages.removeMessage(_:completion:)8// becomes9Conversation.removeMessage(_:completion:)1011//-------------------------------------------------------------1213Channel.messages.getLastMessages(withCount:completion:)14// becomes15Conversation.getLastMessages(withCount:completion:)1617//-------------------------------------------------------------1819Channel.messages.getMessagesBefore(_:withCount:completion:)20// becomes21Conversation.getMessagesBefore(_:withCount:completion:)2223//-------------------------------------------------------------2425Channel.messages.getMessagesAfter(_:withCount:completion:)26// becomes27Conversation.getMessagesAfter(_:withCount:completion:)2829//-------------------------------------------------------------3031Channel.messages.message(withIndex:completion:)32// becomes33Conversation.message(withIndex:completion:)3435//-------------------------------------------------------------3637Channel.messages.message(forConsumptionIndex:completion:)38// becomes39Conversation.message(forReadIndex:completion:)4041//-------------------------------------------------------------4243Channel.messages.lastConsumedMessageIndex44// becomes45Channel.lastReadMessageIndex4647//-------------------------------------------------------------4849Channel.messages.setLastConsumedMessageIndex(_:completion:)50// becomes51Conversation.setLastReadMessageIndex(_:completion:)5253//-------------------------------------------------------------5455Channel.messages.advanceLastConsumedMessageIndex(_:completion:)56// becomes57Conversation.advanceLastReadMessageIndex(_:completion:)5859//-------------------------------------------------------------6061Channel.messages.setAllMessagesConsumedWithCompletion(_:)62// becomes63Conversation.setAllMessagesReadWithCompletion(_:)6465//-------------------------------------------------------------6667Channel.messages.setNoMessagesConsumedWithCompletion(_:)68// becomes69Conversation.setAllMessagesUnreadWithCompletion(_:)
Channels subscribedChannelsSortedBy
Channels userChannelDescriptorsWithCompletion
Channels publicChannelDescriptorsWithCompletion
Members inviteByIdentity:completion:
SwiftObjective-C
1// added2Conversation.addParticipant(byAddress:proxyAddress:attributes:completion:)34// added5Conversation.removeParticipant(byIdentity:completion:)6
- You can get delivery receipts for each SMS or WhatsApp message to understand the current status of delivery.
Conversations now have state.
- Added update reason
TCHConversationUpdateState
. - Current state of conversation you can get by calling
Conversation.state()
- Update reasons
TCHChannelUpdateLastConsumedMessageIndex
becomesTCHConversationUpdateLastReadMessageIndex
TCHParticipantUpdateLastConsumedMessageIndex
becomesTCHParticipantUpdateLastReadMessageIndex
TCHParticipantUpdateLastConsumedTimestamp
becomesTCHParticipantUpdateLastReadTimestamp
Channel.getUnconsumedMessagesCountWithCompletion
becomesConversation.getUnreadMessagesCountWithCompletion
Member.lastConsumedMessageIndex
becomesParticipant.lastReadMessageIndex
Member.lastConsumptionTimestamp
becomesParticipant.lastReadTimestamp
Member.lastConsumptionTimestampAsDate
becomesParticipant.lastReadTimestampAsDate
There are no more streams used to download media. Instead, you'll retrieve a temporary data URL to download it.
SwiftObjective-C
1getMediaContentTemporaryUrl(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 frommyConversations
. TCHChannelDescriptor
,TCHUserDescriptor
were removed. UseTCHConversation
andTCHUser
objects instead.- Paginators were removed
- Invites are not supported by Conversations SDK. Use
addParticipantByIdentity
andaddParticipantByAddress
instead. TCHConversationStatus
could be now eitherjoined
ornotParticipating
.