Create Poll Display
Overview
LMFeedCreateDisplayPollView is used for displaying poll preview during Post Creation or Edit Screen
File Location:
LMFeedCreateDisplayPollView.swift
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 LMFeedStackView containing the question and action buttonscrossButton: A LMFeedButton for removing the polleditButton: A LMFeedButton for editing the poll
Data Variables
delegate: Instance ofLMFeedCreatePollViewProtocolfor handling button actions
Actions
onTapCrossButton(): Calls the delegate methodonTapCrossButton()when the cross button is tapped.onTapEditButton(): Calls the delegate methodonTapEditButtonwhen 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
}