moleculeName
This commit is contained in:
parent
6de4fc4864
commit
438661dfe1
@ -20,7 +20,6 @@ public enum ButtonSize: String, Codable {
|
||||
|
||||
public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
public static var identifier: String = "button"
|
||||
public var moleculeName: String?
|
||||
public var backgroundColor: Color?
|
||||
public var title: String
|
||||
public var action: ActionModelProtocol
|
||||
@ -39,14 +38,14 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
init(with title: String, action: ActionModelProtocol) {
|
||||
self.title = title
|
||||
self.action = action
|
||||
moleculeName = Self.identifier
|
||||
//moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
init(secondaryButtonWith title: String, action: ActionModelProtocol) {
|
||||
self.title = title
|
||||
self.action = action
|
||||
style = .secondary
|
||||
moleculeName = Self.identifier
|
||||
//moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
init(primaryButtonWith title: String, action: ActionModelProtocol) {
|
||||
@ -75,7 +74,6 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
||||
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
|
||||
@ -11,7 +11,6 @@ import Foundation
|
||||
@objcMembers public class ImageViewModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "image"
|
||||
public var backgroundColor: Color?
|
||||
public var moleculeName: String?
|
||||
public var image: String
|
||||
public var accessibilityText: String?
|
||||
public var fallbackImage: String?
|
||||
@ -38,6 +37,5 @@ import Foundation
|
||||
|
||||
public init(image: String) {
|
||||
self.image = image
|
||||
moleculeName = Self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
@ -11,9 +11,7 @@ import Foundation
|
||||
|
||||
@objcMembers public class LabelModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "label"
|
||||
public var moleculeName: String?
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public var text: String
|
||||
public var accessibilityText: String?
|
||||
public var textColor: String?
|
||||
@ -48,12 +46,10 @@ import Foundation
|
||||
|
||||
public init(text: String) {
|
||||
self.text = text
|
||||
moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
moleculeName = try typeContainer.decodeIfPresent(String.self, forKey: .moleculeName)
|
||||
text = try typeContainer.decode(String.self, forKey: .text)
|
||||
accessibilityText = try typeContainer.decodeIfPresent(String.self, forKey: .accessibilityText)
|
||||
textColor = try typeContainer.decodeIfPresent(String.self, forKey: .textColor)
|
||||
|
||||
@ -12,7 +12,6 @@ import Foundation
|
||||
@objcMembers public class FooterModel: MoleculeContainerModel, MoleculeModelProtocol {
|
||||
public static var identifier: String = "footer"
|
||||
public var backgroundColor: Color?
|
||||
public var moleculeName: String?
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
@ -38,7 +37,6 @@ import Foundation
|
||||
public override init(with moleculeModel: MoleculeModelProtocol) {
|
||||
super.init(with: moleculeModel)
|
||||
setDefaults()
|
||||
moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
|
||||
@ -10,7 +10,6 @@ import UIKit
|
||||
|
||||
public class TwoButtonViewModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "twoButtonView"
|
||||
public var moleculeName: String?
|
||||
public var backgroundColor: Color?
|
||||
public var primaryButton: ButtonModel?
|
||||
public var secondaryButton: ButtonModel?
|
||||
@ -22,9 +21,7 @@ public class TwoButtonViewModel: MoleculeModelProtocol {
|
||||
case secondaryButton
|
||||
}
|
||||
|
||||
init() {
|
||||
moleculeName = Self.identifier
|
||||
}
|
||||
init() { }
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
@ -13,7 +13,6 @@ import Foundation
|
||||
public var backgroundColor: Color?
|
||||
public var spacing: CGFloat?
|
||||
public var percent: Int?
|
||||
public var moleculeName: String?
|
||||
public var gone: Bool = false
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
@ -25,9 +24,8 @@ import Foundation
|
||||
|
||||
public override init(with moleculeModel: MoleculeModelProtocol) {
|
||||
super.init(with: moleculeModel)
|
||||
moleculeName = Self.identifier
|
||||
}
|
||||
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
spacing = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .spacing)
|
||||
|
||||
@ -10,7 +10,6 @@ import Foundation
|
||||
|
||||
@objcMembers public class HeadlineBodyModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBody"
|
||||
public var moleculeName: String?
|
||||
public var headline: LabelModel?
|
||||
public var body: LabelModel?
|
||||
public var style: String?
|
||||
@ -18,6 +17,5 @@ import Foundation
|
||||
|
||||
public init(headline: LabelModel) {
|
||||
self.headline = headline
|
||||
moleculeName = Self.identifier
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user