// // StatusEditPollView.swift // Tusker // // Created by Shadowfacts on 5/11/23. // Copyright © 2023 Shadowfacts. All rights reserved. // import UIKit import Pachyderm class StatusEditPollView: UIStackView { init() { super.init(frame: .zero) axis = .vertical alignment = .leading spacing = 4 } required init(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } func updateUI(poll: StatusEdit.Poll?, emojis: [Emoji]) { arrangedSubviews.forEach { $0.removeFromSuperview() } for option in poll?.options ?? [] { // the edit poll doesn't actually include the multiple value let icon = PollOptionCheckboxView(multiple: false) icon.readOnly = false // this is a lie, but it's only used for stylistic changes let label = EmojiLabel() label.text = option.title label.setEmojis(emojis, identifier: Optional.none) let stack = UIStackView(arrangedSubviews: [ icon, label, ]) stack.axis = .horizontal stack.alignment = .center stack.spacing = 8 addArrangedSubview(stack) } } }