Poll Display Widget
Overview
LMFeedDisplayPollOptionWidget
represents a widget for displaying individual poll options and their associated information.
UI Elements:
outerStackView
: A stack view that holds the entire content of the widgetprogressView
: A progress view that shows the vote percentagevoteCountContainer
: A view that contains the vote count buttonvoteCount
: A button that displays the vote countinnerContainerView
: A view that holds the poll option text and added by labelcheckmarkIcon
: An image view 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
}