refactored private var names
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
d988503af0
commit
ed07680965
@ -72,13 +72,13 @@ open class CheckboxBase: Control, Accessable, DataTrackable, BinaryColorable, Er
|
||||
$0.axis = .vertical
|
||||
}
|
||||
|
||||
private var primaryLabel = Label().with {
|
||||
private var label = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.typograpicalStyle = .BoldBodyLarge
|
||||
}
|
||||
|
||||
private var secondaryLabel = Label().with {
|
||||
private var childLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
$0.textPosition = .left
|
||||
$0.typograpicalStyle = .BodyLarge
|
||||
@ -106,8 +106,8 @@ open class CheckboxBase: Control, Accessable, DataTrackable, BinaryColorable, Er
|
||||
|
||||
open var labelAttributedText: NSAttributedString? {
|
||||
didSet {
|
||||
primaryLabel.useAttributedText = !(labelAttributedText?.string.isEmpty ?? true)
|
||||
primaryLabel.attributedText = labelAttributedText
|
||||
label.useAttributedText = !(labelAttributedText?.string.isEmpty ?? true)
|
||||
label.attributedText = labelAttributedText
|
||||
didChange()
|
||||
}
|
||||
}
|
||||
@ -118,8 +118,8 @@ open class CheckboxBase: Control, Accessable, DataTrackable, BinaryColorable, Er
|
||||
|
||||
open var childAttributedText: NSAttributedString? {
|
||||
didSet {
|
||||
secondaryLabel.useAttributedText = !(childAttributedText?.string.isEmpty ?? true)
|
||||
secondaryLabel.attributedText = childAttributedText
|
||||
childLabel.useAttributedText = !(childAttributedText?.string.isEmpty ?? true)
|
||||
childLabel.attributedText = childAttributedText
|
||||
didChange()
|
||||
}
|
||||
}
|
||||
@ -178,8 +178,8 @@ open class CheckboxBase: Control, Accessable, DataTrackable, BinaryColorable, Er
|
||||
mainStackView.addArrangedSubview(errorLabel)
|
||||
selectorStackView.addArrangedSubview(selectorView)
|
||||
selectorStackView.addArrangedSubview(selectorLabelStackView)
|
||||
selectorLabelStackView.addArrangedSubview(primaryLabel)
|
||||
selectorLabelStackView.addArrangedSubview(secondaryLabel)
|
||||
selectorLabelStackView.addArrangedSubview(label)
|
||||
selectorLabelStackView.addArrangedSubview(childLabel)
|
||||
|
||||
let selectorSize = getSelectorSize()
|
||||
selectorHeightConstraint = selectorView.heightAnchor.constraint(equalToConstant: selectorSize.height)
|
||||
@ -204,31 +204,31 @@ open class CheckboxBase: Control, Accessable, DataTrackable, BinaryColorable, Er
|
||||
//add the stackview to hold the 2 labels
|
||||
//top label
|
||||
if let labelText {
|
||||
primaryLabel.surface = surface
|
||||
primaryLabel.disabled = disabled
|
||||
primaryLabel.attributes = labelTextAttributes
|
||||
primaryLabel.text = labelText
|
||||
primaryLabel.isHidden = false
|
||||
label.surface = surface
|
||||
label.disabled = disabled
|
||||
label.attributes = labelTextAttributes
|
||||
label.text = labelText
|
||||
label.isHidden = false
|
||||
} else if labelAttributedText != nil {
|
||||
primaryLabel.isHidden = false
|
||||
label.isHidden = false
|
||||
|
||||
} else {
|
||||
primaryLabel.isHidden = true
|
||||
label.isHidden = true
|
||||
}
|
||||
|
||||
//bottom label
|
||||
if let childText {
|
||||
secondaryLabel.text = childText
|
||||
secondaryLabel.surface = surface
|
||||
secondaryLabel.disabled = disabled
|
||||
secondaryLabel.attributes = childTextAttributes
|
||||
secondaryLabel.isHidden = false
|
||||
childLabel.text = childText
|
||||
childLabel.surface = surface
|
||||
childLabel.disabled = disabled
|
||||
childLabel.attributes = childTextAttributes
|
||||
childLabel.isHidden = false
|
||||
|
||||
} else if childAttributedText != nil {
|
||||
secondaryLabel.isHidden = false
|
||||
childLabel.isHidden = false
|
||||
|
||||
} else {
|
||||
secondaryLabel.isHidden = true
|
||||
childLabel.isHidden = true
|
||||
}
|
||||
selectorStackView.spacing = 12
|
||||
selectorLabelStackView.spacing = 4
|
||||
|
||||
@ -80,11 +80,11 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
||||
$0.axis = .vertical
|
||||
}
|
||||
|
||||
private var primaryLabel = Label().with {
|
||||
private var label = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
}
|
||||
|
||||
private var secondaryLabel = Label().with {
|
||||
private var childLabel = Label().with {
|
||||
$0.setContentCompressionResistancePriority(.required, for: .vertical)
|
||||
}
|
||||
|
||||
@ -105,8 +105,8 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
||||
|
||||
open var labelAttributedText: NSAttributedString? {
|
||||
didSet {
|
||||
primaryLabel.useAttributedText = !(labelAttributedText?.string.isEmpty ?? true)
|
||||
primaryLabel.attributedText = labelAttributedText
|
||||
label.useAttributedText = !(labelAttributedText?.string.isEmpty ?? true)
|
||||
label.attributedText = labelAttributedText
|
||||
didChange()
|
||||
}
|
||||
}
|
||||
@ -117,8 +117,8 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
||||
|
||||
open var childAttributedText: NSAttributedString? {
|
||||
didSet {
|
||||
secondaryLabel.useAttributedText = !(childAttributedText?.string.isEmpty ?? true)
|
||||
secondaryLabel.attributedText = childAttributedText
|
||||
childLabel.useAttributedText = !(childAttributedText?.string.isEmpty ?? true)
|
||||
childLabel.attributedText = childAttributedText
|
||||
didChange()
|
||||
}
|
||||
}
|
||||
@ -177,8 +177,8 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
||||
mainStackView.addArrangedSubview(errorLabel)
|
||||
selectorStackView.addArrangedSubview(selectorView)
|
||||
selectorStackView.addArrangedSubview(selectorLabelStackView)
|
||||
selectorLabelStackView.addArrangedSubview(primaryLabel)
|
||||
selectorLabelStackView.addArrangedSubview(secondaryLabel)
|
||||
selectorLabelStackView.addArrangedSubview(label)
|
||||
selectorLabelStackView.addArrangedSubview(childLabel)
|
||||
|
||||
let selectorSize = getSelectorSize()
|
||||
selectorHeightConstraint = selectorView.heightAnchor.constraint(equalToConstant: selectorSize.height)
|
||||
@ -195,11 +195,11 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
||||
mainStackView.bottomAnchor.constraint(equalTo: bottomAnchor).isActive = true
|
||||
|
||||
//defaults
|
||||
primaryLabel.textPosition = .left
|
||||
primaryLabel.typograpicalStyle = .BoldBodyLarge
|
||||
label.textPosition = .left
|
||||
label.typograpicalStyle = .BoldBodyLarge
|
||||
|
||||
secondaryLabel.textPosition = .left
|
||||
secondaryLabel.typograpicalStyle = .BodyLarge
|
||||
childLabel.textPosition = .left
|
||||
childLabel.typograpicalStyle = .BodyLarge
|
||||
|
||||
errorLabel.textPosition = .left
|
||||
errorLabel.typograpicalStyle = .BodyMedium
|
||||
@ -212,32 +212,32 @@ open class RadioButtonBase: Control, Accessable, DataTrackable, BinaryColorable,
|
||||
//add the stackview to hold the 2 labels
|
||||
//top label
|
||||
if let labelText {
|
||||
primaryLabel.text = labelText
|
||||
primaryLabel.surface = surface
|
||||
primaryLabel.disabled = disabled
|
||||
primaryLabel.attributes = labelTextAttributes
|
||||
primaryLabel.isHidden = false
|
||||
label.text = labelText
|
||||
label.surface = surface
|
||||
label.disabled = disabled
|
||||
label.attributes = labelTextAttributes
|
||||
label.isHidden = false
|
||||
|
||||
} else if labelAttributedText != nil {
|
||||
primaryLabel.isHidden = false
|
||||
label.isHidden = false
|
||||
|
||||
} else {
|
||||
primaryLabel.isHidden = true
|
||||
label.isHidden = true
|
||||
}
|
||||
|
||||
//bottom label
|
||||
if let childText {
|
||||
secondaryLabel.text = childText
|
||||
secondaryLabel.surface = surface
|
||||
secondaryLabel.disabled = disabled
|
||||
secondaryLabel.attributes = childTextAttributes
|
||||
secondaryLabel.isHidden = false
|
||||
childLabel.text = childText
|
||||
childLabel.surface = surface
|
||||
childLabel.disabled = disabled
|
||||
childLabel.attributes = childTextAttributes
|
||||
childLabel.isHidden = false
|
||||
|
||||
} else if childAttributedText != nil {
|
||||
secondaryLabel.isHidden = false
|
||||
childLabel.isHidden = false
|
||||
|
||||
} else {
|
||||
secondaryLabel.isHidden = true
|
||||
childLabel.isHidden = true
|
||||
}
|
||||
selectorStackView.spacing = 12
|
||||
selectorLabelStackView.spacing = 4
|
||||
|
||||
Loading…
Reference in New Issue
Block a user