accessibility
This commit is contained in:
parent
c6eb090bb7
commit
8be9c5aa87
@ -20,9 +20,9 @@ import Foundation
|
|||||||
private var selectedRadioButtonModel: RadioButtonModel?
|
private var selectedRadioButtonModel: RadioButtonModel?
|
||||||
public var baseValue: AnyHashable?
|
public var baseValue: AnyHashable?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func set(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton) {
|
public func set(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton) {
|
||||||
self.fieldKey = radioButtonModel.fieldKey
|
self.fieldKey = radioButtonModel.fieldKey
|
||||||
@ -50,9 +50,8 @@ import Foundation
|
|||||||
public static func setupForRadioButtonGroup(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton, delegateObject: MVMCoreUIDelegateObject?) {
|
public static func setupForRadioButtonGroup(_ radioButtonModel: RadioButtonModel, _ radioButton: RadioButton, delegateObject: MVMCoreUIDelegateObject?) {
|
||||||
|
|
||||||
guard let groupName = radioButtonModel.fieldKey,
|
guard let groupName = radioButtonModel.fieldKey,
|
||||||
let formValidator = delegateObject?.formHolderDelegate?.formValidator else {
|
let formValidator = delegateObject?.formHolderDelegate?.formValidator
|
||||||
return
|
else { return }
|
||||||
}
|
|
||||||
|
|
||||||
let radioButtonSelectionHelper = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonSelectionHelper()
|
let radioButtonSelectionHelper = formValidator.radioButtonsModelByGroup[groupName] ?? RadioButtonSelectionHelper()
|
||||||
radioButtonSelectionHelper.set(radioButtonModel, radioButton)
|
radioButtonSelectionHelper.set(radioButtonModel, radioButton)
|
||||||
@ -61,6 +60,7 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
public func selected(_ radioButton: RadioButton) {
|
public func selected(_ radioButton: RadioButton) {
|
||||||
|
|
||||||
// Checks because the view could be reused
|
// Checks because the view could be reused
|
||||||
if selectedRadioButton?.radioModel === selectedRadioButtonModel {
|
if selectedRadioButton?.radioModel === selectedRadioButtonModel {
|
||||||
selectedRadioButton?.isSelected = false
|
selectedRadioButton?.isSelected = false
|
||||||
@ -76,6 +76,7 @@ import Foundation
|
|||||||
|
|
||||||
// MARK: - FormValidationFormFieldProtocol
|
// MARK: - FormValidationFormFieldProtocol
|
||||||
extension RadioButtonSelectionHelper {
|
extension RadioButtonSelectionHelper {
|
||||||
|
|
||||||
public func formFieldValue() -> AnyHashable? {
|
public func formFieldValue() -> AnyHashable? {
|
||||||
return selectedRadioButtonModel?.fieldValue
|
return selectedRadioButtonModel?.fieldValue
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,11 +9,19 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol {
|
public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "listLVRBImg"
|
public static var identifier: String = "listLVRBImg"
|
||||||
public var radioButton: RadioButtonModel
|
public var radioButton: RadioButtonModel
|
||||||
public var image: ImageViewModel
|
public var image: ImageViewModel
|
||||||
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
public var eyebrowHeadlineBodyLink: EyebrowHeadlineBodyLinkModel
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(radioButton: RadioButtonModel, image: ImageViewModel, eyebrowHeadlineBodyLink:EyebrowHeadlineBodyLinkModel) {
|
public init(radioButton: RadioButtonModel, image: ImageViewModel, eyebrowHeadlineBodyLink:EyebrowHeadlineBodyLinkModel) {
|
||||||
self.radioButton = radioButton
|
self.radioButton = radioButton
|
||||||
self.image = image
|
self.image = image
|
||||||
@ -21,6 +29,10 @@ public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, Mo
|
|||||||
super.init()
|
super.init()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override func setDefaults() {
|
public override func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
if image.width == nil, image.height == nil {
|
if image.width == nil, image.height == nil {
|
||||||
@ -29,6 +41,10 @@ public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, Mo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case radioButton
|
case radioButton
|
||||||
@ -36,6 +52,10 @@ public class ListLeftVariableRadioButtonAndPaymentMethodModel: ListItemModel, Mo
|
|||||||
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)
|
||||||
radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton)
|
radioButton = try typeContainer.decode(RadioButtonModel.self, forKey: .radioButton)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user