Poll Display View
Overview
LMFeedDisplayPollView
is a customizable view designed to display poll details and handle user interactions related to poll voting.
Protocol
LMFeedPostPollCellProtocol
A protocol that defines delegate methods for handling actions related to poll interactions.
didTapSubmitVote(for postID: String, pollID: String)
: This function is called when the user taps the submit button to cast their vote in the poll.editVoteTapped(for postID: String, pollID: String)
: This function is called when the user taps the label or button to edit their previously cast vote.didTapVoteCountButton(for postID: String, pollID: String, optionID: String?)
: This function is called when the user taps the button or label to view the vote count for a specific option in the poll.didTapToVote(for postID: String, pollID: String, optionID: String)
: This function is called when the user selects a specific poll option to cast their vote.didTapAddOption(for postID: String, pollID: String)
: This function is called when the user taps the button to add a new option to the poll.
UI Elements
bottomStack
: A vertical stack view to hold the bottom UI elementssubmitButton
: A button for submitting the votebottomMetaStack
: A horizontal stack view to hold metadata labelsanswerTitleLabel
: A label for displaying the answer titleeditVoteLabel
: A label for editing the voteaddOptionButton
: A button for adding a new poll option
Data Varialbes
delegate
: A delegate conforming to the LMFeedPostPollCellProtocolpostID
: The post ID associated with the pollpollID
: The poll ID associated with the poll
Methods
configure(with data: ContentModel, delegate: LMFeedPostPollCellProtocol?)
: Configures the view with the provided content model and delegate.
Customisation
class CustomDisplayPollView: LMFeedDisplayPollView {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.pollDisplayView = CustomDisplayPollView.self
// ...
return true
}