Poll Display Widget
Overview
LMFeedDisplayPollOptionWidget represents a widget for displaying individual poll options and their associated information.
File Location:
LMFeedDisplayPollOptionWidget.swift
UI Elements:
outerStackView: A LMFeedStackView that holds the entire content of the widgetprogressView: A LMFeedProgressView that shows the vote percentagevoteCountContainer: A LMFeedView that contains the vote count buttonvoteCount: A LMFeedButton that displays the vote countinnerContainerView: A LMFeedView that holds the poll option text and added by labelcheckmarkIcon: An LMFeedImageView that displays a checkmark if the option is selected
Data Variables:
selectedPollColor: The color used for selected poll optionsnotSelectedPollColor: The color used for non-selected poll optionsdelegate: The delegate that conforms to LMFeedDisplayPollOptionWidgetProtocoloptionID: The identifier of the poll option
Methods:
configure(with data: ContentModel, delegate: LMFeedDisplayPollOptionWidgetProtocol?): configures the widget with data from a ContentModel instance and sets the delegate.
Customisation:
CustomDisplayPollWidget.swift
class CustomDisplayPollWidget: LMFeedDisplayPollOptionWidget {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.pollDisplayWidget = CustomDisplayPollWidget.self
// ...
return true
}