Poll

public struct Poll : Codable, Hashable, Identifiable, Sendable

Represents a poll attached to a post.

  • Undocumented

    Declaration

    Swift

    public init(id: String,
                expiresAt: Date? = nil,
                expired: Bool,
                multiple: Bool,
                votesCount: Int,
                votersCount: Int? = nil,
                voted: Bool? = nil,
                ownVotes: [Int]? = nil,
                options: [Poll.Option],
                emojis: [Emoji])
  • id

    The ID of the poll in the database.

    Declaration

    Swift

    public var id: String
  • When the poll ends.

    Declaration

    Swift

    public var expiresAt: Date?
  • Is the poll currently expired?

    Declaration

    Swift

    public var expired: Bool
  • Does the poll allow multiple-choice answers?

    Declaration

    Swift

    public var multiple: Bool
  • How many votes have been received.

    Declaration

    Swift

    public var votesCount: Int
  • How many unique accounts have voted on a multiple-choice poll.

    Declaration

    Swift

    public var votersCount: Int?
  • When called with a user token, has the authorized user voted?

    Declaration

    Swift

    public var voted: Bool?
  • When called with a user token, which options has the authorized user chosen? Contains an array of index values for options.

    Declaration

    Swift

    public var ownVotes: [Int]?
  • Possible answers for the poll.

    Declaration

    Swift

    public var options: [Option]
  • Custom emoji to be used for rendering poll options.

    Declaration

    Swift

    public var emojis: [Emoji]
  • Undocumented

    See more

    Declaration

    Swift

    public struct Option : Codable, Hashable, Sendable