# iOS SDK v6.0.0 Migration Guide

## Installation

#### Manual Installation

AmitySDK 6.x.x version requires `RealmSwift.xcframework` along with existing frameworks.

<figure><img src="https://2352509137-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MX0mOAVWkotGme0iRzu%2Fuploads%2F6PBoBP3NYo0bLu2udzk6%2FScreen%20Shot%202566-01-16%20at%2009.51.20.png?alt=media&#x26;token=6be72f21-d2b6-4509-9878-368c3113965f" alt=""><figcaption></figcaption></figure>

### Behaviour Changes

#### Channel

* Channel Creation

Support for Providing custom ID when creating channel is now removed.

* Sub Channels:

Now you can create multiple sub-channels inside a channel. Each Sub Channels acts as a separate container for message. The channel itself would act as a default Sub Channel. You can access this default sub channel id through `defaultSubChannelId` property in class `AmityChannel`.

#### Messages

Sending a message in a Channel or Sub Channel now requires `subchannelId`. If you want to send message in default subchannel (i.e the default channel itself), please use `defaultSubChannelId` property from `AmityChannel`.

For sending message in particular AmitySubchannel, you can get its id from `subChannelId` property.

#### Interface Changes:

* `@objc` support for all interfaces such as classes, enums, methods, and properties are removed. Please create a swift wrapper class to interact with the SDK if your project still uses Objective-C.

