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