WIP: New molecule changes

This commit is contained in:
Prateek Arora 2020-02-07 17:03:33 +05:30
parent 7572bf0214
commit 5ae5cfd2d8
4 changed files with 51 additions and 42 deletions

View File

@ -134,8 +134,8 @@
C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */; }; C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */; };
C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5123C77A4900A3614A /* NumberedList.swift */; }; C6FA7D5423C77A4A00A3614A /* NumberedList.swift in Sources */ = {isa = PBXBuildFile; fileRef = C6FA7D5123C77A4900A3614A /* NumberedList.swift */; };
C7192E7D23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */; }; C7192E7D23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */; };
C7F8012123E8303200396FBD /* LabelsWithCircleProgressBar.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F8012023E8303200396FBD /* LabelsWithCircleProgressBar.swift */; }; C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F8012023E8303200396FBD /* ListRVWheel.swift */; };
C7F8012323E846C300396FBD /* LabelsWithCircleProgressBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F8012223E846C300396FBD /* LabelsWithCircleProgressBarModel.swift */; }; C7F8012323E846C300396FBD /* ListRVWheelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F8012223E846C300396FBD /* ListRVWheelModel.swift */; };
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; }; D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */; };
D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; }; D213347723843825008E41B3 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = D213347623843825008E41B3 /* Line.swift */; };
D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D21EE53B23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift */; }; D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D21EE53B23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift */; };
@ -452,8 +452,8 @@
C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringAndMoleculeStack.swift; sourceTree = "<group>"; }; C6FA7D5023C77A4800A3614A /* StringAndMoleculeStack.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StringAndMoleculeStack.swift; sourceTree = "<group>"; };
C6FA7D5123C77A4900A3614A /* NumberedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberedList.swift; sourceTree = "<group>"; }; C6FA7D5123C77A4900A3614A /* NumberedList.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NumberedList.swift; sourceTree = "<group>"; };
C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadLineBodyCaretLinkImage.swift; sourceTree = "<group>"; }; C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadLineBodyCaretLinkImage.swift; sourceTree = "<group>"; };
C7F8012023E8303200396FBD /* LabelsWithCircleProgressBar.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabelsWithCircleProgressBar.swift; sourceTree = "<group>"; }; C7F8012023E8303200396FBD /* ListRVWheel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRVWheel.swift; sourceTree = "<group>"; };
C7F8012223E846C300396FBD /* LabelsWithCircleProgressBarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelsWithCircleProgressBarModel.swift; sourceTree = "<group>"; }; C7F8012223E846C300396FBD /* ListRVWheelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListRVWheelModel.swift; sourceTree = "<group>"; };
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; }; D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonView.swift; sourceTree = "<group>"; };
D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; }; D213347623843825008E41B3 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
D21EE53B23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLayoutConstraintAxis+Extension.swift"; sourceTree = "<group>"; }; D21EE53B23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSLayoutConstraintAxis+Extension.swift"; sourceTree = "<group>"; };
@ -875,8 +875,8 @@
C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */, C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */,
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */, D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */,
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */, 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
C7F8012023E8303200396FBD /* LabelsWithCircleProgressBar.swift */, C7F8012023E8303200396FBD /* ListRVWheel.swift */,
C7F8012223E846C300396FBD /* LabelsWithCircleProgressBarModel.swift */, C7F8012223E846C300396FBD /* ListRVWheelModel.swift */,
); );
path = VerticalCombinationViews; path = VerticalCombinationViews;
sourceTree = "<group>"; sourceTree = "<group>";
@ -1606,7 +1606,7 @@
D28A838B23CCDA6B00DFE4FC /* ButtonModel.swift in Sources */, D28A838B23CCDA6B00DFE4FC /* ButtonModel.swift in Sources */,
D28A838D23CCDCC200DFE4FC /* PrimaryButton+MoleculeProtocolExtension.swift in Sources */, D28A838D23CCDCC200DFE4FC /* PrimaryButton+MoleculeProtocolExtension.swift in Sources */,
D2A5145F2211DDC100345BFB /* MoleculeStackView.swift in Sources */, D2A5145F2211DDC100345BFB /* MoleculeStackView.swift in Sources */,
C7F8012323E846C300396FBD /* LabelsWithCircleProgressBarModel.swift in Sources */, C7F8012323E846C300396FBD /* ListRVWheelModel.swift in Sources */,
D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */, D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */,
C695A69623C990BC00BFB94E /* DoughnutChart.swift in Sources */, C695A69623C990BC00BFB94E /* DoughnutChart.swift in Sources */,
014AA72D23C5059B006F3E93 /* StackPageTemplateModel.swift in Sources */, 014AA72D23C5059B006F3E93 /* StackPageTemplateModel.swift in Sources */,
@ -1702,7 +1702,7 @@
D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */, D2A6390522CBCE160052ED1F /* MoleculeCollectionViewCell.swift in Sources */,
D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */, D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */,
D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */, D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */,
C7F8012123E8303200396FBD /* LabelsWithCircleProgressBar.swift in Sources */, C7F8012123E8303200396FBD /* ListRVWheel.swift in Sources */,
D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */, D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */,
D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */, D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */,
D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */, D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */,

