# Migrate your Chat iOS SDK to Conversations

> \[!NOTE]
>
> 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](/docs/conversations/migrating-chat-conversations) that covers the high-level changes and new APIs in Conversations.

## Update your CocoaPods or Carthage dependency

## CocoaPods

```ruby
# Replace

pod "TwilioChatClient"

# with

pod "TwilioConversationsClient"

```

## Carthage

```ruby
# Replace

github "twilio/twilio-chat-ios"

# with

github "twilio/conversations-ios"
```

## Rename project imports

## Swift

```swift
import TwilioChatClient

// becomes

import TwilioConversationsClient

```

## Objective-C

```bash
# import "TwilioChatClient.h"

// becomes

# import "TwilioConversationsClient.h"
```

## Rename entities

* `TCHTwilioChatClient` becomes `TCHTwilioConversationsClient`
* `TCHChannel` becomes `TCHConversation`
* `TCHMember` becomes `TCHParticipant`
* `TCHClientSynchronizationStatusChannelsListCompleted` becomes `TCHClientSynchronizationStatusConversationsListCompleted`

## Refactor method calls

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

### Client

## Swift

```swift
TwilioChatClient.chatClient(withToken:properties:delegate:completion:)

// becomes

TwilioConversationsClient.conversationsClient(withToken:properties:delegate:completion:)


```

## Objective-C

```bash
[TwilioChatClient chatClientWithToken:properties:delegate:completion:]

// becomes

[TwilioConversationsClient conversationsClientWithToken:properties:delegate:completion:]
```

### Users

## Swift

```swift
TwilioChatClient.users.subscribedUser(withIdentity:completion:)

// becomes

TwilioConversationsClient.subscribedUser(withIdentity:completion:)

```

## Objective-C

```bash
[TwilioChatClient.users subscribedUserWithIdentity:completion:]

// becomes

[TwilioConversationsClient.subscribedUserWithIdentity:completion:]
```

### Channel

## Swift

```swift
Channel.member(withIdentity:)

// becomes

Conversation.participant(withIdentity:)

```

## Objective-C

```bash
[Channel memberWithIdentity:]

// becomes

[Channel participantWithIdentity:]
```

### Channels

## Swift

```swift
TwilioChatClient.channels.subscribedChannels()
// becomes
TwilioConversationsClient.myConversations()

//-------------------------------------------------------------

TwilioChatClient.channels.createChannel(options:completion:)
// becomes
TwilioConversationsClient.createConversation(options:completion:)

//-------------------------------------------------------------

TwilioChatClient.channels.channel(withSidOrUniqueName:completion:)
// becomes
TwilioConversationsClient.conversation(withSidOrUniqueName:completion:)

```

## Objective-C

```bash
[TwilioChatClient.channels subscribedChannels]
// becomes
[TwilioConversationsClient myConversations]

//-------------------------------------------------------------

[TwilioChatClient.channels createChannelWithOptions:completion]
// becomes
[TwilioConversationsClient createConversationWithOptions:completion:]

//-------------------------------------------------------------

[TwilioChatClient.channels channelWithSidOrUniqueName:completion]
// becomes
[TwilioConversationsClient conversationsWithSidOrUniqueName:completion:]
```

### Members

## Swift

```swift
Channel.members.members(completion:)
// becomes
Conversation.participants()

//-------------------------------------------------------------

Channel.members.add(byIdentity:completion:)
// becomes
Conversation.addParticipant(byIdentity:attributes:completion:)

//-------------------------------------------------------------

Channel.members.remove(_:completion:)
// becomes
Conversation.removeParticipant(_:completion:)

```

## Objective-C

```bash
[Channel.members membersList]
// becomes
[Conversation participants]

//-------------------------------------------------------------

[Channel.members addByIdentity:completion:]
// becomes
[Conversation addParticipantByIdentity:attributes:completion:]

//-------------------------------------------------------------

[Channel.members removeMember:completion:]
// becomes
[Conversation removeParticipant:completion:]
```

### Messages

## Swift

