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.
1# Replace23pod "TwilioChatClient"45# with67pod "TwilioConversationsClient"8
1import TwilioChatClient23// becomes45import TwilioConversationsClient6
TCHTwilioChatClient
becomes TCHTwilioConversationsClient
TCHChannel
becomes TCHConversation
TCHMember
becomes TCHParticipant
TCHClientSynchronizationStatusChannelsListCompleted
becomes TCHClientSynchronizationStatusConversationsListCompleted
Intermediate accessor objects were removed so your code will look cleaner.
1TwilioChatClient.chatClient(withToken:properties:delegate:completion:)23// becomes45TwilioConversationsClient.conversationsClient(withToken:properties:delegate:completion:)67
1TwilioChatClient.users.subscribedUser(withIdentity:completion:)23// becomes45TwilioConversationsClient.subscribedUser(withIdentity:completion:)6
1Channel.member(withIdentity:)23// becomes45Conversation.participant(withIdentity:)6
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
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
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:
1// added2Conversation.addParticipant(byAddress:proxyAddress:attributes:completion:)34// added5Conversation.removeParticipant(byIdentity:completion:)6
Conversations now have state.
TCHConversationUpdateState
.Conversation.state()
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.
1getMediaContentTemporaryUrl(completion:)2
conversationWithSidOrUniqueName
returns an error if the conversation is public.TCHChannelType
is removed.subscribedChannelsSortedBy
method, sort the list returned from myConversations
.TCHChannelDescriptor
, TCHUserDescriptor
were removed. Use TCHConversation
and TCHUser
objects instead.addParticipantByIdentity
and addParticipantByAddress
instead.TCHConversationStatus
could be now either joined
or notParticipating
.