Skip to main content

Chat Poll View

Overview

The LMChatPollView is responsible for displaying and managing interactive polls. It provides functionality for users to view poll questions, vote on options, submit votes, and interact with poll-related features.

Functionality

Protocols Implemented

UI Components

  • bottomStack: A vertical LMStackView for arranging bottom elements.
  • topStack: A vertical LMStackView for arranging top elements.
  • submitButton: An LMButton for submitting votes.
  • bottomMetaStack: A horizontal LMStackView for bottom metadata.
  • topMetaStack: A horizontal LMStackView for top metadata.
  • answerTitleLabel: An LMLabel for displaying answer information.
  • editVoteButton: An LMButton for editing votes.
  • addOptionButton: An LMButton for adding new poll options.
  • questionAndSelectcount: A vertical LMStackView for question and selection count.

Methods

  • configure(with:delegate:): Configures the view with poll data and sets the delegate.

Customization

CustomChatPollView.swift
class CustomChatPollView: LMChatPollView {
override func setupAppearance() {
super.setupAppearance()
submitButton.backgroundColor = .blue
answerTitleLabel.textColor = .darkGray
}

override func setupLayouts() {
super.setupLayouts()
// Add custom layout constraints here
}
}
AppDelegate.swift
func application(_ application: UIApplication, willFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool {
LMUIComponents.shared.pollDisplayView = CustomChatPollView.self
// ...
return true
}