Chat / iOS
Chat iOS v4
Chat iOS
Chat
iOS
Home
/
Chat
/
iOS
/
Message
This is the new Docs for Chat SDK v4 for iOS. To see the previous Docs, click here.

Update a poll

You can update a poll by creating and passing a PollUpdateParams object as an argument to the parameter in the updatePoll() method.

let params = PollUpdateParams()
params.title = "New poll title"
params.text = "Poll description"
params.allowMultipleVotes = true
params.allowUserSuggestion = true
params.isAnonymous = true
params.closeAt = -1 // If the value of this property is `-1`, the poll status remains open.

channel.updatePoll(pollId: poll.pollId, params: params) { poll, error in
    
}

PollUpdateParams

Parameter nameTypeDescription

title

string

Specifies the title of a poll.

data

PollData

Specifies an additional data to accompany the poll. A use case might be to provide explanations for incorrect quiz answers.

isAnonymous

Bool

Determines whether to make votes anonymous. (Default: false)

allowUserSuggestion

Bool

Determines whether to allow users to make suggestions. (Default: false)

allowMultipleVotes

Bool

Determines whether to allow users to vote on more than one poll options. (Default: false)

closeAt

Int64

Specifies the time when a poll has closed or will close in Unix seconds. If the value of this property is -1, the poll status remains open meaning that the poll will never close..

PollHandler

Through PollHandler, the Sendbird server always notifies whether your poll has been successfully retrieved.

public typealias PollHandler = (_ poll: Poll?, _ error: SBError?) -> Void