```swift
Channel.messages. sendMessage(with:completion:)
// becomes
Conversation.sendMessage(with:completion:)

//-------------------------------------------------------------

Channel.messages.removeMessage(_:completion:)
// becomes
Conversation.removeMessage(_:completion:)

//-------------------------------------------------------------

Channel.messages.getLastMessages(withCount:completion:)
// becomes
Conversation.getLastMessages(withCount:completion:)

//-------------------------------------------------------------

Channel.messages.getMessagesBefore(_:withCount:completion:)
// becomes
Conversation.getMessagesBefore(_:withCount:completion:)

//-------------------------------------------------------------

Channel.messages.getMessagesAfter(_:withCount:completion:)
// becomes
Conversation.getMessagesAfter(_:withCount:completion:)

//-------------------------------------------------------------

Channel.messages.message(withIndex:completion:)
// becomes
Conversation.message(withIndex:completion:)

//-------------------------------------------------------------

Channel.messages.message(forConsumptionIndex:completion:)
// becomes
Conversation.message(forReadIndex:completion:)

//-------------------------------------------------------------

Channel.messages.lastConsumedMessageIndex
// becomes
Channel.lastReadMessageIndex

//-------------------------------------------------------------

Channel.messages.setLastConsumedMessageIndex(_:completion:)
// becomes
Conversation.setLastReadMessageIndex(_:completion:)

//-------------------------------------------------------------

Channel.messages.advanceLastConsumedMessageIndex(_:completion:)
// becomes
Conversation.advanceLastReadMessageIndex(_:completion:)

//-------------------------------------------------------------

Channel.messages.setAllMessagesConsumedWithCompletion(_:)
// becomes
Conversation.setAllMessagesReadWithCompletion(_:)

//-------------------------------------------------------------

Channel.messages.setNoMessagesConsumedWithCompletion(_:)
// becomes
Conversation.setAllMessagesUnreadWithCompletion(_:)
```

## Objective-C

```bash
[Channel.messages sendMessageWithOptions:completion:]
// becomes
[Conversation sendMessageWithOptions:completion:]

//-------------------------------------------------------------

[Channel.messages removeMessage:completion:]
// becomes
[Conversation removeMessage:completion:]

//-------------------------------------------------------------

[Channel.messages getLastMessagesWithCount:completion:]
// becomes
[Conversation getLastMessagesWithCount:completion:]

//-------------------------------------------------------------

[Channel.messages getMessagesBefore:withCount:completion:]
// becomes
[Conversation getMessagesBefore:withCount:completion:]

//-------------------------------------------------------------

[Channel.messages getMessagesAfter:withCount:completion:]
// becomes
[Conversation getMessagesAfter:withCount:completion:]

//-------------------------------------------------------------

[Channel.messages messageWithIndex:completion:]
// becomes
[Conversation messageWithIndex:completion:]

//-------------------------------------------------------------

[Channel.messages messageForConsumptionIndex:completion]
// becomes
[Conversation messageForReadIndex:completion:]

//-------------------------------------------------------------

Channel.messages.lastConsumedMessageIndex
// becomes
Conversation.lastReadMessageIndex

//-------------------------------------------------------------

[Channel.messages setLastConsumedMessageIndex:completion:]
// becomes
[Conversation setLastReadMessageIndex:completion:]

//-------------------------------------------------------------

[Channel.messages advanceLastConsumedMessageIndex:completion:]
// becomes
[Conversation advanceLastReadMessageIndex:completion:]

//-------------------------------------------------------------

[Channel.messages setAllMessagesConsumedWithCompletion:]
// becomes
[Conversation setAllMessagesReadWithCompletion:]

//-------------------------------------------------------------

[Channel.messages setNoMessagesConsumedWithCompletion:]
// becomes
[Conversation setAllMessagesUnreadWithCompletion:]
```

## Remove or replace unsupported methods

* `Channels subscribedChannelsSortedBy`
* `Channels userChannelDescriptorsWithCompletion`
* `Channels publicChannelDescriptorsWithCompletion`
* `Members inviteByIdentity:completion:`

## New APIs

## Swift

```swift
// added
Conversation.addParticipant(byAddress:proxyAddress:attributes:completion:)

// added
Conversation.removeParticipant(byIdentity:completion:)

```

## Objective-C

```bash
// added
[Conversation addParticipantByAddress:proxyAddress:attributes:completion:]

// added
[Conversation removeParticipantByIdentity:completion:]
```

## Added aggregated delivery receipts

* You can get delivery receipts for each SMS or WhatsApp message to understand the current status of delivery.

## Added conversation state

Conversations now have state.

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

## Rename consumptionHorizon to readHorizon

* 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`

## Media changes

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

## Swift

```swift
getMediaContentTemporaryUrl(completion:)

```

## Objective-C

```bash
getMediaContentTemporaryUrlWithCompletion:
```

## Other changes

* 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`.
