Create Poll Display
Overview
LMFeedCreateDisplayPollView
is used for displaying poll preview during Post Creation or Edit Screen
Protocol
LMFeedCreatePollViewProtocol
A protocol defining the interactions for a poll creation view.
onTapCrossButton()
: Called when the cross button is tapped.onTapEditButton()
: Called when the edit button is tapped.
UI Elements
questionStackView
: A horizontal stack view containing the question and action buttonscrossButton
: A button for removing the polleditButton
: A button for editing the poll
Data Variables
delegate
: Instance ofLMFeedCreatePollViewProtocol
for handling button actions
Actions
onTapCrossButton()
: Calls the delegate methodonTapCrossButton()
when the cross button is tapped.onTapEditButton()
: Calls the delegate methodonTapEditButton
when the edit button is tapped.
Methods
configure(with data: ContentModel, delegate: LMFeedCreatePollViewProtocol?)
: Configures the view with the given data model and sets the delegate.
Customisation
CustomCreateDisplayPollView.swift
class CustomCreateDisplayPollView: LMFeedCreateDisplayPollView {
override func setupAppearance() {
super.setupAppearance()
containerView.backgroundColor = .green
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.createPollDisplayView = CustomCreateDisplayPollView.self
// ...
return true
}