changes made
This commit is contained in:
parent
4782efc13f
commit
8ba1e65f0b
@ -93,6 +93,7 @@
|
|||||||
0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */; };
|
0A7EF86523D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */; };
|
||||||
0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */; };
|
0A7EF86723D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */; };
|
||||||
0A849EFE246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A849EFD246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift */; };
|
0A849EFE246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A849EFD246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift */; };
|
||||||
|
0A98D1722485842200FAD895 /* AccessibilityProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A98D1712485842200FAD895 /* AccessibilityProtocol.swift */; };
|
||||||
0A9D091D2433796500D2E6C0 /* BarsCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */; };
|
0A9D091D2433796500D2E6C0 /* BarsCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */; };
|
||||||
0A9D091E2433796500D2E6C0 /* NumericCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */; };
|
0A9D091E2433796500D2E6C0 /* NumericCarouselIndicatorModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */; };
|
||||||
0A9D091F2433796500D2E6C0 /* NumericIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */; };
|
0A9D091F2433796500D2E6C0 /* NumericIndicatorView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */; };
|
||||||
@ -525,6 +526,7 @@
|
|||||||
0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateDropdownEntryFieldModel.swift; sourceTree = "<group>"; };
|
0A7EF86623D8B0AE00B2AAD1 /* DateDropdownEntryFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateDropdownEntryFieldModel.swift; sourceTree = "<group>"; };
|
||||||
0A8321AE2355FE9500CB7F00 /* DigitBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DigitBox.swift; sourceTree = "<group>"; };
|
0A8321AE2355FE9500CB7F00 /* DigitBox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DigitBox.swift; sourceTree = "<group>"; };
|
||||||
0A849EFD246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleEqualsIgnoreCaseModel.swift; sourceTree = "<group>"; };
|
0A849EFD246F1775009F277F /* RuleEqualsIgnoreCaseModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleEqualsIgnoreCaseModel.swift; sourceTree = "<group>"; };
|
||||||
|
0A98D1712485842200FAD895 /* AccessibilityProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccessibilityProtocol.swift; sourceTree = "<group>"; };
|
||||||
0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarsCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
0A9D09172433796500D2E6C0 /* BarsCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BarsCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
||||||
0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
0A9D09182433796500D2E6C0 /* NumericCarouselIndicatorModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericCarouselIndicatorModel.swift; sourceTree = "<group>"; };
|
||||||
0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericIndicatorView.swift; sourceTree = "<group>"; };
|
0A9D09192433796500D2E6C0 /* NumericIndicatorView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumericIndicatorView.swift; sourceTree = "<group>"; };
|
||||||
@ -947,6 +949,7 @@
|
|||||||
children = (
|
children = (
|
||||||
D21B7F72243BAC6800051ABF /* CollectionItemModelProtocol.swift */,
|
D21B7F72243BAC6800051ABF /* CollectionItemModelProtocol.swift */,
|
||||||
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */,
|
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */,
|
||||||
|
0A98D1712485842200FAD895 /* AccessibilityProtocol.swift */,
|
||||||
);
|
);
|
||||||
path = Protocols;
|
path = Protocols;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2362,6 +2365,7 @@
|
|||||||
012A88C2238D7BCA00FE3DA1 /* CarouselItemModel.swift in Sources */,
|
012A88C2238D7BCA00FE3DA1 /* CarouselItemModel.swift in Sources */,
|
||||||
0AB764D324460FA400E7FE72 /* UIPickerView+Extension.swift in Sources */,
|
0AB764D324460FA400E7FE72 /* UIPickerView+Extension.swift in Sources */,
|
||||||
D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */,
|
D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */,
|
||||||
|
0A98D1722485842200FAD895 /* AccessibilityProtocol.swift in Sources */,
|
||||||
94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */,
|
94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */,
|
||||||
AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */,
|
AA26850C244840AE00CE34CC /* HeadersH2TinyButton.swift in Sources */,
|
||||||
011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */,
|
011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */,
|
||||||
|
|||||||
@ -8,15 +8,23 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class ListLeftVariableCheckboxAllTextAndLinks: TableViewCell {
|
@objcMembers open class ListLeftVariableCheckboxAllTextAndLinks: TableViewCell {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Outlets
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public let checkbox = Checkbox()
|
||||||
|
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public let checkbox = Checkbox()
|
|
||||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
|
|
||||||
public var stack: Stack<StackModel>
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
private var observation: NSKeyValueObservation? = nil
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -40,6 +48,16 @@ import Foundation
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
|
||||||
|
isAccessibilityElement = true
|
||||||
|
checkbox.isAccessibilityElement = false
|
||||||
|
accessibilityTraits = checkbox.accessibilityTraits
|
||||||
|
accessibilityHint = checkbox.accessibilityHint
|
||||||
|
// Update accessibility label on radio button state change.
|
||||||
|
observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
|
self?.updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -53,9 +71,58 @@ import Foundation
|
|||||||
|
|
||||||
checkbox.set(with: model.checkbox, delegateObject, additionalData)
|
checkbox.set(with: model.checkbox, delegateObject, additionalData)
|
||||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 140
|
return 140
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
checkbox.updateAccessibilityLabel()
|
||||||
|
|
||||||
|
if let checkboxLabel = checkbox.accessibilityLabel {
|
||||||
|
message += checkboxLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
|
message += eyebrowLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
|
message += bodyLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
|
||||||
|
isAccessibilityElement = true//!linkShowing
|
||||||
|
checkbox.isAccessibilityElement = linkShowing
|
||||||
|
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
||||||
|
|
||||||
|
if !linkShowing {
|
||||||
|
// Make whole cell focusable if no link.
|
||||||
|
accessibilityLabel = message
|
||||||
|
} else {
|
||||||
|
// Allow only radio button and link to be focused on.
|
||||||
|
checkbox.accessibilityLabel = message
|
||||||
|
var elements: [UIView] = []
|
||||||
|
|
||||||
|
if message.count > 0 {
|
||||||
|
elements.append(checkbox)
|
||||||
|
}
|
||||||
|
|
||||||
|
if eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 {
|
||||||
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityElements = elements
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
open class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
|
open class ListLeftVariableCheckboxAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
|
|||||||
@ -8,17 +8,27 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class ListLeftVariableCheckboxBodyText: TableViewCell {
|
@objcMembers open class ListLeftVariableCheckboxBodyText: TableViewCell {
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
public let checkbox = Checkbox(frame: .zero)
|
|
||||||
|
public let checkbox = Checkbox()
|
||||||
public var headlineBody = HeadlineBody()
|
public var headlineBody = HeadlineBody()
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public var stack: Stack<StackModel>
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
private var observation: NSKeyValueObservation? = nil
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: checkbox, model: StackItemModel(horizontalAlignment: .fill)),
|
stack = Stack<StackModel>.createStack(with: [(view: checkbox, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading))],
|
(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading))],
|
||||||
@ -31,25 +41,63 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - Lifecycle
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
checkbox.isAccessibilityElement = false
|
||||||
|
accessibilityTraits = checkbox.accessibilityTraits
|
||||||
|
accessibilityHint = checkbox.accessibilityHint
|
||||||
|
// Update accessibility label on radio button state change.
|
||||||
|
observation = observe(\.checkbox.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
|
self?.updateAccessibilityLabel()
|
||||||
|
}
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ListLeftVariableCheckboxBodyTextModel else { return }
|
guard let model = model as? ListLeftVariableCheckboxBodyTextModel else { return }
|
||||||
|
|
||||||
checkbox.set(with: model.checkbox, delegateObject, additionalData)
|
checkbox.set(with: model.checkbox, delegateObject, additionalData)
|
||||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 90
|
return 90
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public override func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
checkbox.isSelected.toggle()
|
||||||
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
checkbox.updateAccessibilityLabel()
|
||||||
|
|
||||||
|
if let checkboxLabel = checkbox.accessibilityLabel {
|
||||||
|
message += checkboxLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = headlineBody.headlineLabel.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let messageLabel = headlineBody.messageLabel.text {
|
||||||
|
message += messageLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,6 +7,8 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
open class ListLeftVariableCheckboxBodyTextModel: ListItemModel, MoleculeModelProtocol {
|
open class ListLeftVariableCheckboxBodyTextModel: ListItemModel, MoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -36,6 +38,7 @@ open class ListLeftVariableCheckboxBodyTextModel: ListItemModel, MoleculeModelPr
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case headlineBody
|
case headlineBody
|
||||||
@ -45,6 +48,7 @@ open class ListLeftVariableCheckboxBodyTextModel: ListItemModel, MoleculeModelPr
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Codec
|
// MARK: - Codec
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody)
|
headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody)
|
||||||
|
|||||||
@ -7,17 +7,21 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class ListLeftVariableIconAllTextLinks: TableViewCell {
|
@objcMembers open class ListLeftVariableIconAllTextLinks: TableViewCell {
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public let leftImage = LoadImageView()
|
public let leftImage = LoadImageView()
|
||||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
|
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
public var stack: Stack<StackModel>
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)), (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))], axis: .horizontal)
|
stack = Stack<StackModel>.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)), (view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))], axis: .horizontal)
|
||||||
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
@ -30,25 +34,77 @@ import Foundation
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Life Cycle
|
// MARK: - Life Cycle
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
leftImage.addSizeConstraintsForAspectRatio = true
|
leftImage.addSizeConstraintsForAspectRatio = true
|
||||||
leftImage.imageView.contentMode = .scaleAspectFit
|
leftImage.imageView.contentMode = .scaleAspectFit
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//------------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ListLeftVariableIconAllTextLinksModel else { return }
|
guard let model = model as? ListLeftVariableIconAllTextLinksModel else { return }
|
||||||
|
|
||||||
leftImage.set(with: model.image, delegateObject, additionalData)
|
leftImage.set(with: model.image, delegateObject, additionalData)
|
||||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 140
|
return 140
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let leftImageLabel = leftImage.accessibilityLabel {
|
||||||
|
message += leftImageLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
|
message += eyebrowLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
|
message += bodyLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
isAccessibilityElement = !linkShowing
|
||||||
|
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
||||||
|
|
||||||
|
if !linkShowing {
|
||||||
|
// Make whole cell focusable if no link.
|
||||||
|
accessibilityLabel = message
|
||||||
|
} else {
|
||||||
|
// Allow only radio button and link to be focused on.
|
||||||
|
accessibilityLabel = message
|
||||||
|
var elements: [UIView] = []
|
||||||
|
|
||||||
|
if message.count > 0 {
|
||||||
|
elements.append(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
if linkShowing {
|
||||||
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityElements = elements
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,11 +7,21 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListLeftVariableIconAllTextLinksModel: ListItemModel, MoleculeModelProtocol {
|
public class ListLeftVariableIconAllTextLinksModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "listLVImgAll"
|
public static var identifier: String = "listLVImgAll"
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Method
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
if image.width == nil, image.height == nil {
|
if image.width == nil, image.height == nil {
|
||||||
@ -20,18 +30,30 @@ public class ListLeftVariableIconAllTextLinksModel: ListItemModel, MoleculeModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(image: ImageViewModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
|
public init(image: ImageViewModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
|
||||||
self.image = image
|
self.image = image
|
||||||
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
|
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case image
|
case image
|
||||||
case eyebrowHeadlineBodyLink
|
case eyebrowHeadlineBodyLink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
|
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
|
||||||
|
|||||||
@ -8,19 +8,21 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class ListLeftVariableIconWithRightCaret: TableViewCell {
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
@objcMembers open class ListLeftVariableIconWithRightCaret: TableViewCell {
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-------------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
let leftImage = LoadImageView(pinnedEdges: .all)
|
let leftImage = LoadImageView(pinnedEdges: .all)
|
||||||
let leftLabel = Label.createLabelRegularBodySmall(true)
|
let leftLabel = Label.createLabelRegularBodySmall(true)
|
||||||
let rightLabel = Label.createLabelRegularBodySmall(true)
|
let rightLabel = Label.createLabelRegularBodySmall(true)
|
||||||
var stack: Stack<StackModel>
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)),
|
stack = Stack<StackModel>.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
|
(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
@ -33,28 +35,36 @@ import UIKit
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
//-------------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
leftImage.addSizeConstraintsForAspectRatio = true
|
leftImage.addSizeConstraintsForAspectRatio = true
|
||||||
leftImage.contentMode = .scaleAspectFit
|
leftImage.contentMode = .scaleAspectFit
|
||||||
leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal)
|
leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//------------------------------------------------------
|
//--------------------------------------------------
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
|
||||||
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ListLeftVariableIconWithRightCaretModel else { return}
|
guard let model = model as? ListLeftVariableIconWithRightCaretModel else { return}
|
||||||
|
|
||||||
leftImage.set(with: model.image, delegateObject, additionalData)
|
leftImage.set(with: model.image, delegateObject, additionalData)
|
||||||
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -66,4 +76,23 @@ import UIKit
|
|||||||
leftLabel.styleRegularBodySmall(true)
|
leftLabel.styleRegularBodySmall(true)
|
||||||
rightLabel.styleRegularBodySmall(true)
|
rightLabel.styleRegularBodySmall(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let leftImageLabel = leftImage.accessibilityLabel {
|
||||||
|
message += leftImageLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let leftLabel = leftLabel.text {
|
||||||
|
message += leftLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rightLabel = rightLabel.text {
|
||||||
|
message += rightLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,18 +7,21 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class ListLeftVariableIconWithRightCaretBodyText: TableViewCell {
|
@objcMembers open class ListLeftVariableIconWithRightCaretBodyText: TableViewCell {
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-------------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public let leftImage = LoadImageView()
|
public let leftImage = LoadImageView()
|
||||||
public let headlineBody = HeadlineBody()
|
public let headlineBody = HeadlineBody()
|
||||||
public let rightLabel = Label.createLabelRegularBodySmall(true)
|
public let rightLabel = Label.createLabelRegularBodySmall(true)
|
||||||
public var stack: Stack<StackModel>
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)),
|
stack = Stack<StackModel>.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)),
|
(view: headlineBody, model: StackItemModel(horizontalAlignment: .leading)),
|
||||||
@ -30,11 +33,13 @@ import Foundation
|
|||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
//-------------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
leftImage.addSizeConstraintsForAspectRatio = true
|
leftImage.addSizeConstraintsForAspectRatio = true
|
||||||
leftImage.contentMode = .scaleAspectFit
|
leftImage.contentMode = .scaleAspectFit
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
@ -42,17 +47,22 @@ import Foundation
|
|||||||
rightLabel.numberOfLines = 1
|
rightLabel.numberOfLines = 1
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//------------------------------------------------------
|
//---------------------------------------------------
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
|
||||||
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ListLeftVariableIconWithRightCaretBodyTextModel else { return }
|
guard let model = model as? ListLeftVariableIconWithRightCaretBodyTextModel else { return }
|
||||||
|
|
||||||
leftImage.set(with: model.image, delegateObject, additionalData)
|
leftImage.set(with: model.image, delegateObject, additionalData)
|
||||||
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -63,4 +73,27 @@ import Foundation
|
|||||||
super.reset()
|
super.reset()
|
||||||
rightLabel.styleRegularBodySmall(true)
|
rightLabel.styleRegularBodySmall(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let leftImageLabel = leftImage.accessibilityLabel {
|
||||||
|
message += leftImageLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = headlineBody.headlineLabel.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let messageLabel = headlineBody.messageLabel.text {
|
||||||
|
message += messageLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let rightLabel = rightLabel.text {
|
||||||
|
message += rightLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityLabel = message
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,12 +7,22 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, MoleculeModelProtocol {
|
public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "listLVImgBdy"
|
public static var identifier: String = "listLVImgBdy"
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
public var headlineBody: HeadlineBodyModel
|
public var headlineBody: HeadlineBodyModel
|
||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
if image.width == nil, image.height == nil {
|
if image.width == nil, image.height == nil {
|
||||||
@ -23,6 +33,10 @@ public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, Mol
|
|||||||
headlineBody.headline?.hero = 0
|
headlineBody.headline?.hero = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public init(image: ImageViewModel, headlineBody: HeadlineBodyModel, rightLabel: LabelModel) {
|
public init(image: ImageViewModel, headlineBody: HeadlineBodyModel, rightLabel: LabelModel) {
|
||||||
self.image = image
|
self.image = image
|
||||||
self.headlineBody = headlineBody
|
self.headlineBody = headlineBody
|
||||||
@ -30,6 +44,10 @@ public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, Mol
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case image
|
case image
|
||||||
@ -37,6 +55,10 @@ public class ListLeftVariableIconWithRightCaretBodyTextModel: ListItemModel, Mol
|
|||||||
case rightLabel
|
case rightLabel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
|
image = try typeContainer.decode(ImageViewModel.self, forKey: .image)
|
||||||
|
|||||||
@ -8,12 +8,21 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListLeftVariableIconWithRightCaretModel: ListItemModel, MoleculeModelProtocol {
|
public class ListLeftVariableIconWithRightCaretModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "listLVImg"
|
public static var identifier: String = "listLVImg"
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
public var leftLabel: LabelModel
|
public var leftLabel: LabelModel
|
||||||
public var rightLabel: LabelModel
|
public var rightLabel: LabelModel
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
if image.height == nil {
|
if image.height == nil {
|
||||||
@ -22,6 +31,10 @@ public class ListLeftVariableIconWithRightCaretModel: ListItemModel, MoleculeMod
|
|||||||
rightLabel.hero = 0
|
rightLabel.hero = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public init(image: ImageViewModel, leftLabel: LabelModel, rightLabel: LabelModel) {
|
public init(image: ImageViewModel, leftLabel: LabelModel, rightLabel: LabelModel) {
|
||||||
self.image = image
|
self.image = image
|
||||||
self.leftLabel = leftLabel
|
self.leftLabel = leftLabel
|
||||||
@ -29,6 +42,10 @@ public class ListLeftVariableIconWithRightCaretModel: ListItemModel, MoleculeMod
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case leftLabel
|
case leftLabel
|
||||||
@ -36,6 +53,10 @@ public class ListLeftVariableIconWithRightCaretModel: ListItemModel, MoleculeMod
|
|||||||
case image
|
case image
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
|
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
|
||||||
@ -53,5 +74,3 @@ public class ListLeftVariableIconWithRightCaretModel: ListItemModel, MoleculeMod
|
|||||||
try container.encode(image, forKey: .image)
|
try container.encode(image, forKey: .image)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -8,17 +8,25 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class ListLeftVariableNumberedListAllTextAndLinks: TableViewCell {
|
@objcMembers open class ListLeftVariableNumberedListAllTextAndLinks: TableViewCell {
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public let leftLabel = Label.createLabelTitle2XLarge(true)
|
public let leftLabel = Label.createLabelTitle2XLarge(true)
|
||||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
|
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public var stack: Stack<StackModel>
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
|
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .fill))],
|
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .fill))],
|
||||||
@ -38,16 +46,22 @@ import Foundation
|
|||||||
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
leftLabel.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
|
isAccessibilityElement = true
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//---------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//------------------------------------------------------
|
//---------------------------------------------------
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ListLeftVariableNumberedListAllTextAndLinksModel else { return }
|
guard let model = model as? ListLeftVariableNumberedListAllTextAndLinksModel else { return }
|
||||||
|
|
||||||
leftLabel.text = String(model.number)
|
leftLabel.text = String(model.number)
|
||||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -64,4 +78,49 @@ import Foundation
|
|||||||
// This fixes a defect body text where it doesn't layout correctly.
|
// This fixes a defect body text where it doesn't layout correctly.
|
||||||
eyebrowHeadlineBodyLink.body.preferredMaxLayoutWidth = eyebrowHeadlineBodyLink.frame.width
|
eyebrowHeadlineBodyLink.body.preferredMaxLayoutWidth = eyebrowHeadlineBodyLink.frame.width
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
|
var message = ""
|
||||||
|
|
||||||
|
if let leftLabel = leftLabel.text {
|
||||||
|
message += leftLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
|
message += eyebrowLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
|
message += headlineLabel + ", "
|
||||||
|
}
|
||||||
|
|
||||||
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
|
message += bodyLabel
|
||||||
|
}
|
||||||
|
|
||||||
|
let linkShowing = eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0
|
||||||
|
isAccessibilityElement = !linkShowing
|
||||||
|
eyebrowHeadlineBodyLink.link.isAccessibilityElement = linkShowing
|
||||||
|
|
||||||
|
if !linkShowing {
|
||||||
|
// Make whole cell focusable if no link.
|
||||||
|
accessibilityLabel = message
|
||||||
|
} else {
|
||||||
|
// Allow only radio button and link to be focused on.
|
||||||
|
accessibilityLabel = message
|
||||||
|
|
||||||
|
var elements: [UIView] = []
|
||||||
|
|
||||||
|
if message.count > 0 {
|
||||||
|
elements.append(self)
|
||||||
|
}
|
||||||
|
|
||||||
|
if linkShowing {
|
||||||
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
|
}
|
||||||
|
|
||||||
|
accessibilityElements = elements
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,23 +8,40 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListLeftVariableNumberedListAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
|
public class ListLeftVariableNumberedListAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "listLVNAll"
|
public static var identifier: String = "listLVNAll"
|
||||||
public var number: Int
|
public var number: Int
|
||||||
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public init(number: Int, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
|
public init(number: Int, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
|
||||||
self.number = number
|
self.number = number
|
||||||
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
|
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
|
||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case number
|
case number
|
||||||
case eyebrowHeadlineBodyLink
|
case eyebrowHeadlineBodyLink
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//-----------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
number = try typeContainer.decode(Int.self, forKey: .number)
|
number = try typeContainer.decode(Int.self, forKey: .number)
|
||||||
|
|||||||
@ -7,10 +7,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers open class ListLeftVariableRadioButtonAllTextAndLinks: TableViewCell {
|
@objcMembers open class ListLeftVariableRadioButtonAllTextAndLinks: TableViewCell {
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
let radioButton = RadioButton()
|
let radioButton = RadioButton()
|
||||||
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
|
||||||
var stack: Stack<StackModel>
|
var stack: Stack<StackModel>
|
||||||
@ -20,6 +23,7 @@ import Foundation
|
|||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - Initializers
|
// MARK: - Initializers
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
stack = Stack<StackModel>.createStack(with: [(view: radioButton, model: StackItemModel(horizontalAlignment: .fill)),
|
stack = Stack<StackModel>.createStack(with: [(view: radioButton, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))],
|
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))],
|
||||||
@ -34,6 +38,7 @@ import Foundation
|
|||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
@ -51,6 +56,7 @@ import Foundation
|
|||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ListLeftVariableRadioButtonAllTextAndLinksModel else { return}
|
guard let model = model as? ListLeftVariableRadioButtonAllTextAndLinksModel else { return}
|
||||||
@ -68,17 +74,23 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
radioButton.updateAccessibilityLabel()
|
radioButton.updateAccessibilityLabel()
|
||||||
|
|
||||||
if let radioButtonLabel = radioButton.accessibilityLabel {
|
if let radioButtonLabel = radioButton.accessibilityLabel {
|
||||||
message += radioButtonLabel + ", "
|
message += radioButtonLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
message += eyebrowLabel + ", "
|
message += eyebrowLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
message += headlineLabel + ", "
|
message += headlineLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
message += bodyLabel
|
message += bodyLabel
|
||||||
}
|
}
|
||||||
@ -96,12 +108,15 @@ import Foundation
|
|||||||
radioButton.accessibilityLabel = message
|
radioButton.accessibilityLabel = message
|
||||||
|
|
||||||
var elements: [UIView] = []
|
var elements: [UIView] = []
|
||||||
|
|
||||||
if message.count > 0 {
|
if message.count > 0 {
|
||||||
elements.append(radioButton)
|
elements.append(radioButton)
|
||||||
}
|
}
|
||||||
if eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 {
|
|
||||||
|
if linkShowing {
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,10 +7,13 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
|
open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, MoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open class var identifier: String {
|
open class var identifier: String {
|
||||||
return "listLVRBAll"
|
return "listLVRBAll"
|
||||||
}
|
}
|
||||||
@ -20,6 +23,7 @@ open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, Molec
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(radioButton: RadioButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
|
public init(radioButton: RadioButtonModel, eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel) {
|
||||||
self.radioButton = radioButton
|
self.radioButton = radioButton
|
||||||
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
|
self.eyebrowHeadlineBodyLink = eyebrowHeadlineBodyLink
|
||||||
@ -29,6 +33,7 @@ open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, Molec
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Keys
|
// MARK: - Keys
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case eyebrowHeadlineBodyLink
|
case eyebrowHeadlineBodyLink
|
||||||
@ -38,6 +43,7 @@ open class ListLeftVariableRadioButtonAllTextAndLinksModel: ListItemModel, Molec
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Codec
|
// MARK: - Codec
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
required public init(from decoder: Decoder) throws {
|
required public init(from decoder: Decoder) throws {
|
||||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton)
|
radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton)
|
||||||
|
|||||||
@ -43,6 +43,7 @@ import UIKit
|
|||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
leftImage.addSizeConstraintsForAspectRatio = true
|
leftImage.addSizeConstraintsForAspectRatio = true
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
@ -56,6 +57,7 @@ import UIKit
|
|||||||
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
observation = observe(\.radioButton.isSelected, options: [.new]) { [weak self] _, _ in
|
||||||
self?.updateAccessibilityLabel()
|
self?.updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
updateAccessibilityLabel()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
@ -70,7 +72,9 @@ import UIKit
|
|||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ListLeftVariableRadioButtonAndPaymentMethodModel else { return}
|
guard let model = model as? ListLeftVariableRadioButtonAndPaymentMethodModel else { return}
|
||||||
|
|
||||||
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
radioButton.set(with: model.radioButton, delegateObject, additionalData)
|
||||||
leftImage.set(with: model.image, delegateObject, additionalData)
|
leftImage.set(with: model.image, delegateObject, additionalData)
|
||||||
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
@ -86,20 +90,27 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
func updateAccessibilityLabel() {
|
func updateAccessibilityLabel() {
|
||||||
|
|
||||||
var message = ""
|
var message = ""
|
||||||
|
|
||||||
radioButton.updateAccessibilityLabel()
|
radioButton.updateAccessibilityLabel()
|
||||||
|
|
||||||
if let radioButtonLabel = radioButton.accessibilityLabel {
|
if let radioButtonLabel = radioButton.accessibilityLabel {
|
||||||
message += radioButtonLabel + ", "
|
message += radioButtonLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let leftImageLabel = leftImage.accessibilityLabel {
|
if let leftImageLabel = leftImage.accessibilityLabel {
|
||||||
message += leftImageLabel + ", "
|
message += leftImageLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
if let eyebrowLabel = eyebrowHeadlineBodyLink.eyebrow.text {
|
||||||
message += eyebrowLabel + ", "
|
message += eyebrowLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
if let headlineLabel = eyebrowHeadlineBodyLink.headline.text {
|
||||||
message += headlineLabel + ", "
|
message += headlineLabel + ", "
|
||||||
}
|
}
|
||||||
|
|
||||||
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
if let bodyLabel = eyebrowHeadlineBodyLink.body.text {
|
||||||
message += bodyLabel
|
message += bodyLabel
|
||||||
}
|
}
|
||||||
@ -115,14 +126,16 @@ import UIKit
|
|||||||
} else {
|
} else {
|
||||||
// Allow only radio button and link to be focused on.
|
// Allow only radio button and link to be focused on.
|
||||||
radioButton.accessibilityLabel = message
|
radioButton.accessibilityLabel = message
|
||||||
|
|
||||||
var elements: [UIView] = []
|
var elements: [UIView] = []
|
||||||
if message.count > 0 {
|
|
||||||
|
if !message.isEmpty {
|
||||||
elements.append(radioButton)
|
elements.append(radioButton)
|
||||||
}
|
}
|
||||||
if eyebrowHeadlineBodyLink.link.titleLabel?.text?.count ?? 0 > 0 {
|
|
||||||
|
if linkShowing {
|
||||||
elements.append(eyebrowHeadlineBodyLink.link)
|
elements.append(eyebrowHeadlineBodyLink.link)
|
||||||
}
|
}
|
||||||
|
|
||||||
accessibilityElements = elements
|
accessibilityElements = elements
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol {
|
public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
|
|||||||
14
MVMCoreUI/BaseClasses/Protocols/AccessibilityProtocol.swift
Normal file
14
MVMCoreUI/BaseClasses/Protocols/AccessibilityProtocol.swift
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
//
|
||||||
|
// AccessibilityProtocol.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 6/1/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
public protocol AccessibilityProtocol {
|
||||||
|
func updateAccessibilityLabel()
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user