Skip to content
Snippets Groups Projects
RadioTextComponent.swift 860 B
Newer Older
Bruno Muniz's avatar
Bruno Muniz committed
import UIKit
import Shared
import AppResources
Bruno Muniz's avatar
Bruno Muniz committed

final class RadioTextComponent: UIView {
  let titleLabel = UILabel()
  let radioButton = RadioButton()
  var isEnabled: Bool = false {
    didSet { radioButton.set(enabled: isEnabled) }
  }
  init() {
    super.init(frame: .zero)
    titleLabel.numberOfLines = 0
    titleLabel.textColor = Asset.neutralWhite.color
    titleLabel.font = Fonts.Mulish.regular.font(size: 13.0)
    addSubview(titleLabel)
    addSubview(radioButton)
    titleLabel.snp.makeConstraints {
      $0.left.equalTo(radioButton.snp.right).offset(7)
      $0.centerY.equalTo(radioButton)
      $0.right.equalToSuperview()
    radioButton.snp.makeConstraints {
      $0.left.equalToSuperview()
      $0.top.greaterThanOrEqualToSuperview()
      $0.bottom.equalToSuperview()
  }

  required init?(coder: NSCoder) { nil }