Create Poll Screen
Overview
The LMChatCreatePollViewController
is a view controller that manages the creation of polls. It provides a user interface for inputting poll questions, options, expiry dates, and other poll-related settings.
Functionality
Protocols
LMChatCreatePollViewDelegate
updatePollDetails(with data: LMChatCreatePollDataModel)
: Called when poll creation is complete, passing the final poll data to the delegate.cancelledPollCreation()
: Invoked when the user cancels the poll creation process.
Protocols Implemented
This view controller implements the following protocols:
LMChatCreatePollQuestionViewProtocol
LMChatCreatePollMetaViewProtocol
LMChatGeneralPickerProtocol
LMChatTimePickerProtocol
UI Components
containerView
: AnLMView
that serves as the main container.containerScrollView
: AUIScrollView
for scrollable content.containerStackView
: AnLMStackView
that holds the main UI elements.pollQuestionHeaderView
: AnLMChatCreatePollHeader
for the poll question.pollOptionView
: AnLMChatCreatePollQuestionView
for poll options.pollExpiryDateView
: AnLMChatCreatePollDateView
for setting the poll expiry date.pollMetaOptionsView
: AnLMChatCreatePollMetaView
for additional poll settings.advancedOptionButton
: AnLMButton
for toggling advanced options.
Methods
onTapAdvancedOption()
: Handles taps on the advanced options button.openDatePicker()
: Opens the date picker for poll expiry.didTapDoneButton()
: Handles taps on the done button.dismissPollWidget()
: Dismisses the poll creation view.
Customization
To customize the LMChatCreatePollViewController
, subclass it and override the necessary methods:
CustomCreatePollViewController
class CustomCreatePollViewController: LMChatCreatePollViewController {
override func setupAppearance() {
super.setupAppearance()
// Add custom appearance setup here
}
override func didTapDoneButton() {
super.didTapDoneButton()
// Add custom handling here
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.createPollScreen = CustomCreatePollViewController.self
// ...
return true
}