Please refer to [Using social.plus SDK with ObjectiveC](https://docs.social.plus/getting-started/installation-and-authentication/install-ios-sdk#using-amitysdk-with-objective-c-code) section of the documentation for more details.

* All Enums with rawType `UInt` has been changed to `Int`
* Swift classes

**AmityCollection**

| Property \| Methods     | Changes           |
| ----------------------- | ----------------- |
| count() `→` `UInt`      | count() `→ Int`   |
| `object(atIndex: UInt)` | `object(at: Int)` |

#### AmityReaction

| Property \| Methods | Changes     |
| ------------------- | ----------- |
| `createdAtDate`     | `createdAt` |

#### AmityClient

<table><thead><tr><th width="287">Property | Methods</th><th width="202" align="center">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>clientErrorDelegate</code></td><td align="center">Removed</td><td>Use <code>delegate</code> instead</td></tr><tr><td><code>connectionStatus</code></td><td align="center">Removed</td><td>Use <code>sessionState</code> instead</td></tr><tr><td>AmityRegionalEndpoint</td><td align="center">Removed</td><td>Use <code>AmityRegion</code> instead</td></tr><tr><td><code>init(apiKey:, httpUrl:, socketUrl:_)</code></td><td align="center">Removed</td><td>Use <code>init(apiKey:_, region: _)</code> instead</td></tr><tr><td><code>init(apiKey:, url:)</code></td><td align="center">Removed</td><td>Use <code>init(apiKey_, endpoint:_)</code></td></tr><tr><td><code>login(userId:</code><em><code>, displayName:</code></em><code>,authToken:</code><em><code>,</code></em><code>completion</code><em><code>:</code></em><code>)</code></td><td align="center">Removed</td><td>Use <code>login(userId:</code><em><code>,displayName:</code></em><code>,authToken:</code><em><code>,sessionHandler:</code></em><code>) async</code> instead</td></tr></tbody></table>

#### AmityContentSettings

| Property \| Methods | Changes | Remarks               |
| ------------------- | ------- | --------------------- |
| `chat`              | Removed | Use `message` instead |

#### Channel

| Property \| Methods           | Changes                      | Remarks                                                                                                                 |
| ----------------------------- | ---------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| totalUnreadCount: `UInt`      | Removed                      | New property `totalDefaultSubChannelUnreadCount: Int` is introduced which provides unread count for default subchannel. |
| `AmityChannelBuilderProtocol` | Renamed                      | Use AmityChannelBuilder instead.                                                                                        |
| `class AmityChannelQueryType` | `enum AmityChannelQueryType` | Class is changed to Enum                                                                                                |

#### AmityChannel

| Property \| Methods | Changes                                       | Remarks |
| ------------------- | --------------------------------------------- | ------- |
| `unreadCount`       | Renamed → `defaultSubChannelUnreadCount`      |         |
| `hasMention`        | Renamed → `defaultSubChannelHasUnreadMention` |         |

#### AmityChannelParticipation

| Property \| Methods | Changes | Remarks                                   |
| ------------------- | ------- | ----------------------------------------- |
| `startReading()`    | Removed | Use `startReading(subChannelId:)` instead |
| `stopReading`       | Removed | Use `stopReading(subChannelId:)` instead  |

#### AmityMessage

| Property \| Methods    | Changes               | Remarks                               |
| ---------------------- | --------------------- | ------------------------------------- |
| `isMessageEdited`      | Removed               | Use `isEdited` instead                |
| `AmityMessageReactor`  | Removed               | Use `AmityReactionRepository` instead |
| `createdAtDate`        | Renamed → createdAt   |                                       |
| `editedAtDate`         | Renamed → editedAt    |                                       |
| flagCount: `UInt`      | flagCount: `Int`      |                                       |
| `reactionsCount: UInt` | `reactionCount: UInt` |                                       |
| readByCount: `UInt`    | readByCount: `Int`    |                                       |
| childrenNumber: `UInt` | childrenNumber: `Int` |                                       |
| channelSegment: `UInt` | channelSegment: `Int` |                                       |

#### AmityMessageRepository

<table><thead><tr><th width="327">Property | Methods</th><th width="113.33333333333331">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>createCustomMessage(withChannelId:_,...) → String</code></td><td>Removed</td><td>Use <code>createCustomMessage(options:</code><em><code>, completion:</code></em><code>)</code> instead</td></tr><tr><td><code>createTextMessage(withChannelId:_,...) → String</code></td><td>Removed</td><td>Use <code>createTextMessage(options:, completion:_)</code> instead</td></tr><tr><td><code>createTextMessage(withChannelId:</code><em><code>, …, mentionees:</code></em><code>, ..)</code></td><td>Removed</td><td>Use <code>createTextMessage(options:, completion:_)</code> instead</td></tr><tr><td><code>createAudioMessage(withChannelId:_,…) → String</code></td><td>Removed</td><td>Use <code>createAudioMessage(options:, completion:_)</code> instead</td></tr><tr><td><code>createImageMessage(withChannelId:_,…) → String</code></td><td>Removed</td><td>Use <code>createImageMessage(options:, completion:_)</code> instead</td></tr><tr><td><code>createFileMessage(withChannelId:_,…) → String</code></td><td>Removed</td><td>Use <code>createFileMessage(options:, completion:_)</code> instead</td></tr><tr><td><code>createVideoMessage(withChannelId:_,…) → String</code></td><td>Removed</td><td>Use <code>createVideoMessage(options:, completion:_)</code> instead</td></tr></tbody></table>

#### AmityMessageEditor

| Property \| Methods                                               | Changes | Remarks                                                                       |
| ----------------------------------------------------------------- | ------- | ----------------------------------------------------------------------------- |
| `edittext(_ text: String, completion:....)`                       | Removed | Use `edittext(_ text: String, metaData, mentionees, completion:....)` instead |
| `edittext(_ text: String, metaData, mentionees, completion:....)` | Changed | Parameter `metaData` and `metionees` are now nil by default.                  |

#### AmityPost

| Property \| Methods                                | Changes                      | Remarks                                                      |
| -------------------------------------------------- | ---------------------------- | ------------------------------------------------------------ |
| childrenPosts: `[AmityPost]?`                      | childrenPosts: `[AmityPost]` | property is Non-optional                                     |
| `getVideoInfo(for quality: AmityVideoDataQuality)` | Removed                      | Use `getVideoInfo() → AmityVideoData?`                       |
| `getVideosInfo()`                                  | Removed                      | Use `getVideoInfo() → AmityVideoData?`                       |
| `availableVideoQuality()`                          | Removed                      | Use `availableResolution() → [AmityVideoResolution]` instead |
| commentsCount: `UInt`                              | commentsCount: `Int`         |                                                              |
| flagCount: `UInt`                                  | flagCount: `Int`             |                                                              |
| reactionsCount: `UInt`                             | reactionsCount: `Int`        |                                                              |
| sharedCount: `UInt`                                | sharedCount: `Int`           |                                                              |

#### AmityPollRepository

<table><thead><tr><th width="275.3333333333333">Property | Methods</th><th width="129">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>AmityPollCreateBuilder</code></td><td>Renamed</td><td>Use <code>AmityPollCreateOptions</code></td></tr><tr><td><code>createPoll(_ builder: AmityPollBuilder,:_)</code></td><td>Renamed</td><td>Use <code>createPoll(_ options: AmityPollCreateOptions)</code></td></tr></tbody></table>

#### AmityPoll

| Property \| Methods | Changes          |
| ------------------- | ---------------- |
| voteCount: `UInt`   | voteCount: `Int` |
| closedIn: `UInt`    | closedIn: `Int`  |

#### AmityPollAnswer

| Property \| Methods | Changes          |
| ------------------- | ---------------- |
| voteCount: `UInt`   | voteCount: `Int` |

#### AmityPostRepository

<table><thead><tr><th>Property | Methods</th><th width="128.33333333333331">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>getPostForPostId(_:)</code></td><td>Renamed</td><td><code>getPost(withId:_)</code></td></tr><tr><td><code>approvePost(withPostId:</code><em><code>,:</code></em><code>)</code></td><td>Renamed</td><td><code>approvePost(withId:</code><em><code>,:</code></em><code>)</code></td></tr><tr><td><code>declinePost(withPostId:</code><em><code>,:</code></em><code>)</code></td><td>Renamed</td><td><code>declinePost(withId:</code><em><code>,:</code></em><code>)</code></td></tr><tr><td><code>deletePost(withPostId:</code><em><code>,:</code></em><code>)</code></td><td>Renamed</td><td><code>deletePost(withId:</code><em><code>,:</code></em><code>)</code></td></tr><tr><td><code>updatePost(withPostId:</code><em><code>,:</code></em><code>)</code></td><td>Renamed</td><td><code>updatePost(withId:</code><em><code>,:</code></em><code>)</code></td></tr></tbody></table>

#### AmityFeedRepository

<table><thead><tr><th>Property | Methods</th><th width="135.33333333333331">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>createPost</code></td><td>Removed</td><td>Use equivalent method from <code>AmityPostRepository</code></td></tr><tr><td><code>updatePost</code></td><td>Removed</td><td>Use equivalent method from <code>AmityPostRepository</code></td></tr><tr><td><code>deletePost</code></td><td>Removed</td><td>Use equivalent method from <code>AmityPostRepository</code></td></tr><tr><td><code>approvePost</code></td><td>Removed</td><td>Use equivalent method from <code>AmityPostRepository</code></td></tr><tr><td><code>declinePost</code></td><td>Removed</td><td>Use equivalent method from <code>AmityPostRepository</code></td></tr><tr><td><code>getReactions</code></td><td>Removed</td><td>Use equivalent method from <code>AmityPostRepository</code></td></tr><tr><td><code>getPostForPostId</code></td><td>Removed</td><td>Use equivalent method from <code>AmityPostRepository</code></td></tr></tbody></table>

#### AmityCommunityRepository

<table><thead><tr><th>Property | Methods</th><th width="118.33333333333331">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>addRole</code></td><td>Removed</td><td>Use <code>addRoles</code> instead</td></tr><tr><td><code>removeRole</code></td><td>Removed</td><td>Use <code>removeRoles</code> instead</td></tr><tr><td><code>AmityCommunityCreateDataBuilder</code></td><td>Removed</td><td><code>AmityCommunityCreateOptions</code></td></tr><tr><td><code>AmityCommunityUpdateDataBuilder</code></td><td>Removed</td><td><code>AmityCommunityCreateOptions</code></td></tr><tr><td><code>createCommunity(with builder: AmityCommunityBuilder,:_)</code></td><td>Removed</td><td><code>createCommunity(with options: AmityCommunityCreateOptions)</code></td></tr><tr><td><code>updateCommunity(withId:</code><em><code>, builder: AmityCommunityBuilder,:</code></em><code>)</code></td><td>Removed</td><td><code>updateCommunity(withId:</code><em><code>, options: AmityCommunityUpdateOptions, :</code></em><code>)</code></td></tr><tr><td><code>getCommunities(displayName:,:_)</code></td><td>Removed</td><td>Use <code>getCommunities(with options: AmityCommunityQueryOptions)</code></td></tr></tbody></table>

#### AmityCommunity

| Property \| Methods  | Changes             |
| -------------------- | ------------------- |
| postsCount: `UInt`   | postsCount: `Int`   |
| membersCount: `UInt` | membersCount: `Int` |

#### AmityCommentRepository

<table><thead><tr><th>Property | Methods</th><th width="147.33333333333331">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>getCommentWithReferenceId(_:)</code></td><td>Removed</td><td>Use new method <code>getCommments(options: AmityCommentQueryOptions)</code></td></tr><tr><td><code>createComment(forReferenceId:_,: _)</code></td><td>Removed</td><td>Use new method <code>createComment(with options: AmityCommentCreateOptions)</code></td></tr></tbody></table>

#### AmityComment

| Property \| Methods    | Changes               | Remarks |
| ---------------------- | --------------------- | ------- |
| flagCount: `UInt`      | flagCount: `Int`      |         |
| childrenNumber: `UInt` | childrenNumber: `Int` |         |
| reactionsCount: `UInt` | reactionsCount: `Int` |         |

#### AmityUser

| Property \| Methods | Changes                    |
| ------------------- | -------------------------- |
| flagCount: `UInt`   | flagCount: `Int`           |
| `isGlobalBan`       | Renamed → `isGlobalBanned` |

#### AmityUserFollowManager

<table><thead><tr><th>Property | Methods</th><th width="108.33333333333331">Changes</th><th>Remarks</th></tr></thead><tbody><tr><td><code>getMyFollowInfo(:</code><em><code>,completion:</code></em><code>)</code></td><td>Removed</td><td>Use <code>getMyFollowInfo(_:) → AmityObject</code> which returns Live Object</td></tr><tr><td><code>getUserFollowInfo(:</code><em><code>,completion:</code></em><code>)</code></td><td>Removed</td><td>Use <code>userFollowInfo(_:) → AmityObject</code> which returns Live Object</td></tr></tbody></table>
