inversion colors
This commit is contained in:
parent
59288c8fdf
commit
e9a9c95373
@ -25,7 +25,7 @@ open class ExternalLink: Link {
|
|||||||
|
|
||||||
guard let model = model as? ExternalLinkModel else { return }
|
guard let model = model as? ExternalLinkModel else { return }
|
||||||
|
|
||||||
exportImageView?.tintColor = model.enabledColor.uiColor
|
exportImageView?.tintColor = titleColor(for: model.enabled ? .normal : .disabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
open class ExternalLinkModel: LinkModel {
|
open class ExternalLinkModel: LinkModel {
|
||||||
|
|
||||||
override open class var identifier: String {
|
override open class var identifier: String {
|
||||||
|
|||||||
@ -37,9 +37,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override var intrinsicContentSize: CGSize {
|
open override var intrinsicContentSize: CGSize {
|
||||||
guard let size = titleLabel?.intrinsicContentSize else {
|
guard let size = titleLabel?.intrinsicContentSize else { return super.intrinsicContentSize }
|
||||||
return super.intrinsicContentSize
|
|
||||||
}
|
|
||||||
return CGSize(width: size.width, height: size.height + 2)
|
return CGSize(width: size.width, height: size.height + 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,17 +47,18 @@ import UIKit
|
|||||||
|
|
||||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public 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? LinkModel else { return }
|
guard let model = model as? LinkModel else { return }
|
||||||
|
|
||||||
setTitle(model.title, for: .normal)
|
setTitle(model.title, for: .normal)
|
||||||
setTitleColor(model.enabledColor.uiColor, for: .normal)
|
setTitleColor((model.inverted ? model.enabledColor_inverted : model.enabledColor).uiColor, for: .normal)
|
||||||
setTitleColor(model.disabledColor.uiColor, for: .disabled)
|
setTitleColor((model.inverted ? model.disabledColor_inverted : model.disabledColor).uiColor, for: .disabled)
|
||||||
isEnabled = model.enabled
|
isEnabled = model.enabled
|
||||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 31.0
|
return 31
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,12 +67,15 @@ extension Link {
|
|||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
|
|
||||||
DispatchQueue.main.async { [weak self] in
|
DispatchQueue.main.async { [weak self] in
|
||||||
guard let self = self else { return }
|
guard let self = self else { return }
|
||||||
|
|
||||||
var width = size
|
var width = size
|
||||||
if MVMCoreGetterUtility.fequal(a: Float(CGFloat.leastNormalMagnitude), b: Float(size)) {
|
if MVMCoreGetterUtility.fequal(a: Float.leastNormalMagnitude, b: Float(size)) {
|
||||||
width = MVMCoreUIUtility.getWidth()
|
width = MVMCoreUIUtility.getWidth()
|
||||||
}
|
}
|
||||||
|
|
||||||
self.titleLabel?.font = MFStyler.fontB2(forWidth: width)
|
self.titleLabel?.font = MFStyler.fontB2(forWidth: width)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -22,7 +23,10 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
public var action: ActionModelProtocol
|
public var action: ActionModelProtocol
|
||||||
public var enabled = true
|
public var enabled = true
|
||||||
public var enabledColor = Color(uiColor: .mvmBlack)
|
public var enabledColor = Color(uiColor: .mvmBlack)
|
||||||
|
public var enabledColor_inverted = Color(uiColor: .mvmWhite)
|
||||||
public var disabledColor = Color(uiColor: .mvmCoolGray6)
|
public var disabledColor = Color(uiColor: .mvmCoolGray6)
|
||||||
|
public var disabledColor_inverted = Color(uiColor: .mvmCoolGray10)
|
||||||
|
public var inverted = false
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
@ -44,7 +48,10 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
case action
|
case action
|
||||||
case enabled
|
case enabled
|
||||||
case enabledColor
|
case enabledColor
|
||||||
|
case enabledColor_inverted
|
||||||
case disabledColor
|
case disabledColor
|
||||||
|
case disabledColor_inverted
|
||||||
|
case inverted
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -53,6 +60,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
|
|
||||||
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)
|
||||||
|
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
title = try typeContainer.decode(String.self, forKey: .title)
|
title = try typeContainer.decode(String.self, forKey: .title)
|
||||||
action = try typeContainer.decodeModel(codingKey: .action)
|
action = try typeContainer.decodeModel(codingKey: .action)
|
||||||
@ -60,12 +68,25 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
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
|
||||||
}
|
}
|
||||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor) {
|
|
||||||
enabledColor = color
|
if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) {
|
||||||
|
self.inverted = inverted
|
||||||
}
|
}
|
||||||
|
|
||||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
|
if let enabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor) {
|
||||||
disabledColor = color
|
self.enabledColor = enabledColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let enabledColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .enabledColor_inverted) {
|
||||||
|
self.enabledColor_inverted = enabledColor_inverted
|
||||||
|
}
|
||||||
|
|
||||||
|
if let disabledColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor) {
|
||||||
|
self.disabledColor = disabledColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let disabledColor_inverted = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledColor_inverted) {
|
||||||
|
self.disabledColor_inverted = disabledColor_inverted
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -75,8 +96,11 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
|||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModel(action, forKey: .action)
|
try container.encodeModel(action, forKey: .action)
|
||||||
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encode(enabled, forKey: .enabled)
|
try container.encode(enabled, forKey: .enabled)
|
||||||
try container.encode(enabledColor, forKey: .enabledColor)
|
try container.encode(enabledColor, forKey: .enabledColor)
|
||||||
|
try container.encode(enabledColor_inverted, forKey: .enabledColor_inverted)
|
||||||
try container.encode(disabledColor, forKey: .disabledColor)
|
try container.encode(disabledColor, forKey: .disabledColor)
|
||||||
|
try container.encode(disabledColor_inverted, forKey: .disabledColor_inverted)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -97,7 +97,7 @@ import MVMCore
|
|||||||
public var disabledCheckColor: UIColor = .mvmCoolGray3
|
public var disabledCheckColor: UIColor = .mvmCoolGray3
|
||||||
|
|
||||||
/// Color of the check mark.
|
/// Color of the check mark.
|
||||||
public var checkColor: UIColor = .black {
|
public var checkColor: UIColor = .mvmBlack {
|
||||||
didSet {
|
didSet {
|
||||||
setShapeLayerStrokeColor(checkColor)
|
setShapeLayerStrokeColor(checkColor)
|
||||||
}
|
}
|
||||||
@ -111,7 +111,7 @@ import MVMCore
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// border color of the Checkbox
|
/// border color of the Checkbox
|
||||||
public var borderColor: UIColor = .black {
|
public var borderColor: UIColor = .mvmBlack {
|
||||||
didSet {
|
didSet {
|
||||||
layer.borderColor = borderColor.cgColor
|
layer.borderColor = borderColor.cgColor
|
||||||
}
|
}
|
||||||
@ -126,7 +126,7 @@ import MVMCore
|
|||||||
didSet {
|
didSet {
|
||||||
if !updateSelectionOnly {
|
if !updateSelectionOnly {
|
||||||
layoutIfNeeded()
|
layoutIfNeeded()
|
||||||
(model as? CheckboxModel)?.isChecked = isSelected
|
(model as? CheckboxModel)?.checked = isSelected
|
||||||
shapeLayer?.removeAllAnimations()
|
shapeLayer?.removeAllAnimations()
|
||||||
updateCheckboxUI(isSelected: isSelected, isAnimated: isAnimated)
|
updateCheckboxUI(isSelected: isSelected, isAnimated: isAnimated)
|
||||||
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
_ = FormValidator.validate(delegate: delegateObject?.formHolderDelegate)
|
||||||
@ -375,10 +375,10 @@ import MVMCore
|
|||||||
shapeLayer?.removeFromSuperlayer()
|
shapeLayer?.removeFromSuperlayer()
|
||||||
shapeLayer = nil
|
shapeLayer = nil
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
borderColor = .black
|
borderColor = .mvmBlack
|
||||||
borderWidth = 1.0
|
borderWidth = 1
|
||||||
checkColor = .black
|
checkColor = .mvmBlack
|
||||||
checkWidth = 2.0
|
checkWidth = 2
|
||||||
checkAndBypassAnimations(selected: false)
|
checkAndBypassAnimations(selected: false)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,32 +393,34 @@ import MVMCore
|
|||||||
|
|
||||||
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public 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? CheckboxModel else { return }
|
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
|
|
||||||
|
guard let model = model as? CheckboxModel else { return }
|
||||||
|
|
||||||
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
FormValidator.setupValidation(for: model, delegate: delegateObject?.formHolderDelegate)
|
||||||
|
|
||||||
if let fieldKey = model.fieldKey {
|
if let fieldKey = model.fieldKey {
|
||||||
self.fieldKey = fieldKey
|
self.fieldKey = fieldKey
|
||||||
}
|
}
|
||||||
|
|
||||||
borderColor = model.borderColor.uiColor
|
borderColor = (model.inverted ? model.invertedColor : model.borderColor).uiColor
|
||||||
borderWidth = model.borderWidth
|
borderWidth = model.borderWidth
|
||||||
|
|
||||||
checkColor = model.checkColor.uiColor
|
checkColor = (model.inverted ? model.invertedColor : model.checkColor).uiColor
|
||||||
unCheckedBackgroundColor = model.unCheckedBackgroundColor.uiColor
|
unCheckedBackgroundColor = (model.inverted ? model.invertedBackgroundColor : model.unCheckedBackgroundColor).uiColor
|
||||||
checkedBackgroundColor = model.checkedBackgroundColor.uiColor
|
checkedBackgroundColor = (model.inverted ? model.invertedBackgroundColor : model.checkedBackgroundColor).uiColor
|
||||||
disabledCheckColor = model.disabledCheckColor.uiColor
|
disabledCheckColor = (model.inverted ? model.invertedColor : model.disabledCheckColor).uiColor
|
||||||
disabledBorderColor = model.disabledBorderColor.uiColor
|
disabledBorderColor = (model.inverted ? model.invertedColor : model.disabledBorderColor).uiColor
|
||||||
disabledBackgroundColor = model.disabledBackgroundColor.uiColor
|
disabledBackgroundColor = (model.inverted ? model.invertedColor : model.disabledBackgroundColor).uiColor
|
||||||
|
|
||||||
isAnimated = model.isAnimated
|
isAnimated = model.animated
|
||||||
isRound = model.isRound
|
isRound = model.round
|
||||||
|
|
||||||
if model.isChecked {
|
if model.checked {
|
||||||
checkAndBypassAnimations(selected: model.isChecked)
|
checkAndBypassAnimations(selected: model.checked)
|
||||||
}
|
}
|
||||||
|
|
||||||
isEnabled = model.isEnabled
|
isEnabled = model.enabled
|
||||||
|
|
||||||
if let action = model.action {
|
if let action = model.action {
|
||||||
actionBlock = {
|
actionBlock = {
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers public class CheckboxModel: MoleculeModelProtocol, FormFieldProtocol {
|
@objcMembers public class CheckboxModel: MoleculeModelProtocol, FormFieldProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -15,20 +16,23 @@ import Foundation
|
|||||||
|
|
||||||
public static var identifier: String = "checkbox"
|
public static var identifier: String = "checkbox"
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var isChecked: Bool = false
|
public var checked: Bool = false
|
||||||
public var isEnabled: Bool = true
|
public var enabled: Bool = true
|
||||||
public var isAnimated: Bool = true
|
public var animated: Bool = true
|
||||||
public var isRound: Bool = false
|
public var inverted: Bool = false
|
||||||
|
public var round: Bool = false
|
||||||
public var borderWidth: CGFloat = 1
|
public var borderWidth: CGFloat = 1
|
||||||
public var borderColor: Color = Color(uiColor: .black)
|
public var borderColor: Color = Color(uiColor: .mvmBlack)
|
||||||
public var checkColor: Color = Color(uiColor: .black)
|
public var checkColor: Color = Color(uiColor: .mvmBlack)
|
||||||
public var unCheckedBackgroundColor: Color = Color(uiColor: .clear)
|
public var unCheckedBackgroundColor: Color = Color(uiColor: .clear)
|
||||||
public var checkedBackgroundColor: Color = Color(uiColor: .clear)
|
public var checkedBackgroundColor: Color = Color(uiColor: .clear)
|
||||||
public var disabledBackgroundColor: Color = Color(uiColor: .clear)
|
public var disabledBackgroundColor: Color = Color(uiColor: .clear)
|
||||||
public var disabledBorderColor: Color = Color(uiColor: .mvmCoolGray3)
|
public var disabledBorderColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||||
public var disabledCheckColor: Color = Color(uiColor: .mvmCoolGray3)
|
public var disabledCheckColor: Color = Color(uiColor: .mvmCoolGray3)
|
||||||
|
public var invertedColor: Color = Color(uiColor: .mvmWhite)
|
||||||
|
public var invertedBackgroundColor: Color = Color(uiColor: .mvmBlack)
|
||||||
public var action: ActionModelProtocol?
|
public var action: ActionModelProtocol?
|
||||||
|
|
||||||
public var fieldKey: String?
|
public var fieldKey: String?
|
||||||
public var groupName: String = FormValidator.defaultGroupName
|
public var groupName: String = FormValidator.defaultGroupName
|
||||||
public var baseValue: AnyHashable?
|
public var baseValue: AnyHashable?
|
||||||
@ -39,13 +43,16 @@ import Foundation
|
|||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case isChecked = "checked"
|
case checked
|
||||||
case isEnabled = "enabled"
|
case enabled
|
||||||
case isAnimated = "animated"
|
case inverted
|
||||||
case isRound = "round"
|
case animated
|
||||||
|
case round
|
||||||
case borderWidth
|
case borderWidth
|
||||||
case borderColor
|
case borderColor
|
||||||
case checkColor
|
case checkColor
|
||||||
|
case invertedColor
|
||||||
|
case invertedBackgroundColor
|
||||||
case unCheckedBackgroundColor
|
case unCheckedBackgroundColor
|
||||||
case checkedBackgroundColor
|
case checkedBackgroundColor
|
||||||
case disabledBackgroundColor
|
case disabledBackgroundColor
|
||||||
@ -56,12 +63,20 @@ import Foundation
|
|||||||
case groupName
|
case groupName
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Methods
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func formFieldValue() -> AnyHashable? {
|
public func formFieldValue() -> AnyHashable? {
|
||||||
return isChecked
|
return checked
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(isChecked: Bool = false) {
|
public init(isChecked: Bool = false) {
|
||||||
self.isChecked = isChecked
|
self.checked = isChecked
|
||||||
baseValue = isChecked
|
baseValue = isChecked
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -71,22 +86,72 @@ import Foundation
|
|||||||
|
|
||||||
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)
|
||||||
borderWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .borderWidth) ?? 1
|
|
||||||
borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) ?? Color(uiColor: .black)
|
|
||||||
checkColor = try typeContainer.decodeIfPresent(Color.self, forKey: .checkColor) ?? Color(uiColor: .black)
|
|
||||||
unCheckedBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .unCheckedBackgroundColor) ?? Color(uiColor: .clear)
|
|
||||||
checkedBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .checkedBackgroundColor) ?? Color(uiColor: .clear)
|
|
||||||
disabledBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledBackgroundColor) ?? Color(uiColor: .clear)
|
|
||||||
disabledBorderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledBorderColor) ?? Color(uiColor: .mvmCoolGray3)
|
|
||||||
disabledCheckColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledCheckColor) ?? Color(uiColor: .mvmCoolGray3)
|
|
||||||
isChecked = try typeContainer.decodeIfPresent(Bool.self, forKey: .isChecked) ?? false
|
|
||||||
isAnimated = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAnimated) ?? true
|
|
||||||
isRound = try typeContainer.decodeIfPresent(Bool.self, forKey: .isRound) ?? false
|
|
||||||
isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) ?? true
|
|
||||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
|
||||||
|
|
||||||
baseValue = isChecked
|
if let borderWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .borderWidth) {
|
||||||
|
self.borderWidth = borderWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
if let borderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .borderColor) {
|
||||||
|
self.borderColor = borderColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let checkColor = try typeContainer.decodeIfPresent(Color.self, forKey: .checkColor) {
|
||||||
|
self.checkColor = checkColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let unCheckedBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .unCheckedBackgroundColor) {
|
||||||
|
self.unCheckedBackgroundColor = unCheckedBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let checkedBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .checkedBackgroundColor) {
|
||||||
|
self.checkedBackgroundColor = checkedBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let disabledBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledBackgroundColor) {
|
||||||
|
self.disabledBackgroundColor = disabledBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let disabledBorderColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledBorderColor) {
|
||||||
|
self.disabledBorderColor = disabledBorderColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let disabledCheckColor = try typeContainer.decodeIfPresent(Color.self, forKey: .disabledCheckColor) {
|
||||||
|
self.disabledCheckColor = disabledCheckColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let invertedColor = try typeContainer.decodeIfPresent(Color.self, forKey: .invertedColor) {
|
||||||
|
self.invertedColor = invertedColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let invertedBackgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .invertedBackgroundColor) {
|
||||||
|
self.invertedBackgroundColor = invertedBackgroundColor
|
||||||
|
}
|
||||||
|
|
||||||
|
if let checked = try typeContainer.decodeIfPresent(Bool.self, forKey: .checked) {
|
||||||
|
self.checked = checked
|
||||||
|
}
|
||||||
|
|
||||||
|
baseValue = checked
|
||||||
|
|
||||||
|
if let animated = try typeContainer.decodeIfPresent(Bool.self, forKey: .animated) {
|
||||||
|
self.animated = animated
|
||||||
|
}
|
||||||
|
|
||||||
|
if let round = try typeContainer.decodeIfPresent(Bool.self, forKey: .round) {
|
||||||
|
self.round = round
|
||||||
|
}
|
||||||
|
|
||||||
|
if let inverted = try typeContainer.decodeIfPresent(Bool.self, forKey: .inverted) {
|
||||||
|
self.inverted = inverted
|
||||||
|
}
|
||||||
|
|
||||||
|
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
||||||
|
self.enabled = enabled
|
||||||
|
}
|
||||||
|
|
||||||
|
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||||
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
||||||
|
|
||||||
if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) {
|
if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) {
|
||||||
self.groupName = groupName
|
self.groupName = groupName
|
||||||
}
|
}
|
||||||
@ -99,16 +164,19 @@ import Foundation
|
|||||||
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
try container.encodeIfPresent(fieldKey, forKey: .fieldKey)
|
||||||
try container.encodeIfPresent(borderColor, forKey: .borderColor)
|
try container.encodeIfPresent(borderColor, forKey: .borderColor)
|
||||||
try container.encode(borderWidth, forKey: .borderWidth)
|
try container.encode(borderWidth, forKey: .borderWidth)
|
||||||
try container.encode(isChecked, forKey: .isChecked)
|
try container.encode(checked, forKey: .checked)
|
||||||
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encodeIfPresent(checkColor, forKey: .checkColor)
|
try container.encodeIfPresent(checkColor, forKey: .checkColor)
|
||||||
|
try container.encodeIfPresent(invertedColor, forKey: .invertedColor)
|
||||||
|
try container.encodeIfPresent(invertedBackgroundColor, forKey: .invertedBackgroundColor)
|
||||||
try container.encodeIfPresent(unCheckedBackgroundColor, forKey: .unCheckedBackgroundColor)
|
try container.encodeIfPresent(unCheckedBackgroundColor, forKey: .unCheckedBackgroundColor)
|
||||||
try container.encodeIfPresent(checkedBackgroundColor, forKey: .checkedBackgroundColor)
|
try container.encodeIfPresent(checkedBackgroundColor, forKey: .checkedBackgroundColor)
|
||||||
try container.encodeIfPresent(disabledBorderColor, forKey: .disabledBorderColor)
|
try container.encodeIfPresent(disabledBorderColor, forKey: .disabledBorderColor)
|
||||||
try container.encodeIfPresent(disabledBackgroundColor, forKey: .disabledBackgroundColor)
|
try container.encodeIfPresent(disabledBackgroundColor, forKey: .disabledBackgroundColor)
|
||||||
try container.encodeIfPresent(disabledCheckColor, forKey: .disabledCheckColor)
|
try container.encodeIfPresent(disabledCheckColor, forKey: .disabledCheckColor)
|
||||||
try container.encodeIfPresent(isAnimated, forKey: .isAnimated)
|
try container.encodeIfPresent(animated, forKey: .animated)
|
||||||
try container.encodeIfPresent(isRound, forKey: .isRound)
|
try container.encodeIfPresent(round, forKey: .round)
|
||||||
try container.encodeIfPresent(isEnabled, forKey: .isEnabled)
|
try container.encodeIfPresent(enabled, forKey: .enabled)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
try container.encodeIfPresent(groupName, forKey: .groupName)
|
try container.encodeIfPresent(groupName, forKey: .groupName)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
|
|
||||||
@objcMembers public class RadioButtonLabel: View {
|
@objcMembers public class RadioButtonLabel: View {
|
||||||
|
|
||||||
public let radioButton = RadioButton()
|
public let radioButton = RadioButton()
|
||||||
@ -35,9 +36,6 @@ import UIKit
|
|||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
guard subviews.count == 0 else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
addSubview(radioButton)
|
addSubview(radioButton)
|
||||||
radioButton.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor, constant: 0).isActive = true
|
radioButton.leftAnchor.constraint(equalTo: layoutMarginsGuide.leftAnchor, constant: 0).isActive = true
|
||||||
@ -72,5 +70,4 @@ import UIKit
|
|||||||
radioButton.set(with: radioButtonLabelModel.radioButton, delegateObject, additionalData)
|
radioButton.set(with: radioButtonLabelModel.radioButton, delegateObject, additionalData)
|
||||||
label.set(with: radioButtonLabelModel.label, delegateObject, additionalData)
|
label.set(with: radioButtonLabelModel.label, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,12 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
@objcMembers public class RadioButtonLabelModel: MoleculeModelProtocol {
|
@objcMembers public class RadioButtonLabelModel: MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "radioButtonLabel"
|
public static var identifier: String = "radioButtonLabel"
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var moleculeName: String
|
public var moleculeName: String
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user