Poll Cell
Overview
LMFeedPostPollCell
is a subclass of LMPostWidgetTableViewCell designed to display a post with poll content
Protocols
LMFeedPostPollCellProtocol
Conforms to LMPostWidgetTableViewCellProtocol, incorporating functions specific to the poll cell's interactions:
didTapVoteCountButton(for postID: String, pollID: String, optionID: String?)
: Called when the user taps on the vote count button for a poll option within a post.didTapToVote(for postID: String, pollID: String, optionID: String)
: Called when the user taps on a poll option to cast their vote within a post.didTapSubmitVote(for postID: String, pollID: String)
: Called when the user taps on the button to submit their vote for a poll within a post.editVoteTapped(for postID: String, pollID: String)
: Called when the user taps on the button to edit their vote for a poll within a post.didTapAddOption(for postID: String, pollID: String)
: Called when the user taps on the button to add a new option to a poll within a post.
UI Elements
pollPreview
: An instance of LMFeedDisplayPollView used for displaying the link preview within the cell.
Methods
configure(with data: LMFeedPostContentModel, delegate: LMFeedPostPollCellProtocol?)
: Configures the cell with data from an LMFeedPostContentModel instance and sets the delegate.
Customisation
class CustomPollCell: LMFeedPostPollCell {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.pollCell = CustomPollCell.self
// ...
return true
}