alighing with merge.
This commit is contained in:
commit
af83a2aa1e
@ -305,6 +305,11 @@
|
||||
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */; };
|
||||
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */; };
|
||||
D2E2A98323D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A98223D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift */; };
|
||||
D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99323D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift */; };
|
||||
D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99523D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift */; };
|
||||
D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */; };
|
||||
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */; };
|
||||
D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99B23D8D975000B42E6 /* ImageHeadlineBodyModel.swift */; };
|
||||
D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2FB151A23A2B65B00C20E10 /* MoleculeContainer.swift */; };
|
||||
D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2FB151C23A40F1500C20E10 /* MoleculeStackItem.swift */; };
|
||||
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */; };
|
||||
@ -618,6 +623,11 @@
|
||||
D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerTableViewController.swift; sourceTree = "<group>"; };
|
||||
D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListTemplate.swift; sourceTree = "<group>"; };
|
||||
D2E2A98223D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EyebrowHeadlineBodyLinkModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99323D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyLinkModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99523D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyLinkToggleModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionDetailWithImageModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyButtonModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99B23D8D975000B42E6 /* ImageHeadlineBodyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageHeadlineBodyModel.swift; sourceTree = "<group>"; };
|
||||
D2F4DDE52371A4CB00CD28BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
D2FB151A23A2B65B00C20E10 /* MoleculeContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeContainer.swift; sourceTree = "<group>"; };
|
||||
D2FB151C23A40F1500C20E10 /* MoleculeStackItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeStackItem.swift; sourceTree = "<group>"; };
|
||||
@ -808,11 +818,12 @@
|
||||
D224798823142BF2003FCCF9 /* SwitchMolecules */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2E2A99523D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift */,
|
||||
01509D942327ED1900EF99AA /* HeadlineBodyTextButtonSwitch.swift */,
|
||||
01C851D223CF9E740021F976 /* LabelToggleModel.swift */,
|
||||
D22479892314445E003FCCF9 /* LabelSwitch.swift */,
|
||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
||||
0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */,
|
||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
||||
);
|
||||
path = SwitchMolecules;
|
||||
sourceTree = "<group>";
|
||||
@ -823,11 +834,14 @@
|
||||
D29E28D423D1FFFA00ACEA85 /* Lists */,
|
||||
01EB368D23609801006832FA /* HeadlineBodyModel.swift */,
|
||||
D2A638FC22CA98280052ED1F /* HeadlineBody.swift */,
|
||||
D2E2A99323D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift */,
|
||||
D22479952316AF6D003FCCF9 /* HeadlineBodyTextButton.swift */,
|
||||
D2E2A98223D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift */,
|
||||
D27CD40F2339057800C1DC07 /* EyebrowHeadlineBodyLink.swift */,
|
||||
D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */,
|
||||
C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */,
|
||||
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */,
|
||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||
);
|
||||
path = VerticalCombinationViews;
|
||||
sourceTree = "<group>";
|
||||
@ -835,6 +849,7 @@
|
||||
D224798E2316A995003FCCF9 /* HorizontalCombinationViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2E2A99B23D8D975000B42E6 /* ImageHeadlineBodyModel.swift */,
|
||||
D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */,
|
||||
D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */,
|
||||
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */,
|
||||
@ -846,6 +861,8 @@
|
||||
D224798F2316A99F003FCCF9 /* LeftRightViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */,
|
||||
0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */,
|
||||
D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */,
|
||||
01509D902327ECE600EF99AA /* CornerLabels.swift */,
|
||||
D224798823142BF2003FCCF9 /* SwitchMolecules */,
|
||||
@ -996,7 +1013,6 @@
|
||||
D224798F2316A99F003FCCF9 /* LeftRightViews */,
|
||||
D224798E2316A995003FCCF9 /* HorizontalCombinationViews */,
|
||||
D224798D2316A988003FCCF9 /* VerticalCombinationViews */,
|
||||
0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */,
|
||||
01EB368C23609801006832FA /* HeaderModel.swift */,
|
||||
D2A514662213885800345BFB /* HeaderView.swift */,
|
||||
012A88EB238F084D00FE3DA1 /* FooterModel.swift */,
|
||||
@ -1006,7 +1022,6 @@
|
||||
D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */,
|
||||
D28A838423CCCA8900DFE4FC /* ScrollerModel.swift */,
|
||||
D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */,
|
||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||
017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */,
|
||||
017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */,
|
||||
017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */,
|
||||
@ -1511,6 +1526,7 @@
|
||||
D27CD40E2322EEAF00C1DC07 /* TabsTableViewCell.swift in Sources */,
|
||||
D224799B231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift in Sources */,
|
||||
D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */,
|
||||
D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */,
|
||||
01004F3022721C3800991ECC /* RadioButton.swift in Sources */,
|
||||
D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */,
|
||||
017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */,
|
||||
@ -1532,6 +1548,7 @@
|
||||
012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */,
|
||||
D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */,
|
||||
D260106323D0C05000764D80 /* StackItemModel.swift in Sources */,
|
||||
D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */,
|
||||
01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */,
|
||||
0A21DB7F235DECC500C160A2 /* EntryField.swift in Sources */,
|
||||
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
|
||||
@ -1550,6 +1567,7 @@
|
||||
D260106123D0C02A00764D80 /* StackItemModelProtocol.swift in Sources */,
|
||||
012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */,
|
||||
94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */,
|
||||
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */,
|
||||
014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */,
|
||||
017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */,
|
||||
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
||||
@ -1565,6 +1583,7 @@
|
||||
944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */,
|
||||
D213347723843825008E41B3 /* Line.swift in Sources */,
|
||||
D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */,
|
||||
D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */,
|
||||
D28A837F23CCA96400DFE4FC /* TabsModel.swift in Sources */,
|
||||
012A88EC238F084D00FE3DA1 /* FooterModel.swift in Sources */,
|
||||
D2A514672213885800345BFB /* HeaderView.swift in Sources */,
|
||||
@ -1622,6 +1641,7 @@
|
||||
011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */,
|
||||
94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */,
|
||||
944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */,
|
||||
D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */,
|
||||
C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */,
|
||||
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
|
||||
D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */,
|
||||
|
||||
@ -333,6 +333,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let toggleModel = model as? ToggleModel else {
|
||||
return
|
||||
@ -341,6 +342,10 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
||||
let toggleModelJSON = toggleModel.toJSON()
|
||||
setWithJSON(toggleModelJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return Self.getContainerHeight()
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Accessibility
|
||||
|
||||
@ -84,22 +84,22 @@ public typealias ButtonAction = (Button) -> ()
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
self.model = model
|
||||
if let backgroundColor = model?.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
}
|
||||
}
|
||||
|
||||
public class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
open class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
return model?.moleculeName
|
||||
}
|
||||
|
||||
public class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
open class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return nil
|
||||
}
|
||||
|
||||
public class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||
open class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,22 +48,22 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
self.model = model
|
||||
if let backgroundColor = model?.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
}
|
||||
}
|
||||
|
||||
public class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
open class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
return model?.moleculeName
|
||||
}
|
||||
|
||||
public class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
open class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return nil
|
||||
}
|
||||
|
||||
public class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||
open class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -47,15 +47,15 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
public class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
open class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
return model?.moleculeName
|
||||
}
|
||||
|
||||
public class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
open class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return nil
|
||||
}
|
||||
|
||||
public class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||
open class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers open class ImageHeadlineBody: ViewConstrainingView {
|
||||
@objcMembers open class ImageHeadlineBody: View {
|
||||
let headlineBody = HeadlineBody(frame: .zero)
|
||||
let imageView = MFLoadImageView()
|
||||
var constraintBetweenImageLabelsConstant: CGFloat = 16
|
||||
@ -23,27 +23,24 @@ import UIKit
|
||||
headlineBody.headlineLabel.styleB1(true)
|
||||
headlineBody.spaceBetweenLabelsConstant = 0
|
||||
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
pinView(toSuperView: view)
|
||||
view.addSubview(headlineBody)
|
||||
view.addSubview(imageView)
|
||||
addSubview(headlineBody)
|
||||
addSubview(imageView)
|
||||
|
||||
headlineBody.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||
view.rightAnchor.constraint(equalTo: headlineBody.rightAnchor).isActive = true
|
||||
view.bottomAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor).isActive = true
|
||||
var constraint = view.bottomAnchor.constraint(equalTo: headlineBody.bottomAnchor)
|
||||
headlineBody.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||
rightAnchor.constraint(equalTo: headlineBody.rightAnchor).isActive = true
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor).isActive = true
|
||||
var constraint = bottomAnchor.constraint(equalTo: headlineBody.bottomAnchor)
|
||||
constraint.priority = .defaultLow
|
||||
constraint.isActive = true
|
||||
|
||||
imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
|
||||
imageView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
imageView.topAnchor.constraint(greaterThanOrEqualTo: view.topAnchor).isActive = true
|
||||
view.bottomAnchor.constraint(greaterThanOrEqualTo: imageView.bottomAnchor).isActive = true
|
||||
constraint = view.bottomAnchor.constraint(equalTo: imageView.bottomAnchor)
|
||||
imageView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
||||
imageView.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
|
||||
imageView.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: imageView.bottomAnchor).isActive = true
|
||||
constraint = bottomAnchor.constraint(equalTo: imageView.bottomAnchor)
|
||||
constraint.priority = UILayoutPriority(rawValue: 200)
|
||||
constraint.isActive = true
|
||||
constraint = imageView.topAnchor.constraint(equalTo: view.topAnchor)
|
||||
constraint = imageView.topAnchor.constraint(equalTo: topAnchor)
|
||||
constraint.priority = UILayoutPriority(rawValue: 200)
|
||||
constraint.isActive = true
|
||||
|
||||
@ -58,22 +55,6 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
let imageJSON = json?.optionalDictionaryForKey("image")
|
||||
imageView.setWithJSON(imageJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||
constraintBetweenImageLabels?.constant = imageJSON != nil ? constraintBetweenImageLabelsConstant : 0
|
||||
}
|
||||
|
||||
open override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
headlineBody.setAsMolecule()
|
||||
imageView.setAsMolecule()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
headlineBody.reset()
|
||||
@ -82,7 +63,15 @@ import UIKit
|
||||
imageView.reset()
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 95
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? ImageHeadlineBodyModel else { return }
|
||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
||||
imageView.setWithModel(model.image, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
//
|
||||
// File.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ImageHeadlineBodyModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "imageHeadlineBody"
|
||||
public var backgroundColor: Color?
|
||||
public var image: ImageViewModel
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
public class TwoButtonViewModel: MoleculeModelProtocol {
|
||||
public struct TwoButtonViewModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "twoButtonView"
|
||||
public var backgroundColor: Color?
|
||||
public var primaryButton: ButtonModel?
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class DropDownListItemModel: MoleculeContainerModel, ListItemModelProtocol {
|
||||
@objcMembers public class DropDownListItemModel: ContainerModel, ListItemModelProtocol {
|
||||
public static var identifier: String = "dropDownListItem"
|
||||
public var molecules: [[ListItemModelProtocol]]
|
||||
public var dropDown: ItemDropdownEntryFieldModel
|
||||
@ -16,10 +16,10 @@ import Foundation
|
||||
public var line: LineModel? = LineModel(type: .none)
|
||||
public var hideArrow: Bool? = true
|
||||
|
||||
public init(molecule: MoleculeModelProtocol, molecules: [[ListItemModelProtocol]], dropDown: ItemDropdownEntryFieldModel) {
|
||||
public init(molecules: [[ListItemModelProtocol]], dropDown: DropDownModel) {
|
||||
self.molecules = molecules
|
||||
self.dropDown = dropDown
|
||||
super.init(with: molecule)
|
||||
super.init()
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
|
||||
55
MVMCoreUI/Molecules/Items/DropDownListItemModel.swift.orig
Normal file
55
MVMCoreUI/Molecules/Items/DropDownListItemModel.swift.orig
Normal file
@ -0,0 +1,55 @@
|
||||
//
|
||||
// DropDownListItemModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Suresh, Kamlesh on 12/12/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class DropDownListItemModel: ContainerModel, ListItemModelProtocol {
|
||||
public static var identifier: String = "dropDownListItem"
|
||||
public var molecules: [[ListItemModelProtocol]]
|
||||
public var dropDown: ItemDropdownEntryFieldModel
|
||||
public var backgroundColor: Color?
|
||||
public var line: LineModel? = LineModel(type: .none)
|
||||
public var hideArrow: Bool? = true
|
||||
|
||||
<<<<<<< HEAD
|
||||
public init(molecule: MoleculeModelProtocol, molecules: [[ListItemModelProtocol]], dropDown: ItemDropdownEntryFieldModel) {
|
||||
=======
|
||||
public init(molecules: [[ListItemModelProtocol]], dropDown: DropDownModel) {
|
||||
>>>>>>> remotes/origin/feature/coding
|
||||
self.molecules = molecules
|
||||
self.dropDown = dropDown
|
||||
super.init()
|
||||
}
|
||||
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case molecules
|
||||
case dropDown
|
||||
case line
|
||||
case backgroundColor
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
molecules = try typeContainer.decodeMolecules2D(codingKey: .molecules) as! [[ListItemModelProtocol]]
|
||||
dropDown = try typeContainer.decode(ItemDropdownEntryFieldModel.self, forKey: .dropDown)
|
||||
if let lineModel = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) {
|
||||
line = lineModel
|
||||
}
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeModels2D(molecules, forKey: .molecules)
|
||||
try container.encode(dropDown, forKey: .dropDown)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeIfPresent(line, forKey: .line)
|
||||
}
|
||||
}
|
||||
@ -13,12 +13,14 @@ import UIKit
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let moleculeModel = (model as? ListItemModel)?.molecule else { return }
|
||||
guard let model = model as? ListItemModel else { return }
|
||||
if molecule != nil {
|
||||
(molecule as? ModelMoleculeViewProtocol)?.setWithModel(moleculeModel, delegateObject, additionalData)
|
||||
} else if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(moleculeModel, delegateObject, false) {
|
||||
(molecule as? ModelMoleculeViewProtocol)?.setWithModel(model.molecule, delegateObject, additionalData)
|
||||
} else if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(model.molecule, delegateObject, false) {
|
||||
addMolecule(moleculeView)
|
||||
}
|
||||
|
||||
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
||||
}
|
||||
|
||||
public override class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
|
||||
@ -168,9 +168,6 @@ import UIKit
|
||||
addSeparatorsIfNeeded()
|
||||
bottomSeparatorView?.setWithModel(separator, nil, nil)
|
||||
}
|
||||
|
||||
guard let molecule = molecule else { return }
|
||||
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
||||
}
|
||||
|
||||
open func reset() {
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
|
||||
@objcMembers open class ActionDetailWithImage: ViewConstrainingView {
|
||||
@objcMembers open class ActionDetailWithImage: View {
|
||||
//------------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//------------------------------------------------------
|
||||
@ -91,10 +91,6 @@ import UIKit
|
||||
imageLoader.updateView(size)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
return 197
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Methods
|
||||
//------------------------------------------------------
|
||||
@ -117,20 +113,15 @@ import UIKit
|
||||
setDefaultState()
|
||||
}
|
||||
|
||||
open override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
|
||||
headlineBodyButton.setAsMolecule()
|
||||
imageLoader.setAsMolecule()
|
||||
setDefaultState()
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 197
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
guard let dictionary = json else { return }
|
||||
|
||||
headlineBodyButton.setWithJSON(dictionary.optionalDictionaryForKey("headlineBodyButton"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), 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? ActionDetailWithImageModel else { return }
|
||||
headlineBodyButton.setWithModel(model.headlineBodyButton, delegateObject, additionalData)
|
||||
imageLoader.setWithModel(model.image, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
//
|
||||
// ActionDetailWithImageModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ActionDetailWithImageModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "actionDetailWithImage"
|
||||
public var backgroundColor: Color?
|
||||
public var headlineBodyButton: HeadlineBodyButtonModel
|
||||
public var image: ImageViewModel
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
//
|
||||
// HeadlineBodyLinkToggleModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
public struct HeadlineBodyLinkToggleModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyLinkToggle"
|
||||
public var backgroundColor: Color?
|
||||
public var headlineBodyLink: HeadlineBodyLinkModel
|
||||
public var toggle: ToggleModel
|
||||
|
||||
public init(_ headlineBodyLink: HeadlineBodyLinkModel, _ toggle: ToggleModel) {
|
||||
self.headlineBodyLink = headlineBodyLink
|
||||
self.toggle = toggle
|
||||
}
|
||||
}
|
||||
@ -34,9 +34,7 @@ import UIKit
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: toggle)
|
||||
}
|
||||
|
||||
|
||||
//MARK: - MVMCoreMoleculeViewProtocol
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else {
|
||||
@ -45,32 +43,18 @@ import UIKit
|
||||
setWithJSON(headlineBodyToggleModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
public class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 30
|
||||
open class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
guard let model = molecule as? HeadlineBodyToggleModel,
|
||||
let toggleHeight = Toggle.estimatedHeight(forRow: model.toggle, delegateObject: delegateObject),
|
||||
let headlineBody = HeadlineBody.estimatedHeight(forRow: model.headlineBody, delegateObject: delegateObject) else { return nil }
|
||||
return max(toggleHeight, headlineBody)
|
||||
}
|
||||
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
toggle.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
open class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
return 30
|
||||
}
|
||||
|
||||
open override func setAsMolecule() {
|
||||
headlineBody.setAsMolecule()
|
||||
(toggle as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
||||
headlineBody.styleListItem()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
headlineBody.reset()
|
||||
(toggle as MVMCoreUIMoleculeViewProtocol).reset?()
|
||||
toggle.reset()
|
||||
headlineBody.styleListItem()
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,55 +8,45 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class HeadlineBodyTextButtonSwitch: ViewConstrainingView {
|
||||
let headlineBodyTextButton = HeadlineBodyTextButton(frame: .zero)
|
||||
let mvmSwitch = MVMCoreUISwitch.mvmSwitchDefault()
|
||||
@objcMembers public class HeadlineBodyTextButtonSwitch: View {
|
||||
let headlineBodyLink = HeadlineBodyTextButton(frame: .zero)
|
||||
let toggle = Toggle()
|
||||
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
headlineBodyTextButton.updateView(size)
|
||||
mvmSwitch.updateView(size)
|
||||
headlineBodyLink.updateView(size)
|
||||
toggle.updateView(size)
|
||||
}
|
||||
|
||||
public override func setupView() {
|
||||
super.setupView()
|
||||
guard mvmSwitch.superview == nil else {
|
||||
guard toggle.superview == nil else {
|
||||
return
|
||||
}
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
pinView(toSuperView: view)
|
||||
|
||||
headlineBodyTextButton.headlineBody.styleListItem()
|
||||
view.addSubview(headlineBodyTextButton)
|
||||
view.addSubview(mvmSwitch)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBodyTextButton, rightView: mvmSwitch)
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBodyTextButton.setWithJSON(json?.optionalDictionaryForKey("headlineBodyLink"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
return HeadlineBodyTextButton.estimatedHeight(forRow: json, delegateObject: delegateObject)
|
||||
}
|
||||
|
||||
public override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
headlineBodyTextButton.setAsMolecule()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
||||
headlineBodyTextButton.headlineBody.styleListItem()
|
||||
headlineBodyLink.headlineBody.styleListItem()
|
||||
addSubview(headlineBodyLink)
|
||||
addSubview(toggle)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBodyLink, rightView: toggle)
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtoco
|
||||
public override func reset() {
|
||||
super.reset()
|
||||
headlineBodyTextButton.reset()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).reset?()
|
||||
headlineBodyTextButton.headlineBody.styleListItem()
|
||||
headlineBodyLink.reset()
|
||||
toggle.reset()
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadlineBodyLinkToggleModel else { return }
|
||||
headlineBodyLink.setWithModel(model.headlineBodyLink, delegateObject, additionalData)
|
||||
toggle.setWithModel(model.toggle, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return HeadlineBodyTextButton.estimatedHeight(forRow: (molecule as? HeadlineBodyLinkToggleModel)?.headlineBodyLink, delegateObject: delegateObject)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -8,62 +8,50 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class LabelSwitch: ViewConstrainingView, ModelMoleculeViewProtocol {
|
||||
let label = Label.commonLabelB1(true)
|
||||
let mvmSwitch = Toggle()
|
||||
@objcMembers open class LabelSwitch: View {
|
||||
public let label = Label.commonLabelB1(true)
|
||||
public let toggle = Toggle()
|
||||
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
label.updateView(size)
|
||||
mvmSwitch.updateView(size)
|
||||
toggle.updateView(size)
|
||||
}
|
||||
|
||||
public override func setupView() {
|
||||
open override func setupView() {
|
||||
super.setupView()
|
||||
guard mvmSwitch.superview == nil else {
|
||||
guard toggle.superview == nil else {
|
||||
return
|
||||
}
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
pinView(toSuperView: view)
|
||||
|
||||
view.addSubview(label)
|
||||
view.addSubview(mvmSwitch)
|
||||
addSubview(label)
|
||||
addSubview(toggle)
|
||||
label.setContentHuggingPriority(UILayoutPriority.required, for: NSLayoutConstraint.Axis.vertical)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: label, rightView: mvmSwitch)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: label, rightView: toggle)
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
label.setWithJSON(json?.optionalDictionaryForKey("label"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
guard let model = molecule as? LabelToggleModel,
|
||||
let toggleHeight = Toggle.estimatedHeight(forRow: model.toggle, delegateObject: delegateObject),
|
||||
let labelHeight = Label.estimatedHeight(forRow: model.label, delegateObject: delegateObject) else { return nil }
|
||||
return max(toggleHeight, labelHeight)
|
||||
}
|
||||
|
||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let labelToggleModel = model as? LabelToggleModel else {
|
||||
return
|
||||
}
|
||||
label.setWithModel(labelToggleModel.label, delegateObject, additionalData)
|
||||
mvmSwitch.setWithModel(labelToggleModel.toggle, delegateObject, additionalData)
|
||||
toggle.setWithModel(labelToggleModel.toggle, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
return MVMCoreUISwitch.estimatedHeight(forRow: json, delegateObject: delegateObject)
|
||||
}
|
||||
|
||||
public override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
label.setAsMolecule()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
||||
label.styleB1(true)
|
||||
}
|
||||
|
||||
public override func reset() {
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
label.reset()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).reset?()
|
||||
toggle.reset()
|
||||
label.styleB1(true)
|
||||
}
|
||||
}
|
||||
|
||||
@ -35,7 +35,16 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
stack.reset()
|
||||
stack.stackModel?.spacing = 0
|
||||
eyebrow.styleB3(true)
|
||||
headline.styleB1(true)
|
||||
body.styleB2(true)
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
eyebrow.setWithModel(casteModel?.eyeBrow, delegateObject, additionalData)
|
||||
@ -50,20 +59,6 @@ import UIKit
|
||||
stack.restack()
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: EyebrowHeadlineBodyLinkModel.self) else { return }
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
stack.reset()
|
||||
stack.stackModel?.spacing = 0
|
||||
eyebrow.styleB3(true)
|
||||
headline.styleB1(true)
|
||||
body.styleB2(true)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 65
|
||||
}
|
||||
|
||||
@ -75,6 +75,7 @@ import Foundation
|
||||
backgroundImageView.reset()
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 320
|
||||
}
|
||||
|
||||
@ -119,6 +119,11 @@ open class HeadlineBody: View {
|
||||
}
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 58
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
|
||||
@ -107,29 +107,16 @@ import UIKit
|
||||
defaultState()
|
||||
}
|
||||
|
||||
open override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
|
||||
headlineBody.setAsMolecule()
|
||||
button.setAsMolecule()
|
||||
defaultState()
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 320
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
guard let dictionary = json else { return }
|
||||
|
||||
if let padding = dictionary.optionalCGFloatForKey("buttonHeadlinePadding") {
|
||||
buttonHeadlinePadding = padding
|
||||
}
|
||||
|
||||
headlineBody.setWithJSON(dictionary.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
if let buttonDictionary = dictionary.optionalDictionaryForKey("button") {
|
||||
button.setWithJSON(buttonDictionary, delegateObject: delegateObject, additionalData: additionalData)
|
||||
} else {
|
||||
button.isHidden = true
|
||||
}
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadlineBodyButtonModel else { return }
|
||||
buttonHeadlinePadding = model.buttonHeadlinePadding
|
||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
||||
button.setWithModel(model.button, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
//
|
||||
// HeadlineBodyButtonModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct HeadlineBodyButtonModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyButton"
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
public var button: ButtonModel
|
||||
public var buttonHeadlinePadding: CGFloat
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
//
|
||||
// HeadlineBodyLinkModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct HeadlineBodyLinkModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyLink"
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
public var link: LinkModel
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public init(headlineBody: HeadlineBodyModel, link: LinkModel) {
|
||||
self.headlineBody = headlineBody
|
||||
self.link = link
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class HeadlineBodyTextButton: ViewConstrainingView {
|
||||
@objcMembers public class HeadlineBodyTextButton: View {
|
||||
|
||||
let headlineBody = HeadlineBody(frame: .zero)
|
||||
let textButton = MFTextButton(nil, constrainHeight: true, forWidth: MVMCoreUIUtility.getWidth())
|
||||
let link = Link()
|
||||
var spaceBetweenConstant: CGFloat = 0.0
|
||||
var spaceBetween: NSLayoutConstraint?
|
||||
|
||||
@ -19,7 +19,7 @@ import UIKit
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
headlineBody.updateView(size)
|
||||
textButton.updateView(size)
|
||||
link.updateView(size)
|
||||
setSpacing()
|
||||
}
|
||||
|
||||
@ -28,34 +28,30 @@ import UIKit
|
||||
guard subviews.count == 0 else {
|
||||
return
|
||||
}
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
pinView(toSuperView: view)
|
||||
|
||||
view.addSubview(headlineBody)
|
||||
view.addSubview(textButton)
|
||||
addSubview(headlineBody)
|
||||
addSubview(link)
|
||||
headlineBody.styleListItem()
|
||||
|
||||
headlineBody.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
|
||||
headlineBody.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
var constraint = view.rightAnchor.constraint(equalTo: headlineBody.rightAnchor)
|
||||
headlineBody.topAnchor.constraint(equalTo: topAnchor, constant: 0).isActive = true
|
||||
headlineBody.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
|
||||
var constraint = rightAnchor.constraint(equalTo: headlineBody.rightAnchor)
|
||||
constraint.priority = .defaultHigh
|
||||
constraint.isActive = true
|
||||
|
||||
spaceBetween = textButton.topAnchor.constraint(equalTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant)
|
||||
spaceBetween = link.topAnchor.constraint(equalTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant)
|
||||
spaceBetween?.isActive = true
|
||||
|
||||
textButton.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
view.bottomAnchor.constraint(equalTo: textButton.bottomAnchor).isActive = true
|
||||
view.rightAnchor.constraint(greaterThanOrEqualTo: textButton.rightAnchor).isActive = true
|
||||
constraint = view.rightAnchor.constraint(equalTo: textButton.rightAnchor)
|
||||
link.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
|
||||
bottomAnchor.constraint(equalTo: link.bottomAnchor).isActive = true
|
||||
rightAnchor.constraint(greaterThanOrEqualTo: link.rightAnchor).isActive = true
|
||||
constraint = rightAnchor.constraint(equalTo: link.rightAnchor)
|
||||
constraint.priority = .defaultHigh
|
||||
constraint.isActive = true
|
||||
}
|
||||
|
||||
// MARK: - Constraining
|
||||
public func setSpacing() {
|
||||
if headlineBody.hasText() && (textButton.titleLabel?.text?.count ?? 0) > 0 {
|
||||
if headlineBody.hasText() && (link.titleLabel?.text?.count ?? 0) > 0 {
|
||||
spaceBetween?.constant = spaceBetweenConstant
|
||||
} else {
|
||||
spaceBetween?.constant = 0
|
||||
@ -63,20 +59,22 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
textButton.setWithJSON(json?.optionalDictionaryForKey("link"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
headlineBody.reset()
|
||||
headlineBody.styleListItem()
|
||||
textButton.reset()
|
||||
link.reset()
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadlineBodyLinkModel else { return }
|
||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
||||
link.setWithModel(model.link, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 60
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,6 @@ open class Carousel: View {
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
//TODO: Model, Change to model
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let carouselModel = model as? CarouselModel else { return }
|
||||
|
||||
@ -14,11 +14,21 @@ open class MoleculeStackView: Stack<MoleculeStackModel> {
|
||||
}
|
||||
|
||||
/// Convenience function, adds a molecule to a MoleculeStackItem to the MoleculeStack
|
||||
func addMolecule(_ view: View, lastItem: Bool) {
|
||||
guard let model = view.model else { return }
|
||||
let stackItemModel = MoleculeStackItemModel(with: model)
|
||||
let stackItem = MoleculeStackItem(andContain: view)
|
||||
addView(stackItem, stackItemModel, lastItem: lastItem)
|
||||
func setup(with views: [View], lastItem: Bool) {
|
||||
var models: [MoleculeStackItemModel] = []
|
||||
for view in views {
|
||||
guard let model = view.model else { return }
|
||||
let stackItemModel = MoleculeStackItemModel(with: model)
|
||||
let stackItem = MoleculeStackItem(andContain: view)
|
||||
stackItems.append(stackItem)
|
||||
models.append(stackItemModel)
|
||||
}
|
||||
if let stackModel = stackModel {
|
||||
stackModel.molecules = models
|
||||
} else {
|
||||
model = MoleculeStackModel(molecules: models)
|
||||
}
|
||||
restack()
|
||||
}
|
||||
|
||||
// MARK: - Adding to stack
|
||||
|
||||
@ -31,8 +31,10 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
||||
let lastItemIndex = stackModel.molecules.lastIndex(where: { (item) -> Bool in
|
||||
return !item.gone
|
||||
})
|
||||
|
||||
// Adds the views
|
||||
for (index, view) in stackItems.enumerated() {
|
||||
addView(view, stackModel.molecules[index], lastItem: lastItemIndex == index)
|
||||
addView(view, stackModel.molecules[index], percentModifier: getPercentModifier(), lastItem: lastItemIndex == index)
|
||||
}
|
||||
}
|
||||
|
||||
@ -170,15 +172,28 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
||||
}
|
||||
|
||||
// MARK: - Adding to stack
|
||||
/// Convenience function, adds a view to a StackItem to the Stack
|
||||
func addViewToItemToStack(_ view: UIView, lastItem: Bool) {
|
||||
let stackItemModel = StackItemModel()
|
||||
let stackItem = StackItem(andContain: view)
|
||||
addView(stackItem, stackItemModel, lastItem: lastItem)
|
||||
/// Gets the percent modifier. This value is used to help properly calculate percent for stack items when spacing is involved.
|
||||
private func getPercentModifier() -> CGFloat {
|
||||
guard let stackModel = stackModel else { return 0.0 }
|
||||
var totalSpace: CGFloat = 0.0
|
||||
var totalViews = 0
|
||||
var firstMoleculeFound = false
|
||||
for stackItemModel in stackModel.molecules {
|
||||
guard !stackItemModel.gone else { continue }
|
||||
totalViews += 1
|
||||
let spacing = stackItemModel.spacing ?? stackModel.spacing
|
||||
if firstMoleculeFound {
|
||||
totalSpace += spacing
|
||||
} else {
|
||||
firstMoleculeFound = true
|
||||
totalSpace += (stackModel.useStackSpacingBeforeFirstItem ? spacing : stackItemModel.spacing ?? 0)
|
||||
}
|
||||
}
|
||||
return (totalViews > 0 ? -(totalSpace / CGFloat(totalViews)) : 0)
|
||||
}
|
||||
|
||||
/// Adds the stack item view
|
||||
func addView(_ view: UIView,_ model: StackItemModelProtocol, lastItem: Bool) {
|
||||
private func addView(_ view: UIView,_ model: StackItemModelProtocol, percentModifier: CGFloat, lastItem: Bool) {
|
||||
guard let stackModel = self.stackModel else { return }
|
||||
guard !model.gone else {
|
||||
// Gone views do not show
|
||||
@ -208,7 +223,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
||||
pinView(view, toView: contentView, attribute: .leading, relation: .equal, priority: .required, constant: 0)
|
||||
pinView(contentView, toView: view, attribute: .trailing, relation: .equal, priority: .required, constant: 0)
|
||||
if let percent = model.percent {
|
||||
view.heightAnchor.constraint(equalTo: contentView.heightAnchor, multiplier: CGFloat(percent)/100.0).isActive = true
|
||||
view.heightAnchor.constraint(equalTo: contentView.heightAnchor, multiplier: CGFloat(percent)/100.0, constant: percentModifier).isActive = true
|
||||
}
|
||||
if lastItem {
|
||||
pinView(contentView, toView: view, attribute: .bottom, relation: .equal, priority: .required, constant: 0)
|
||||
@ -225,7 +240,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
||||
pinView(view, toView: contentView, attribute: .top, relation: .equal, priority: .required, constant: 0)
|
||||
pinView(contentView, toView: view, attribute: .bottom, relation: .equal, priority: .required, constant: 0)
|
||||
if let percent = model.percent {
|
||||
view.widthAnchor.constraint(equalTo: contentView.widthAnchor, multiplier: CGFloat(percent)/100.0).isActive = true
|
||||
view.widthAnchor.constraint(equalTo: contentView.widthAnchor, multiplier: CGFloat(percent)/100.0, constant: percentModifier).isActive = true
|
||||
}
|
||||
if lastItem {
|
||||
pinView(contentView, toView: view, attribute: .right, relation: .equal, priority: .required, constant: 0)
|
||||
|
||||
@ -52,17 +52,22 @@ import Foundation
|
||||
|
||||
// Horizontal Combination Molecules
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self)
|
||||
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self)
|
||||
|
||||
// Vertical Combination Molecules
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyTextButton.self, viewModelClass: HeadlineBodyLinkModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self)
|
||||
|
||||
// Left Right Molecules
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LeftRightLabelView.self, viewModelClass: LeftRightLabelModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LabelSwitch.self, viewModelClass: LabelToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodySwitch.self, viewModelClass: HeadlineBodyToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyTextButtonSwitch.self, viewModelClass: HeadlineBodyLinkToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self)
|
||||
|
||||
// List items
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: ListItemModel.self)
|
||||
@ -94,12 +99,7 @@ import Foundation
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(CheckboxWithLabelView.self, forKey: "checkboxLabel" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButton.self, forKey: "radioButton" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButtonLabel.self, forKey: "radioButtonLabel" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(ActionDetailWithImage.self, forKey: "actionDetailWithImage" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(ImageHeadlineBody.self, forKey: "imageHeadlineBody" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(HeadlineBodyTextButton.self, forKey: "headlineBodyLink" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(HeadlineBodyTextButtonSwitch.self, forKey: "headlineBodyLinkToggle" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(HeadlineBodyButton.self, forKey: "headlineBodyButton" as NSString)
|
||||
|
||||
// TODO: Need View
|
||||
ModelRegistry.register(TabsModel.self)
|
||||
|
||||
@ -17,7 +17,7 @@ import Foundation
|
||||
public var isAtomicTabs: Bool?
|
||||
|
||||
public var header: MoleculeModelProtocol?
|
||||
public var molecules: [ListItemModelProtocol]
|
||||
public var molecules: [ListItemModelProtocol]?
|
||||
public var footer: MoleculeModelProtocol?
|
||||
public var line: LineModel?
|
||||
|
||||
@ -42,11 +42,7 @@ import Foundation
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
pageType = try typeContainer.decode(String.self, forKey: .pageType)
|
||||
screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading)
|
||||
|
||||
guard let molecules = try typeContainer.decodeMolecules(codingKey: .molecules) as? [ListItemModelProtocol] else {
|
||||
throw JSONError.pathNotFound
|
||||
}
|
||||
self.molecules = molecules
|
||||
molecules = try typeContainer.decodeMoleculesIfPresent(codingKey: .molecules) as? [ListItemModelProtocol]
|
||||
isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs)
|
||||
header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header)
|
||||
footer = try typeContainer.decodeMoleculeIfPresent(codingKey: .footer)
|
||||
@ -57,7 +53,7 @@ import Foundation
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(pageType, forKey: .pageType)
|
||||
try container.encodeIfPresent(screenHeading, forKey: .screenHeading)
|
||||
try container.encodeModels(molecules, forKey: .molecules)
|
||||
try container.encodeModelsIfPresent(molecules, forKey: .molecules)
|
||||
try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs)
|
||||
try container.encodeModelIfPresent(header, forKey: .header)
|
||||
try container.encodeModelIfPresent(footer, forKey: .footer)
|
||||
|
||||
@ -53,6 +53,19 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
return molecule
|
||||
}
|
||||
|
||||
open override func shouldFinishProcessingLoad(_ loadObject: MVMCoreLoadObject, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject>) -> Bool {
|
||||
let shouldFinish = super.shouldFinishProcessingLoad(loadObject, error: error)
|
||||
// This template requires atleast one of the three layers.
|
||||
if templateModel?.header == nil,
|
||||
templateModel?.molecules?.count ?? 0 == 0,
|
||||
templateModel?.footer == nil,
|
||||
let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), messageToLog: "List template requires atleast one of the following: header, footer, molecules", code: CoreUIErrorCode.ErrorCodeListMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) {
|
||||
error.pointee = errorObject
|
||||
return false
|
||||
}
|
||||
return shouldFinish
|
||||
}
|
||||
|
||||
open override func newDataBuildScreen() {
|
||||
super.newDataBuildScreen()
|
||||
setup()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user