Skip to main content

Poll Cell

Overview

LMFeedPostPollCell is a subclass of LMPostWidgetTableViewCell designed to display a post with poll content

LMFeedPostPollCell

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

Methods

  • configure(with data: LMFeedPostContentModel, delegate: LMFeedPostPollCellProtocol?): Configures the cell with data from an LMFeedPostContentModel instance and sets the delegate.

Customisation

CustomPollCell.swift
class CustomPollCell: LMFeedPostPollCell {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.pollCell = CustomPollCell.self
// ...
return true
}