View File

@ -1,5 +1,5 @@
// //
// LabelsWithCircleProgressBar.swift // ListRVWheel.swift
// MVMCoreUI // MVMCoreUI
// //
// Created by Arora, Prateek on 20/01/20. // Created by Arora, Prateek on 20/01/20.
@ -7,14 +7,14 @@
// //
import Foundation import Foundation
@objcMembers public class LabelsWithCircleProgressBar: Container { @objcMembers public class ListRVWheel: TableViewCell {
let progressBar = GraphView(frame: .zero) let wheel = GraphView(frame: .zero)
let leftLabel = Label(frame: .zero) let leftLabel = Label(frame: .zero)
let rightLabel = Label(frame: .zero) let rightLabel = Label(frame: .zero)
let leftLabelWidthConstant : CGFloat = 151.0 let leftLabelWidthConstant : CGFloat = 151.0
let rightLabelWidthConstant : CGFloat = 84.0 let rightLabelWidthConstant : CGFloat = 84.0
let progressBarTrailingConstant : CGFloat = -72.0 let wheelTrailingConstant : CGFloat = -72.0
let rightLabelLeadingAnchorConstant : CGFloat = 8.0 let rightLabelLeadingAnchorConstant : CGFloat = 8.0
//------------------------------------------------- //-------------------------------------------------
@ -22,7 +22,7 @@ import Foundation
//------------------------------------------------- //-------------------------------------------------
open override func updateView(_ size: CGFloat) { open override func updateView(_ size: CGFloat) {
super.updateView(size) super.updateView(size)
progressBar.updateView(size) wheel.updateView(size)
leftLabel.updateView(size) leftLabel.updateView(size)
rightLabel.updateView(size) rightLabel.updateView(size)
} }
@ -35,36 +35,36 @@ import Foundation
guard leftLabel.superview == nil else { guard leftLabel.superview == nil else {
return return
} }
let container = MVMCoreUICommonViewsUtility.commonView() contentView.addSubview(wheel)
addAndContain(container) contentView.addSubview(leftLabel)
container.addSubview(progressBar) contentView.addSubview(rightLabel)
container.addSubview(leftLabel) NSLayoutConstraint.constraintPinSubview(toSuperview: contentView)
container.addSubview(rightLabel) contentView.translatesAutoresizingMaskIntoConstraints = false
//------------------------------------------------- //-------------------------------------------------
// MARK: - Constraining // MARK: - Constraining
//------------------------------------------------- //-------------------------------------------------
self.translatesAutoresizingMaskIntoConstraints = false self.translatesAutoresizingMaskIntoConstraints = false
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
leftLabel.leadingAnchor.constraint(equalTo: container.leadingAnchor), leftLabel.leadingAnchor.constraint(equalTo: contentView.leadingAnchor),
leftLabel.topAnchor.constraint(equalTo: container.topAnchor), leftLabel.topAnchor.constraint(equalTo: contentView.topAnchor),
leftLabel.bottomAnchor.constraint(equalTo: container.bottomAnchor), leftLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
leftLabel.widthAnchor.constraint(lessThanOrEqualToConstant: leftLabelWidthConstant) leftLabel.widthAnchor.constraint(lessThanOrEqualToConstant: leftLabelWidthConstant)
]) ])
let rightLabelTrailing = rightLabel.trailingAnchor.constraint(equalTo: container.trailingAnchor) let rightLabelTrailing = rightLabel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor)
rightLabelTrailing.priority = .defaultHigh rightLabelTrailing.priority = .defaultHigh
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
rightLabelTrailing, rightLabelTrailing,
rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo : progressBar.trailingAnchor, constant: rightLabelLeadingAnchorConstant), rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo : wheel.trailingAnchor, constant: rightLabelLeadingAnchorConstant),
rightLabel.topAnchor.constraint(equalTo: container.topAnchor), rightLabel.topAnchor.constraint(equalTo: contentView.topAnchor),
rightLabel.bottomAnchor.constraint(equalTo: container.bottomAnchor), rightLabel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
rightLabel.widthAnchor.constraint(lessThanOrEqualToConstant: rightLabelWidthConstant) rightLabel.widthAnchor.constraint(lessThanOrEqualToConstant: rightLabelWidthConstant)
]) ])
NSLayoutConstraint.activate([ NSLayoutConstraint.activate([
progressBar.trailingAnchor.constraint(equalTo: container.trailingAnchor, constant:progressBarTrailingConstant), wheel.trailingAnchor.constraint(equalTo: contentView.trailingAnchor, constant:wheelTrailingConstant),
progressBar.topAnchor.constraint(equalTo: container.topAnchor), wheel.topAnchor.constraint(equalTo: contentView.topAnchor),
progressBar.bottomAnchor.constraint(equalTo: container.bottomAnchor), wheel.bottomAnchor.constraint(equalTo: contentView.bottomAnchor),
]) ])
} }
@ -73,10 +73,10 @@ import Foundation
//------------------------------------------------- //-------------------------------------------------
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
super.setWithModel(model, delegateObject, additionalData) super.setWithModel(model, delegateObject, additionalData)
guard let model = model as? LabelsWithCircleProgressBarModel else { return } guard let model = model as? ListRVWheelModel else { return }
leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData) leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData)
rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData) rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData)
progressBar.setWithModel(model.progressBar, delegateObject, additionalData) wheel.setWithModel(model.wheel, delegateObject, additionalData)
} }
//------------------------------------------------- //-------------------------------------------------
@ -86,7 +86,7 @@ import Foundation
super.reset() super.reset()
leftLabel.reset() leftLabel.reset()
rightLabel.reset() rightLabel.reset()
progressBar.reset() wheel.reset()
} }
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {

View File

@ -1,5 +1,5 @@
// //
// LabelsWithCircleProgressBarModel.swift // ListRVWheelModel.swift
// MVMCoreUI // MVMCoreUI
// //
// Created by Arora, Prateek on 03/02/20. // Created by Arora, Prateek on 03/02/20.
@ -7,34 +7,43 @@
// //
import Foundation import Foundation
public class LabelsWithCircleProgressBarModel:MoleculeModelProtocol { public class ListRVWheelModel:ListItemModelProtocol {
public var backgroundColor: Color? public var backgroundColor: Color?
public static var identifier: String = "labelsWithCircleProgressBar" public var line: LineModel?
public var hideArrow: Bool?
public var horizontalAlignment: UIStackView.Alignment?
public var verticalAlignment: UIStackView.Alignment?
public var useHorizontalMargins: Bool?
public var useVerticalMargins: Bool?
public var topMarginPadding: CGFloat?
public var bottomMarginPadding: CGFloat?
public static var identifier: String = "listRVWheel"
public var leftLabel: LabelModel? public var leftLabel: LabelModel?
public var rightLabel: LabelModel? public var rightLabel: LabelModel?
public var progressBar : CircleProgressModel? public var wheel : CircleProgressModel?
init(leftLabel: LabelModel, rightLabel: LabelModel, progressBar: CircleProgressModel) { init(leftLabel: LabelModel, rightLabel: LabelModel, wheel: CircleProgressModel) {
self.leftLabel = leftLabel self.leftLabel = leftLabel
self.rightLabel = rightLabel self.rightLabel = rightLabel
self.progressBar = progressBar self.wheel = wheel
} }
private enum CodingKeys: String,CodingKey { private enum CodingKeys: String,CodingKey {
case moleculeName case moleculeName
case leftLabel case leftLabel
case rightLabel case rightLabel
case progressBar case wheel
} }
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)
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel) leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel) rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel)
progressBar = try typeContainer.decode(CircleProgressModel.self, forKey: .progressBar) wheel = try typeContainer.decode(CircleProgressModel.self, forKey: .wheel)
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(LabelsWithCircleProgressBarModel.identifier, forKey: .moleculeName) try container.encode(ListRVWheelModel.identifier, forKey: .moleculeName)
try container.encode(leftLabel, forKey: .leftLabel) try container.encode(leftLabel, forKey: .leftLabel)
try container.encode(rightLabel, forKey: .rightLabel) try container.encode(rightLabel, forKey: .rightLabel)
try container.encodeIfPresent(progressBar, forKey: .progressBar) try container.encodeIfPresent(wheel, forKey: .wheel)
} }
} }

View File

@ -62,7 +62,7 @@ import Foundation
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self)
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass:LabelsWithCircleProgressBar.self, viewModelClass: LabelsWithCircleProgressBarModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self)
// Left Right Molecules // Left Right Molecules
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self)