---
source_url: https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/message-draft
title: MessageDraft object
updated_at: 2026-06-16T12:48:56.406Z
---

> Documentation Index
> For a curated overview of PubNub documentation, see: https://www.pubnub.com/docs/llms.txt
> For the full list of all documentation pages, see: https://www.pubnub.com/docs/llms-full.txt


# MessageDraft object

`MessageDraft` represents a message that has not been published yet. Use drafts to add user mentions, channel references, URLs, and files before sending.

## Properties

The `MessageDraft` object has the following properties:

```swift
extension MessageDraftImpl: MessageDraft {
    public var channel: ChannelImpl
    public var isTypingIndicatorTriggered: Bool
    public var userSuggestionSource: UserSuggestionSource
    public var userLimit: Int
    public var channelLimit: Int
    public var quotedMessage: MessageImpl?
    public var files: [InputFile]
}
```

| Parameter | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| channel | ChannelImpl | Optional |  | [Channel](https://www.pubnub.com/docs/chat/swift-chat-sdk/learn/chat-entities/channel) where this Message Draft will be published. |
| isTypingIndicatorTriggered | Bool | Optional |  | This parameter refers to the [Typing Indicator](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/channels/typing-indicator) feature. Defines if the typing indicator should be enabled when writing the message. |
| userSuggestionSource | UserSuggestionSource | Optional |  | This parameter refers to the [Mentions](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/users/mentions) feature. Data source from which you want to retrieve users. You can choose either the list of channel members (`UserSuggestionSource = .channel`) or users on the app's Admin Portal keyset (`UserSuggestionSource = .global`). |
| userLimit | Int | Optional |  | This parameter refers to the [Mentions](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/users/mentions) feature. Maximum number of usernames (`name` field from the `User` object) you can mention in one message. The default value is `10`, the min is `1`, and max is `100`. |
| channelLimit | Int | Optional |  | This parameter refers to the [References](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/channels/references) feature. Maximum number of channel names (`name` field from the `Channel` object) you can reference in one message. The default value is `10`, the min is `1`, and max is `100`. |
| quotedMessage | MessageImpl | Optional |  | Object added to a draft message when you [quote another message](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/quotes). |
| files | [InputFile] | Optional |  | One or multiple files attached to the draft text message. |

## Methods

You can call the following methods on the `MessageDraft` object.

Click on each method for more details.

* [addChangeListener()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#add-message-draft-change-listener)
* [removeChangeListener()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#remove-message-draft-change-listener)
* [addMention()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#add-message-element)
* [removeMention()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#remove-message-element)
* [insertText()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#insert-message-text)
* [removeText()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#remove-message-text)
* [insertSuggestedMention()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#insert-suggested-message-element)
* [send(params:)](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#send-a-draft-message)
* [update()](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#update-message-text)

## Use case

`MessageDraft` methods enable users to prepare [draft messages](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/drafts#create-a-draft-message) with:

* [Links](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/messages/links)
* [User mentions](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/users/mentions) with `@`
* [Channel references](https://www.pubnub.com/docs/chat/swift-chat-sdk/build/features/channels/references) with `#`