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.
File Location:
LMChatCreatePollViewController.swift
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: Handles user interactions with poll options.LMChatCreatePollMetaViewLMChatGeneralPickerProtocolLMChatTimePickerProtocol
UI Components
containerView: AnLMViewthat serves as the main container.containerScrollView: AUIScrollViewfor scrollable content.containerStackView: AnLMStackViewthat holds the main UI elements.pollQuestionHeaderView: AnLMChatCreatePollHeaderfor the poll question.pollOptionView: AnLMChatCreatePollQuestionViewfor poll options.pollExpiryDateView: AnLMChatCreatePollDateViewfor setting the poll expiry date.pollMetaOptionsView: AnLMChatCreatePollMetaViewfor additional poll settings.advancedOptionButton: AnLMButtonfor 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
}