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