Poll

@objc(SBDPoll)
public class Poll : NSObject, Codable
extension Poll: Mappable

Represents a poll that users can vote

Since

4.1.0
  • Poll ID

    Declaration

    Swift

    @objc
    public let pollId: Int64
  • Title of this poll

    Declaration

    Swift

    @objc
    public internal(set) var title: String { get }
  • Timestamp when poll was created

    Declaration

    Swift

    @objc
    public let createdAt: Int64
  • Timestamp when poll was changed

    Declaration

    Swift

    @objc
    public internal(set) var updatedAt: Int64 { get }
  • Timestamp when poll was closed

    Declaration

    Swift

    @objc
    public internal(set) var closeAt: Int64 { get }
  • Poll status

    Declaration

    Swift

    @objc
    public internal(set) var status: PollStatus { get }
  • Message ID of the message associated with poll

    Declaration

    Swift

    @objc
    public let messageId: Int64
  • Poll data. currently only text is provided

    Declaration

    Swift

    @objc
    public let data: PollData?
  • Number of users voted this poll

    Declaration

    Swift

    @objc
    public internal(set) var voterCount: Int64 { get }
  • Poll’s Options

    Declaration

    Swift

    @objc
    public internal(set) var options: [PollOption] { get }
  • The name of the user who created the poll

    Declaration

    Swift

    @objc
    public let createdBy: String?
  • Set to true to enable anonymous voting. Default is false

    Declaration

    Swift

    @objc
    public internal(set) var isAnonymous: Bool { get }
  • If Set to true, to enable anonymous voting. Default is false

    Declaration

    Swift

    @objc
    public internal(set) var allowUserSuggestion: Bool { get }
  • If set to true, voting items can be added. Default is false

    Declaration

    Swift

    @objc
    public internal(set) var allowMultipleVotes: Bool { get }
  • An array of ids of the option to vote for. Even if it’s a single choice, it must be included in the array.

    Declaration

    Swift

    @objc
    public let votedPollOptionIds: [Int64]
  • Encodes this object.

    Declaration

    Swift

    public func encode(to encoder: Encoder) throws

    Parameters

    encoder

    Encoder instance

  • Default constructor.

    Declaration

    Swift

    public required init(from decoder: Decoder) throws

    Parameters

    decoder

    Decoder instance

  • Creates a poll with given params.

    Declaration

    Swift

    @objc
    public class func create(
        params: PollCreateParams,
        completionHandler: @escaping PollHandler
    )

    Parameters

    params

    PollCreateParams instance.

    completionHandler

    completion block.

  • Gets a poll.

    Declaration

    Swift

    @objc
    public class func get(
        params: PollRetrievalParams,
        completionHandler: @escaping PollHandler
    )

    Parameters

    params
    completionHandler

    completion block.

  • Initialize with json dictionary

    Declaration

    Swift

    @objc
    public func initWithDictionary(_ json: [String : Any]) -> `Self`?
  • Converts the object into dictionary

    Declaration

    Swift

    @objc
    public func _toDictionary() -> [String : Any]
  • Compares this object with given other object.

    Declaration

    Swift

    public override func isEqual(_ object: Any?) -> Bool

    Parameters

    object

    Any instance

    Return Value

    true if same otherwise false