updated button traits dynamically
This commit is contained in:
parent
d7c472b667
commit
eb9ec00866
@ -73,6 +73,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
_backgroundColor = newValue
|
_backgroundColor = newValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Methods
|
// MARK: - Methods
|
||||||
@ -195,6 +196,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
case disabledTextColor
|
case disabledTextColor
|
||||||
case disabledBorderColor
|
case disabledBorderColor
|
||||||
case width
|
case width
|
||||||
|
case accessibilityTraits
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -263,6 +265,7 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
|
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width)
|
width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width)
|
||||||
|
accessibilityTraits = try typeContainer.decodeIfPresent(UIAccessibilityTraits.self, forKey: .accessibilityTraits)
|
||||||
}
|
}
|
||||||
|
|
||||||
open func encode(to encoder: Encoder) throws {
|
open func encode(to encoder: Encoder) throws {
|
||||||
@ -286,5 +289,6 @@ open class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGroupWat
|
|||||||
try container.encodeIfPresent(size, forKey: .size)
|
try container.encodeIfPresent(size, forKey: .size)
|
||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
try container.encodeIfPresent(width, forKey: .width)
|
try container.encodeIfPresent(width, forKey: .width)
|
||||||
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -33,7 +33,9 @@ import Foundation
|
|||||||
|
|
||||||
super.set(with: model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
FormValidator.setupValidation(for: castModel, delegate: delegateObject?.formHolderDelegate)
|
FormValidator.setupValidation(for: castModel, delegate: delegateObject?.formHolderDelegate)
|
||||||
|
if let traits = model.accessibilityTraits {
|
||||||
|
accessibilityTraits = traits
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setState() {
|
public func setState() {
|
||||||
|
|||||||
@ -24,7 +24,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
public var enabled: Bool = true
|
public var enabled: Bool = true
|
||||||
public var enabledTintColor: Color?
|
public var enabledTintColor: Color?
|
||||||
public var disabledTintColor: Color?
|
public var disabledTintColor: Color?
|
||||||
|
public var accessibilityTraits: UIAccessibilityTraits?
|
||||||
public var groupName: String = ""
|
public var groupName: String = ""
|
||||||
|
|
||||||
public var updateUI: ActionBlock?
|
public var updateUI: ActionBlock?
|
||||||
@ -45,6 +45,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
case groupName
|
case groupName
|
||||||
case enabledTintColor
|
case enabledTintColor
|
||||||
case disabledTintColor
|
case disabledTintColor
|
||||||
|
case accessibilityTraits
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -59,7 +60,7 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image)
|
image = try typeContainer.decodeIfPresent(ImageViewModel.self, forKey: .image)
|
||||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
|
accessibilityTraits = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityTraits)
|
||||||
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
||||||
self.enabled = enabled
|
self.enabled = enabled
|
||||||
}
|
}
|
||||||
@ -90,5 +91,6 @@ open class ImageButtonModel: ButtonModelProtocol, MoleculeModelProtocol, FormGro
|
|||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
try container.encodeIfPresent(enabledTintColor, forKey: .enabledTintColor)
|
try container.encodeIfPresent(enabledTintColor, forKey: .enabledTintColor)
|
||||||
try container.encodeIfPresent(disabledTintColor, forKey: .disabledTintColor)
|
try container.encodeIfPresent(disabledTintColor, forKey: .disabledTintColor)
|
||||||
|
try container.encodeIfPresent(accessibilityTraits, forKey: .accessibilityTraits)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -173,6 +173,9 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
||||||
|
if let traits = model.accessibilityTraits {
|
||||||
|
accessibilityTraits = traits
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user