Code improvement.
This commit is contained in:
parent
62e1d28305
commit
3734cae058
@ -6,7 +6,6 @@
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class ListProgressBarData: TableViewCell {
|
||||
@ -23,39 +22,23 @@ import UIKit
|
||||
//-----------------------------------------------------
|
||||
// MARK: - View Lifecycle
|
||||
//-----------------------------------------------------
|
||||
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
progressBar.updateView(size)
|
||||
leftLabel.updateView(size)
|
||||
rightLabel.updateView(size)
|
||||
|
||||
}
|
||||
|
||||
override open func setupView() {
|
||||
super.setupView()
|
||||
|
||||
contentView.addSubview(view)
|
||||
|
||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||
view.addSubview(progressBar)
|
||||
view.addSubview(leftLabel)
|
||||
view.addSubview(rightLabel)
|
||||
containerHelper.constrainView(view)
|
||||
|
||||
//constraints
|
||||
|
||||
addMolecule(view)
|
||||
NSLayoutConstraint.pinViews(leftView: leftLabel, rightView: rightLabel, alignTop: false)
|
||||
progressBar.leadingAnchor.constraint(equalTo: view.leadingAnchor).isActive = true
|
||||
progressBar.trailingAnchor.constraint(equalTo: view.trailingAnchor).isActive = true
|
||||
progressBar.topAnchor.constraint(equalTo: leftLabel.bottomAnchor, constant: PaddingTwo).isActive = true
|
||||
progressBar.bottomAnchor.constraint(equalTo: view.bottomAnchor).isActive = true
|
||||
|
||||
}
|
||||
view.bottomAnchor.constraint(equalTo: progressBar.bottomAnchor).isActive = true
|
||||
}
|
||||
|
||||
//----------------------------------------------------
|
||||
// MARK: - Molecule
|
||||
//------------------------------------------------------
|
||||
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? ListProgressBarDataModel else { return}
|
||||
progressBar.setWithModel(model.progressBar, delegateObject, additionalData)
|
||||
@ -63,16 +46,15 @@ import UIKit
|
||||
rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 90
|
||||
}
|
||||
|
||||
|
||||
override open func reset() {
|
||||
super.reset()
|
||||
progressBar.reset()
|
||||
leftLabel.styleB1(true)
|
||||
rightLabel.styleB1(true)
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 90
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -10,15 +10,10 @@ import Foundation
|
||||
|
||||
public class ListProgressBarDataModel : ListItemModel, MoleculeModelProtocol {
|
||||
public static var identifier: String = "listPrgBarData"
|
||||
|
||||
public var progressBar : MultiProgressBarModel
|
||||
public var leftLabel: LabelModel
|
||||
public var rightLabel: LabelModel
|
||||
|
||||
override public func setDefaults() {
|
||||
super.setDefaults()
|
||||
}
|
||||
|
||||
|
||||
public init (progressBar: MultiProgressBarModel, leftLabel: LabelModel, rightLabel: LabelModel){
|
||||
self.progressBar = progressBar
|
||||
self.leftLabel = leftLabel
|
||||
@ -48,6 +43,5 @@ public class ListProgressBarDataModel : ListItemModel, MoleculeModelProtocol {
|
||||
try container.encode(progressBar, forKey: .progressBar)
|
||||
try container.encode(leftLabel, forKey: .leftLabel)
|
||||
try container.encode(rightLabel, forKey: .rightLabel)
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user