hero is working. commenting done.
This commit is contained in:
parent
0c11ded577
commit
f889515709
@ -9,6 +9,9 @@
|
|||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class EyebrowHeadlineBodyLink: Container {
|
@objcMembers open class EyebrowHeadlineBodyLink: Container {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Outlets
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
let stack = Stack<StackModel>(frame: .zero)
|
let stack = Stack<StackModel>(frame: .zero)
|
||||||
let eyebrow = Label.commonLabelB3(true)
|
let eyebrow = Label.commonLabelB3(true)
|
||||||
@ -20,7 +23,10 @@ import UIKit
|
|||||||
get { return model as? EyebrowHeadlineBodyLinkModel }
|
get { return model as? EyebrowHeadlineBodyLinkModel }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - MFViewProtocol
|
// MARK: - MFViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
stack.stackItems = [StackItem(andContain: eyebrow),
|
stack.stackItems = [StackItem(andContain: eyebrow),
|
||||||
@ -36,7 +42,10 @@ import UIKit
|
|||||||
stack.updateView(size)
|
stack.updateView(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
stack.reset()
|
stack.reset()
|
||||||
@ -46,9 +55,13 @@ import UIKit
|
|||||||
body.styleB2(true)
|
body.styleB2(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
//--------------------------------------------------
|
||||||
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.setWithModel(model, delegateObject, additionalData)
|
||||||
|
|
||||||
eyebrow.setWithModel(casteModel?.eyebrow, delegateObject, additionalData)
|
eyebrow.setWithModel(casteModel?.eyebrow, delegateObject, additionalData)
|
||||||
headline.setWithModel(casteModel?.headline, delegateObject, additionalData)
|
headline.setWithModel(casteModel?.headline, delegateObject, additionalData)
|
||||||
body.setWithModel(casteModel?.body, delegateObject, additionalData)
|
body.setWithModel(casteModel?.body, delegateObject, additionalData)
|
||||||
|
|||||||
@ -9,6 +9,10 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public static var identifier: String = "eyebrowHeadlineBodyLink"
|
public static var identifier: String = "eyebrowHeadlineBodyLink"
|
||||||
public var moleculeName: String? = EyebrowHeadlineBodyLinkModel.identifier
|
public var moleculeName: String? = EyebrowHeadlineBodyLinkModel.identifier
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
@ -17,11 +21,15 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
public var body: LabelModel?
|
public var body: LabelModel?
|
||||||
public var link: LinkModel?
|
public var link: LinkModel?
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Initializer
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
public init(eyebrow: LabelModel? = nil, headline: LabelModel? = nil, body: LabelModel? = nil, link: LinkModel? = nil) throws {
|
public init(eyebrow: LabelModel? = nil, headline: LabelModel? = nil, body: LabelModel? = nil, link: LinkModel? = nil) throws {
|
||||||
// TODO: This class initializers should ensure that atleast one item is set.
|
// TODO: This class initializers should ensure that atleast one item is set.
|
||||||
/*guard eyebrow != nil || headline != nil || body != nil || link != nil else {
|
/*guard eyebrow != nil || headline != nil || body != nil || link != nil else {
|
||||||
throw
|
throw
|
||||||
}*/
|
}*/
|
||||||
self.eyebrow = eyebrow
|
self.eyebrow = eyebrow
|
||||||
self.headline = headline
|
self.headline = headline
|
||||||
self.body = body
|
self.body = body
|
||||||
@ -29,6 +37,10 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
setDefaults()
|
setDefaults()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Method
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Defaults to set
|
/// Defaults to set
|
||||||
public func setDefaults() {
|
public func setDefaults() {
|
||||||
if let headline = headline {
|
if let headline = headline {
|
||||||
@ -36,6 +48,10 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case backgroundColor
|
case backgroundColor
|
||||||
@ -45,6 +61,10 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
case link
|
case link
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// 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)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
@ -55,8 +75,8 @@ public class EyebrowHeadlineBodyLinkModel: MoleculeModelProtocol {
|
|||||||
setDefaults()
|
setDefaults()
|
||||||
// TODO: This class initializers should ensure that atleast one item is set.
|
// TODO: This class initializers should ensure that atleast one item is set.
|
||||||
/*guard eyebrow != nil || headline != nil || body != nil || link != nil else {
|
/*guard eyebrow != nil || headline != nil || body != nil || link != nil else {
|
||||||
throw
|
throw
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
|||||||
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
open class Stack<T>: Container where T: StackModelProtocol {
|
open class Stack<T>: Container where T: StackModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
@ -24,6 +25,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func pinView(_ view: UIView, toView: UIView, attribute: NSLayoutConstraint.Attribute, relation: NSLayoutConstraint.Relation, priority: UILayoutPriority, constant: CGFloat) {
|
public func pinView(_ view: UIView, toView: UIView, attribute: NSLayoutConstraint.Attribute, relation: NSLayoutConstraint.Relation, priority: UILayoutPriority, constant: CGFloat) {
|
||||||
|
|
||||||
let constraint = NSLayoutConstraint(item: view, attribute: attribute, relatedBy: relation, toItem: toView, attribute: attribute, multiplier: 1.0, constant: constant)
|
let constraint = NSLayoutConstraint(item: view, attribute: attribute, relatedBy: relation, toItem: toView, attribute: attribute, multiplier: 1.0, constant: constant)
|
||||||
constraint.priority = priority
|
constraint.priority = priority
|
||||||
constraint.isActive = true
|
constraint.isActive = true
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user