/ SDKs / iOS
SDKs
Chat SDKs iOS v4
Chat SDKs iOS
Chat SDKs
iOS
Version 4

Update a poll

Copy link

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

Copy link
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

Copy link

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

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