WIP: LabelsWithCircleProgressBar
This commit is contained in:
parent
ae00d57bd3
commit
35e7052abb
@ -130,6 +130,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 */; };
|
||||||
|
C7F8012323E846C300396FBD /* LabelsWithCircleProgressBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C7F8012223E846C300396FBD /* LabelsWithCircleProgressBarModel.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 */; };
|
||||||
@ -442,6 +444,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>"; };
|
||||||
|
C7F8012223E846C300396FBD /* LabelsWithCircleProgressBarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LabelsWithCircleProgressBarModel.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>"; };
|
||||||
@ -859,6 +863,8 @@
|
|||||||
C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */,
|
C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */,
|
||||||
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */,
|
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */,
|
||||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||||
|
C7F8012023E8303200396FBD /* LabelsWithCircleProgressBar.swift */,
|
||||||
|
C7F8012223E846C300396FBD /* LabelsWithCircleProgressBarModel.swift */,
|
||||||
);
|
);
|
||||||
path = VerticalCombinationViews;
|
path = VerticalCombinationViews;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1586,6 +1592,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 */,
|
||||||
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 */,
|
||||||
@ -1680,6 +1687,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 */,
|
||||||
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 */,
|
||||||
|
|||||||
@ -0,0 +1,91 @@
|
|||||||
|
//
|
||||||
|
// LabelsWithCircleProgressBar.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Arora, Prateek on 20/01/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
@objcMembers public class LabelsWithCircleProgressBar: Container {
|
||||||
|
|
||||||
|
let progressBar = GraphView(frame: .zero)
|
||||||
|
let leftLabel = Label(frame: .zero)
|
||||||
|
let rightLabel = Label(frame: .zero)
|
||||||
|
let leftLabelWidthConstant : CGFloat = 151.0
|
||||||
|
let rightLabelWidthConstant : CGFloat = 84.0
|
||||||
|
let progressBarTrailingConstant : CGFloat = -92.0
|
||||||
|
let progressBarLeadingConstant : CGFloat = 195.0
|
||||||
|
// MARK: - MVMCoreViewProtocol
|
||||||
|
open override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
progressBar.updateView(size)
|
||||||
|
leftLabel.updateView(size)
|
||||||
|
rightLabel.updateView(size)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
guard leftLabel.superview == nil else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
let container = MVMCoreUICommonViewsUtility.commonView()
|
||||||
|
addAndContain(container)
|
||||||
|
container.addSubview(progressBar)
|
||||||
|
container.addSubview(leftLabel)
|
||||||
|
container.addSubview(rightLabel)
|
||||||
|
|
||||||
|
self.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
leftLabel.leadingAnchor.constraint(equalTo: container.leadingAnchor),
|
||||||
|
leftLabel.topAnchor.constraint(equalTo: container.topAnchor),
|
||||||
|
leftLabel.bottomAnchor.constraint(equalTo: container.bottomAnchor),
|
||||||
|
leftLabel.widthAnchor.constraint(lessThanOrEqualToConstant: leftLabelWidthConstant)
|
||||||
|
])
|
||||||
|
|
||||||
|
let rightLabelTrailing = rightLabel.trailingAnchor.constraint(equalTo: container.trailingAnchor, constant:-PaddingHorizontalBetweenRelatedItems)
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
rightLabelTrailing,
|
||||||
|
rightLabel.leadingAnchor.constraint(greaterThanOrEqualTo : progressBar.trailingAnchor),
|
||||||
|
rightLabel.topAnchor.constraint(equalTo: container.topAnchor),
|
||||||
|
rightLabel.bottomAnchor.constraint(equalTo: container.bottomAnchor),
|
||||||
|
rightLabel.widthAnchor.constraint(lessThanOrEqualToConstant: rightLabelWidthConstant)
|
||||||
|
])
|
||||||
|
rightLabelTrailing.priority = .defaultHigh
|
||||||
|
|
||||||
|
NSLayoutConstraint.activate([
|
||||||
|
progressBar.trailingAnchor.constraint(equalTo: container.trailingAnchor, constant:progressBarTrailingConstant),
|
||||||
|
progressBar.topAnchor.constraint(equalTo: container.topAnchor),
|
||||||
|
progressBar.bottomAnchor.constraint(equalTo: container.bottomAnchor),
|
||||||
|
])
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
leftLabel.setWithJSON(json?.optionalDictionaryForKey("leftLabel"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
rightLabel.setWithJSON(json?.optionalDictionaryForKey("rightLabel"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
progressBar.setWithJSON(json?.optionalDictionaryForKey("progressBar"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
|
super.setWithModel(model, delegateObject, additionalData)
|
||||||
|
guard let model = model as? LabelsWithCircleProgressBarModel else { return }
|
||||||
|
leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData)
|
||||||
|
rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData)
|
||||||
|
progressBar.setWithModel(model.progressBar, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
super.reset()
|
||||||
|
leftLabel.reset()
|
||||||
|
rightLabel.reset()
|
||||||
|
progressBar.reset()
|
||||||
|
}
|
||||||
|
|
||||||
|
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
return 43
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,50 @@
|
|||||||
|
//
|
||||||
|
// LabelsWithCircleProgressBarModel.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Arora, Prateek on 03/02/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public class LabelsWithCircleProgressBarModel:MoleculeModelProtocol {
|
||||||
|
|
||||||
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
|
public static var identifier: String = "labelsWithCircleProgressBar"
|
||||||
|
public var leftLabel: LabelModel
|
||||||
|
public var rightLabel: LabelModel
|
||||||
|
public var progressBar : CircleProgressModel
|
||||||
|
|
||||||
|
init(leftLabel: LabelModel, rightLabel: LabelModel, progressBar: CircleProgressModel) {
|
||||||
|
self.leftLabel = leftLabel
|
||||||
|
self.rightLabel = rightLabel
|
||||||
|
self.progressBar = progressBar
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case moleculeName
|
||||||
|
case leftLabel
|
||||||
|
case rightLabel
|
||||||
|
case progressBar
|
||||||
|
}
|
||||||
|
|
||||||
|
required public init(from decoder: Decoder) throws {
|
||||||
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
leftLabel = try typeContainer.decode(LabelModel.self, forKey: .leftLabel)
|
||||||
|
rightLabel = try typeContainer.decode(LabelModel.self, forKey: .rightLabel)
|
||||||
|
progressBar = try typeContainer.decode(CircleProgressModel.self, forKey: .progressBar)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(LabelsWithCircleProgressBarModel.identifier, forKey: .moleculeName)
|
||||||
|
try container.encode(leftLabel, forKey: .leftLabel)
|
||||||
|
try container.encode(rightLabel, forKey: .rightLabel)
|
||||||
|
try container.encodeIfPresent(progressBar, forKey: .progressBar)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -62,6 +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)
|
||||||
|
|
||||||
// Left Right Molecules
|
// Left Right Molecules
|
||||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self)
|
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self)
|
||||||
@ -103,6 +104,7 @@ import Foundation
|
|||||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButtonLabel.self, forKey: "radioButtonLabel" as NSString)
|
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButtonLabel.self, forKey: "radioButtonLabel" as NSString)
|
||||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString)
|
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString)
|
||||||
|
|
||||||
|
|
||||||
// TODO: Need View
|
// TODO: Need View
|
||||||
ModelRegistry.register(TabsModel.self)
|
ModelRegistry.register(TabsModel.self)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user