Line items update
This commit is contained in:
parent
90d7b188d1
commit
5bb6b9bc75
@ -108,7 +108,7 @@
|
||||
D260D7B122D65BDD007E7233 /* MVMCoreUIPageControl.h in Headers */ = {isa = PBXBuildFile; fileRef = D260D7AF22D65BDD007E7233 /* MVMCoreUIPageControl.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D260D7B222D65BDD007E7233 /* MVMCoreUIPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = D260D7B022D65BDD007E7233 /* MVMCoreUIPageControl.m */; };
|
||||
D260D7B622D68514007E7233 /* MVMCoreUIPagingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D260D7B522D68509007E7233 /* MVMCoreUIPagingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D268C70C2386DFFD007F2C1C /* MoleculeStackItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB368A23609801006832FA /* MoleculeStackItemModel.swift */; };
|
||||
D268C70C2386DFFD007F2C1C /* StackItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01EB368A23609801006832FA /* StackItemModel.swift */; };
|
||||
D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = D268C70D238C22D7007F2C1C /* DropDownFilterTableViewCell.swift */; };
|
||||
D268C712238D6699007F2C1C /* DropDown.swift in Sources */ = {isa = PBXBuildFile; fileRef = D268C711238D6699007F2C1C /* DropDown.swift */; };
|
||||
D274CA332236A78900B01B62 /* StandardFooterView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D274CA322236A78900B01B62 /* StandardFooterView.swift */; };
|
||||
@ -120,7 +120,10 @@
|
||||
D282AACB2243C61700C46919 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AACA2243C61700C46919 /* ButtonView.swift */; };
|
||||
D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */; };
|
||||
D28A837923C7D5BC00DFE4FC /* PageModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837823C7D5BC00DFE4FC /* PageModelProtocol.swift */; };
|
||||
D296E13C229598BF0051EBE7 /* MoleculeListCellProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E13B2295969C0051EBE7 /* MoleculeListCellProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837A23C928DA00DFE4FC /* MoleculeListCellProtocol.swift */; };
|
||||
D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837C23CCA86A00DFE4FC /* TabsListItemModel.swift */; };
|
||||
D28A837F23CCA96400DFE4FC /* TabsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837E23CCA96400DFE4FC /* TabsModel.swift */; };
|
||||
D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838023CCB0D800DFE4FC /* AccordionListItemModel.swift */; };
|
||||
D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; };
|
||||
D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -314,7 +317,7 @@
|
||||
01EB3683236097C0006832FA /* MoleculeProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeProtocol.swift; sourceTree = "<group>"; };
|
||||
01EB368823609801006832FA /* LabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LabelModel.swift; sourceTree = "<group>"; };
|
||||
01EB368923609801006832FA /* ListItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListItemModel.swift; sourceTree = "<group>"; };
|
||||
01EB368A23609801006832FA /* MoleculeStackItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeStackItemModel.swift; sourceTree = "<group>"; };
|
||||
01EB368A23609801006832FA /* StackItemModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = StackItemModel.swift; sourceTree = "<group>"; };
|
||||
01EB368B23609801006832FA /* MoleculeStackModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeStackModel.swift; sourceTree = "<group>"; };
|
||||
01EB368C23609801006832FA /* HeaderModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeaderModel.swift; sourceTree = "<group>"; };
|
||||
01EB368D23609801006832FA /* HeadlineBodyModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadlineBodyModel.swift; sourceTree = "<group>"; };
|
||||
@ -376,7 +379,10 @@
|
||||
D282AACA2243C61700C46919 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = "<group>"; };
|
||||
D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFCustomButton+ActionModel.swift"; sourceTree = "<group>"; };
|
||||
D28A837823C7D5BC00DFE4FC /* PageModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageModelProtocol.swift; sourceTree = "<group>"; };
|
||||
D296E13B2295969C0051EBE7 /* MoleculeListCellProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoleculeListCellProtocol.h; sourceTree = "<group>"; };
|
||||
D28A837A23C928DA00DFE4FC /* MoleculeListCellProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListCellProtocol.swift; sourceTree = "<group>"; };
|
||||
D28A837C23CCA86A00DFE4FC /* TabsListItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsListItemModel.swift; sourceTree = "<group>"; };
|
||||
D28A837E23CCA96400DFE4FC /* TabsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsModel.swift; sourceTree = "<group>"; };
|
||||
D28A838023CCB0D800DFE4FC /* AccordionListItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AccordionListItemModel.swift; sourceTree = "<group>"; };
|
||||
D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = "<group>"; };
|
||||
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; };
|
||||
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = "<group>"; };
|
||||
@ -613,9 +619,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
011B58F323A2CCC80085F53C /* DropDownModel.swift */,
|
||||
011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */,
|
||||
01EB368A23609801006832FA /* MoleculeStackItemModel.swift */,
|
||||
01EB368B23609801006832FA /* MoleculeStackModel.swift */,
|
||||
01EB368C23609801006832FA /* HeaderModel.swift */,
|
||||
012A88EB238F084D00FE3DA1 /* FooterModel.swift */,
|
||||
017BEB3F23620A230024EF95 /* TextFieldModel.swift */,
|
||||
@ -723,6 +726,7 @@
|
||||
children = (
|
||||
D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */,
|
||||
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */,
|
||||
D28A837E23CCA96400DFE4FC /* TabsModel.swift */,
|
||||
);
|
||||
path = HorizontalCombinationViews;
|
||||
sourceTree = "<group>";
|
||||
@ -739,6 +743,7 @@
|
||||
D22479902316A9CB003FCCF9 /* Organisms */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
01EB368B23609801006832FA /* MoleculeStackModel.swift */,
|
||||
D2A5145E2211DDC100345BFB /* MoleculeStackView.swift */,
|
||||
D2A6390022CBB1820052ED1F /* Carousel.swift */,
|
||||
);
|
||||
@ -752,9 +757,13 @@
|
||||
01509D8E2327EC6F00EF99AA /* MoleculeTableViewCell.swift */,
|
||||
01EB368923609801006832FA /* ListItemModel.swift */,
|
||||
D2A6390422CBCE160052ED1F /* MoleculeCollectionViewCell.swift */,
|
||||
D28A838023CCB0D800DFE4FC /* AccordionListItemModel.swift */,
|
||||
D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */,
|
||||
D28A837C23CCA86A00DFE4FC /* TabsListItemModel.swift */,
|
||||
D27CD40D2322EEAF00C1DC07 /* TabsTableViewCell.swift */,
|
||||
011B58F123A2AE2C0085F53C /* DropDownListItemModel.swift */,
|
||||
D268C70D238C22D7007F2C1C /* DropDownFilterTableViewCell.swift */,
|
||||
01EB368A23609801006832FA /* StackItemModel.swift */,
|
||||
D2FB151C23A40F1500C20E10 /* StackItem.swift */,
|
||||
);
|
||||
path = Items;
|
||||
@ -790,7 +799,6 @@
|
||||
D29DF0CE21E404D4003B2FB9 /* MVMCoreUI */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D29DF10D21E67A70003B2FB9 /* Atoms */,
|
||||
01509D96232803B200EF99AA /* Models */,
|
||||
D2B18B7D236090D500A9AEDC /* BaseClasses */,
|
||||
01C74D87224298E2009C25A3 /* FormUIHelpers */,
|
||||
@ -803,6 +811,7 @@
|
||||
D22D1F582204D2590077CEC0 /* Legacy */,
|
||||
D29DF10F21E67A7D003B2FB9 /* BaseControllers */,
|
||||
D29DF11E21E6851E003B2FB9 /* TopAlert */,
|
||||
D29DF10D21E67A70003B2FB9 /* Atoms */,
|
||||
D29DF10E21E67A77003B2FB9 /* Molecules */,
|
||||
D22479902316A9CB003FCCF9 /* Organisms */,
|
||||
D29DF0DF21E418B2003B2FB9 /* Templates */,
|
||||
@ -817,7 +826,7 @@
|
||||
children = (
|
||||
D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */,
|
||||
D2A514622213643100345BFB /* MoleculeStackCenteredTemplate.swift */,
|
||||
D296E13B2295969C0051EBE7 /* MoleculeListCellProtocol.h */,
|
||||
D28A837A23C928DA00DFE4FC /* MoleculeListCellProtocol.swift */,
|
||||
D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */,
|
||||
D2D6CD4122E78FAB00D701B8 /* ThreeLayerTemplate.swift */,
|
||||
);
|
||||
@ -1231,7 +1240,6 @@
|
||||
D29DF2A121E7AF4E003B2FB9 /* MVMCoreUIUtility.h in Headers */,
|
||||
D29DF17621E69E1F003B2FB9 /* PrimaryButton.h in Headers */,
|
||||
D29DF2C821E7BFC1003B2FB9 /* MFSizeObject.h in Headers */,
|
||||
D296E13C229598BF0051EBE7 /* MoleculeListCellProtocol.h in Headers */,
|
||||
D29DF32021ED0CBA003B2FB9 /* LabelView.h in Headers */,
|
||||
D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */,
|
||||
D29DF2E121E9240B003B2FB9 /* MVMCoreUIPanelProtocol.h in Headers */,
|
||||
@ -1325,6 +1333,7 @@
|
||||
012CA9E423888B1B003F810F /* (null) in Sources */,
|
||||
9402C35023A2CEA3004B974C /* LeftRightLabelModel.swift in Sources */,
|
||||
D29DF32121ED0CBA003B2FB9 /* LabelView.m in Sources */,
|
||||
D28A838123CCB0D800DFE4FC /* AccordionListItemModel.swift in Sources */,
|
||||
DBC4391822442197001AB423 /* CaretView.swift in Sources */,
|
||||
D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */,
|
||||
D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */,
|
||||
@ -1363,6 +1372,7 @@
|
||||
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
|
||||
D29DF12E21E6851E003B2FB9 /* MVMCoreUITopAlertView.m in Sources */,
|
||||
D29DF2CF21E7C104003B2FB9 /* MFLoadingViewController.m in Sources */,
|
||||
D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */,
|
||||
014AA72F23C5059B006F3E93 /* ThreeLayerPageTemplateModel.swift in Sources */,
|
||||
D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */,
|
||||
D2A5145F2211DDC100345BFB /* MoleculeStackView.swift in Sources */,
|
||||
@ -1385,10 +1395,11 @@
|
||||
944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */,
|
||||
D213347723843825008E41B3 /* Line.swift in Sources */,
|
||||
D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */,
|
||||
D28A837F23CCA96400DFE4FC /* TabsModel.swift in Sources */,
|
||||
012A88EC238F084D00FE3DA1 /* FooterModel.swift in Sources */,
|
||||
D2A514672213885800345BFB /* StandardHeaderView.swift in Sources */,
|
||||
01EB369023609801006832FA /* ListItemModel.swift in Sources */,
|
||||
D268C70C2386DFFD007F2C1C /* MoleculeStackItemModel.swift in Sources */,
|
||||
D268C70C2386DFFD007F2C1C /* StackItemModel.swift in Sources */,
|
||||
DBEFFA04225A829700230692 /* Label.swift in Sources */,
|
||||
D2D6CD4022E78C1A00D701B8 /* Scroller.swift in Sources */,
|
||||
01509D952327ED1900EF99AA /* HeadlineBodyTextButtonSwitch.swift in Sources */,
|
||||
@ -1459,6 +1470,7 @@
|
||||
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */,
|
||||
01EB369323609801006832FA /* HeaderModel.swift in Sources */,
|
||||
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
|
||||
D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */,
|
||||
012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */,
|
||||
94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */,
|
||||
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */,
|
||||
|
||||
@ -132,7 +132,7 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
|
||||
}
|
||||
}
|
||||
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let caretLinkModel = model as? CaretLinkModel else { return }
|
||||
if let color = caretLinkModel.backgroundColor {
|
||||
backgroundColor = color.uiColor
|
||||
|
||||
@ -16,7 +16,7 @@ enum TextType: String {
|
||||
}
|
||||
extension MFTextField: ModelMoleculeViewProtocol {
|
||||
//
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
//TODO: Need to create setWithModel in ViewConstraining View
|
||||
#warning("This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.")
|
||||
//TODO: This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.
|
||||
|
||||
@ -103,13 +103,13 @@ open class CaretView: View {
|
||||
defaultState()
|
||||
}
|
||||
|
||||
public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: CaretViewModel.self) else { return }
|
||||
setWithModel(model, delegateObject, additionalData as? [String : AnyHashable])
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
//MARK: - MVMCoreMoleculeViewProtocol
|
||||
override public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
override public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let caretModel = model as? CaretViewModel else {
|
||||
return
|
||||
|
||||
@ -74,11 +74,11 @@ open class DashLine: View {
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: DashLineModel.self) else { return }
|
||||
setWithModel(model, delegateObject, additionalData as? [String : AnyHashable])
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
//MARK: - MVMCoreMoleculeViewProtocol
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let dashLineModel = dashModel else {
|
||||
return
|
||||
|
||||
@ -126,11 +126,11 @@ public struct GraphObject {
|
||||
widthAnchor.constraint(equalTo: heightAnchor).isActive = true
|
||||
}
|
||||
|
||||
override open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
override open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
override open func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
override open func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
let object = GraphObject(json)
|
||||
graphObject = object
|
||||
|
||||
@ -218,7 +218,7 @@ public typealias ActionBlock = () -> ()
|
||||
case left
|
||||
}
|
||||
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
clauses = []
|
||||
guard let labelModel = model as? LabelModel else { return }
|
||||
attributedText = nil
|
||||
|
||||
@ -179,7 +179,7 @@ import Foundation
|
||||
|
||||
//MARK: - MVMCoreMoleculeViewProtocol
|
||||
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let leftRightLabelModel = model as? LeftRightLabelModel else {
|
||||
return
|
||||
|
||||
@ -67,7 +67,7 @@ import UIKit
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
if let lineModel = model as? LineModel {
|
||||
setStyle(lineModel.type ?? .standard)
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let imageModel = model as? ImageViewModel else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
|
||||
extension MFView {
|
||||
public func setUpDefaultWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String: AnyHashable]?) {
|
||||
public func setUpDefaultWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
self.model = model
|
||||
if let backgroundColor = model?.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
@ -18,7 +18,7 @@ extension MFView {
|
||||
}
|
||||
|
||||
extension ModelMoleculeViewProtocol where Self: MFView {
|
||||
func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String: AnyHashable]?) {
|
||||
func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
setUpDefaultWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -64,7 +64,7 @@ import UIKit
|
||||
}
|
||||
|
||||
//MARK: - MVMCoreMoleculeViewProtocol
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let multiProgressModel = multiProgressModel else {
|
||||
return
|
||||
@ -83,6 +83,6 @@ import UIKit
|
||||
|
||||
public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: MultiProgressBarModel.self) else { return }
|
||||
setWithModel(model, delegateObject, additionalData as? [String : AnyHashable])
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ import Foundation
|
||||
}
|
||||
|
||||
//MARK: - MVMCoreMoleculeViewProtocol
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String: AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let progressBarModel = model as? ProgressBarModel else {
|
||||
return
|
||||
}
|
||||
@ -64,9 +64,9 @@ import Foundation
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: ProgressBarModel.self) else { return }
|
||||
setWithModel(model, delegateObject, additionalData as? [String : AnyHashable])
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public func reset() {
|
||||
|
||||
@ -49,7 +49,7 @@ import UIKit
|
||||
}
|
||||
}
|
||||
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
self.model = model
|
||||
if let backgroundColor = model?.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
|
||||
@ -40,7 +40,7 @@ import UIKit
|
||||
return model?.moleculeName
|
||||
}
|
||||
|
||||
open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
self.model = model
|
||||
if let backgroundColor = model?.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
|
||||
@ -16,10 +16,10 @@ extension MFViewController: MoleculeDelegateProtocol {
|
||||
return loadObject?.modulesJSON?.optionalDictionaryForKey(name)
|
||||
}
|
||||
|
||||
public func getModuleWithName(_ moduleName: String) -> Model? {
|
||||
public func getModuleWithName(_ moduleName: String) -> MoleculeProtocol? {
|
||||
guard let moduleJSON = loadObject?.modulesJSON?.optionalDictionaryForKey(moduleName),
|
||||
let moleculeName = moduleJSON.optionalStringForKey("moleculeName"),
|
||||
let modelType = ModelRegistry.getType(for: moleculeName) else {
|
||||
let modelType = ModelRegistry.getType(for: moleculeName) as? MoleculeProtocol.Type else {
|
||||
return nil
|
||||
}
|
||||
do {
|
||||
|
||||
@ -172,11 +172,11 @@ public class ContainerHelper: NSObject {
|
||||
MFStyler.setMarginsFor(view, size: size, defaultHorizontal: model?.useHorizontalMargins ?? false, top: (model?.useVerticalMargins ?? false) ? (model?.topMarginPadding ?? 0) : 0, bottom: (model?.useVerticalMargins ?? false) ? (model?.bottomMarginPadding ?? 0) : 0)
|
||||
}
|
||||
|
||||
func set(with model: ContainerModelProtocol) {
|
||||
if let horizontalAlignment = model.horizontalAlignment {
|
||||
func set(with model: ContainerModelProtocol, for contained: MVMCoreUIViewConstrainingProtocol?) {
|
||||
if let horizontalAlignment = model.horizontalAlignment ?? contained?.horizontalAlignment?() {
|
||||
alignHorizontal(horizontalAlignment)
|
||||
}
|
||||
if let verticalAlignment = model.verticalAlignment {
|
||||
if let verticalAlignment = model.verticalAlignment ?? contained?.verticalAlignment?() {
|
||||
alignVertical(verticalAlignment)
|
||||
}
|
||||
}
|
||||
@ -203,10 +203,10 @@ open class Container: View {
|
||||
get { return model as? ContainerModelProtocol }
|
||||
}
|
||||
|
||||
override open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
override open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let containerModel = model as? ContainerModelProtocol else { return }
|
||||
containerHelper.set(with: containerModel)
|
||||
containerHelper.set(with: containerModel, for: view as? MVMCoreUIViewConstrainingProtocol)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -20,7 +20,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
|
||||
#import <MVMCoreUI/MVMCoreUILoggingHandler.h>
|
||||
#import <MVMCoreUI/MVMCoreUIViewControllerMappingObject.h>
|
||||
#import <MVMCoreUI/MVMCoreUIViewConstrainingProtocol.h>
|
||||
#import <MVMCoreUI/MoleculeListCellProtocol.h>
|
||||
#import <MVMCoreUI/MVMCoreUIMoleculeMappingObject.h>
|
||||
|
||||
#pragma mark - TopAlert
|
||||
|
||||
@ -35,4 +35,17 @@ extension KeyedDecodingContainer where Key : CodingKey {
|
||||
public func decodeMoleculesIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> [MoleculeProtocol]? {
|
||||
return try decodeModelsIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeProtocol]
|
||||
}
|
||||
|
||||
/// Decodes an array with arrays of molecules based on the identifiers, optional.
|
||||
public func decodeMolecules2DIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> [[MoleculeProtocol]]? {
|
||||
return try decodeModels2DIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [[MoleculeProtocol]]
|
||||
}
|
||||
|
||||
/// Decodes an array with arrays of models based on the identifiers.
|
||||
public func decodeMolecules2D(codingKey: KeyedDecodingContainer<K>.Key) throws -> [[MoleculeProtocol]] {
|
||||
guard let models = try decodeModels2D(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [[MoleculeProtocol]] else {
|
||||
throw ModelRegistry.Error.decoderError
|
||||
}
|
||||
return models
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,27 @@
|
||||
import Foundation
|
||||
|
||||
public protocol ListItemModelProtocol: ContainerModelProtocol, MoleculeProtocol {
|
||||
var molecule: MoleculeProtocol { get }
|
||||
var line: LineModel? { get set }
|
||||
var action: ActionProtocol? { get set }
|
||||
var hideArrow: Bool? { get set }
|
||||
var style: String? { get set }
|
||||
}
|
||||
|
||||
// Not a strict requirement.
|
||||
extension ListItemModelProtocol {
|
||||
public var action: ActionProtocol? {
|
||||
get {
|
||||
return nil
|
||||
}
|
||||
set {
|
||||
}
|
||||
}
|
||||
|
||||
public var style: String? {
|
||||
get {
|
||||
return nil
|
||||
}
|
||||
set {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -15,7 +15,7 @@ public protocol TemplateProtocol: class {
|
||||
|
||||
public extension TemplateProtocol where Self: MFViewController {
|
||||
func parseTemplateJSON() {
|
||||
guard let pageJSON = self.loadObject?.pageJSON as? [String: AnyHashable] else { return }
|
||||
guard let pageJSON = self.loadObject?.pageJSON else { return }
|
||||
do {
|
||||
let data = try JSONSerialization.data(withJSONObject: pageJSON)
|
||||
let decoder = JSONDecoder()
|
||||
|
||||
@ -19,6 +19,7 @@ import Foundation
|
||||
public var header: HeaderModel?
|
||||
public var molecules: [ListItemModelProtocol]
|
||||
public var footer: MoleculeStackModel?
|
||||
public var line: LineModel?
|
||||
|
||||
public init(pageType: String, screenHeading: String, molecules: [ListItemModelProtocol]) {
|
||||
self.pageType = pageType
|
||||
@ -26,39 +27,41 @@ import Foundation
|
||||
self.molecules = molecules
|
||||
}
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case pageType
|
||||
case screenHeading
|
||||
case molecules
|
||||
case header
|
||||
case footer
|
||||
case isAtomicTabs
|
||||
}
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case moleculeName
|
||||
case pageType
|
||||
case screenHeading
|
||||
case molecules
|
||||
case header
|
||||
case footer
|
||||
case line
|
||||
case isAtomicTabs
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.pageType = try typeContainer.decode(String.self, forKey: .pageType)
|
||||
self.screenHeading = try typeContainer.decode(String.self, forKey: .screenHeading)
|
||||
required public init(from decoder: Decoder) throws {
|
||||
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
|
||||
isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs)
|
||||
header = try typeContainer.decodeIfPresent(HeaderModel.self, forKey: .header)
|
||||
footer = try typeContainer.decodeIfPresent(MoleculeStackModel.self, forKey: .footer)
|
||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||
}
|
||||
|
||||
guard let molecules = try typeContainer.decodeMolecules(codingKey: .molecules) as? [ListItemModelProtocol] else {
|
||||
throw JSONError.pathNotFound
|
||||
}
|
||||
self.molecules = molecules
|
||||
self.isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs)
|
||||
self.header = try typeContainer.decodeIfPresent(HeaderModel.self, forKey: .header)
|
||||
self.footer = try typeContainer.decodeIfPresent(MoleculeStackModel.self, forKey: .footer)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(pageType, forKey: .pageType)
|
||||
try container.encode(screenHeading, forKey: .screenHeading)
|
||||
|
||||
try container.encodeModels(molecules, forKey: .molecules)
|
||||
try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs)
|
||||
try container.encodeIfPresent(header, forKey: .header)
|
||||
try container.encodeIfPresent(footer, forKey: .footer)
|
||||
}
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
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.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs)
|
||||
try container.encodeIfPresent(header, forKey: .header)
|
||||
try container.encodeIfPresent(footer, forKey: .footer)
|
||||
try container.encode(line, forKey: .line)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,50 @@
|
||||
//
|
||||
// TabsModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/13/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class TabsModel: MoleculeProtocol {
|
||||
public static var identifier: String = "tabs"
|
||||
public var backgroundColor: Color?
|
||||
public var tabs: [LabelModel]
|
||||
public var selectedColor = Color(uiColor: .mfTomatoRed())
|
||||
|
||||
// Must be capped to 0...(tabs.count - 1)
|
||||
public var selectedIndex: Int = 0
|
||||
|
||||
enum TabsCodingKeys: String, CodingKey {
|
||||
case tabs
|
||||
case backgroundColor
|
||||
case selectedColor
|
||||
case selectedIndex
|
||||
}
|
||||
|
||||
public init(with tabs: [LabelModel]) {
|
||||
self.tabs = tabs
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: TabsCodingKeys.self)
|
||||
tabs = try typeContainer.decode([LabelModel].self, forKey: .tabs)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .selectedColor) {
|
||||
selectedColor = color
|
||||
}
|
||||
if let index = try typeContainer.decodeIfPresent(Int.self, forKey: .selectedIndex) {
|
||||
selectedIndex = index
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: TabsCodingKeys.self)
|
||||
try container.encode(tabs, forKey: .tabs)
|
||||
try container.encode(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encode(selectedColor, forKey: .selectedColor)
|
||||
try container.encode(selectedIndex, forKey: .selectedIndex)
|
||||
}
|
||||
}
|
||||
46
MVMCoreUI/Molecules/Items/AccordionListItemModel.swift
Normal file
46
MVMCoreUI/Molecules/Items/AccordionListItemModel.swift
Normal file
@ -0,0 +1,46 @@
|
||||
//
|
||||
// AccordionListItemModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/13/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
class AccordionListItemModel: MoleculeContainerModel, ListItemModelProtocol {
|
||||
public static var identifier: String = "accordionListItem"
|
||||
public var molecules: [ListItemModelProtocol]
|
||||
public var backgroundColor: Color?
|
||||
public var hideLineWhenExpanded: Bool = false
|
||||
public var hideArrow: Bool? = true
|
||||
public var line: LineModel?
|
||||
|
||||
enum AccordionListItemCodingKeys: String, CodingKey {
|
||||
case molecules
|
||||
case backgroundColor
|
||||
case hideLineWhenExpanded
|
||||
case hideArrow
|
||||
case line
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: AccordionListItemCodingKeys.self)
|
||||
molecules = try typeContainer.decodeMolecules(codingKey: .molecules) as! [ListItemModelProtocol]
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||
if let hideLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideLineWhenExpanded) {
|
||||
hideLineWhenExpanded = hideLine
|
||||
}
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: AccordionListItemCodingKeys.self)
|
||||
try container.encodeModels(molecules, forKey: .molecules)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeIfPresent(hideLineWhenExpanded, forKey: .hideLineWhenExpanded)
|
||||
try container.encodeIfPresent(line, forKey: .line)
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class AccordionMoleculeTableViewCell: MoleculeTableViewCell {
|
||||
var accordionListItemModel: AccordionListItemModel?
|
||||
let accordionButton = createAccordionButton()
|
||||
|
||||
static func createAccordionButton() -> MFCustomButton {
|
||||
@ -26,10 +27,10 @@ import UIKit
|
||||
accessoryView = accordionButton
|
||||
}
|
||||
|
||||
public override func didSelectCell(atIndex indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
override public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
accordionButton.isSelected = !accordionButton.isSelected
|
||||
accordionButton.setTitle(accordionButton.isSelected ? "-" : "+", for: .normal)
|
||||
guard let molecules = json?.optionalArrayForKey(KeyMolecules) as? [[AnyHashable: Any]] else {
|
||||
guard let molecules = accordionListItemModel?.molecules else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -39,7 +40,7 @@ import UIKit
|
||||
delegateObject?.moleculeDelegate?.removeMolecules(molecules, sender: self, animation: .automatic)
|
||||
}
|
||||
|
||||
if (json?.boolForKey("hideSeparatorWhenExpanded") ?? false) && (self.bottomSeparatorView?.shouldBeVisible() ?? false) {
|
||||
if (accordionListItemModel?.hideLineWhenExpanded ?? false) && (self.bottomSeparatorView?.shouldBeVisible() ?? false) {
|
||||
bottomSeparatorView?.isHidden = accordionButton.isSelected
|
||||
}
|
||||
}
|
||||
|
||||
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class DropDownFilterTableViewCell: TableViewCell {
|
||||
var dropDownListItemModel: DropDownListItemModel?
|
||||
let dropDown = DropDown(forDropDownWithBothDelegates: nil)
|
||||
var delegateObject: MVMCoreUIDelegateObject?
|
||||
var previousIndex = NSNotFound
|
||||
@ -20,7 +21,6 @@ import UIKit
|
||||
guard let dropDown = dropDown, dropDown.superview == nil else {
|
||||
return
|
||||
}
|
||||
bottomMarginPadding = 0
|
||||
|
||||
dropDown.translatesAutoresizingMaskIntoConstraints = false
|
||||
contentView.addSubview(dropDown)
|
||||
@ -35,14 +35,12 @@ import UIKit
|
||||
guard change.newValue != change.oldValue, let self = self,
|
||||
let options = self.dropDown?.json?.optionalArrayForKey("options") as? [NSString],
|
||||
let index = options.firstIndex(of: change.newValue!! as NSString),
|
||||
let moleculesArrays = self.json?.arrayForKey(KeyMolecules) as? [[[AnyHashable: Any]]] else { return }
|
||||
let molecules = self.dropDownListItemModel?.molecules else { return }
|
||||
|
||||
if self.previousIndex != NSNotFound {
|
||||
let previousMolecules = moleculesArrays[self.previousIndex]
|
||||
self.delegateObject?.moleculeDelegate?.removeMolecules(previousMolecules, sender: self, animation: .fade)
|
||||
self.delegateObject?.moleculeDelegate?.removeMolecules(molecules[self.previousIndex], sender: self, animation: .fade)
|
||||
}
|
||||
let molecules = moleculesArrays[index]
|
||||
self.delegateObject?.moleculeDelegate?.addMolecules(molecules, sender: self, animation: .fade)
|
||||
self.delegateObject?.moleculeDelegate?.addMolecules(molecules[index], sender: self, animation: .fade)
|
||||
self.previousIndex = index
|
||||
}
|
||||
}
|
||||
@ -52,19 +50,18 @@ import UIKit
|
||||
dropDown?.updateView(size)
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
bottomSeparatorView?.setStyle(.none)
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
dropDownListItemModel = model as? DropDownListItemModel
|
||||
self.delegateObject = delegateObject
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
|
||||
dropDown?.mfTextFieldDelegate = delegateObject?.uiTextFieldDelegate as? MFTextFieldDelegate
|
||||
dropDown?.uiTextFieldDelegate = delegateObject?.uiTextFieldDelegate
|
||||
dropDown?.setWithJSON(json?.optionalDictionaryForKey("dropDown"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
dropDown?.setWithModel(dropDownListItemModel, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public override func reset() {
|
||||
super.reset()
|
||||
bottomMarginPadding = 0
|
||||
bottomSeparatorView?.setStyle(.none)
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,12 +10,13 @@ import Foundation
|
||||
|
||||
@objcMembers public class DropDownListItemModel: MoleculeContainerModel, ListItemModelProtocol {
|
||||
public static var identifier: String = "dropDownListItem"
|
||||
public var molecules: [[ListItemModel]]
|
||||
public var backgroundColor: Color?
|
||||
public var line: LineModel?
|
||||
public var molecules: [[ListItemModelProtocol]]
|
||||
public var dropDown: DropDownModel
|
||||
public var backgroundColor: Color?
|
||||
public var line: LineModel? = LineModel(type: .none)
|
||||
public var hideArrow: Bool? = true
|
||||
|
||||
public init(molecule: MoleculeProtocol, molecules: [[ListItemModel]], dropDown: DropDownModel) {
|
||||
public init(molecule: MoleculeProtocol, molecules: [[ListItemModelProtocol]], dropDown: DropDownModel) {
|
||||
self.molecules = molecules
|
||||
self.dropDown = dropDown
|
||||
super.init(with: molecule)
|
||||
@ -23,25 +24,28 @@ import Foundation
|
||||
|
||||
enum DropDownCodingKeys: String, CodingKey {
|
||||
case molecules
|
||||
case dropDown
|
||||
case line
|
||||
case backgroundColor
|
||||
case dropDown
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: DropDownCodingKeys.self)
|
||||
self.molecules = try typeContainer.decode([[ListItemModel]].self, forKey: .molecules)
|
||||
self.line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||
self.backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
self.dropDown = try typeContainer.decode(DropDownModel.self, forKey: .dropDown)
|
||||
molecules = try typeContainer.decodeMolecules2D(codingKey: .molecules) as! [[ListItemModelProtocol]]
|
||||
dropDown = try typeContainer.decode(DropDownModel.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: DropDownCodingKeys.self)
|
||||
try container.encode(molecules, forKey: .molecules)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeModels2D(molecules, forKey: .molecules)
|
||||
try container.encode(dropDown, forKey: .dropDown)
|
||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeIfPresent(line, forKey: .line)
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol, ModelMoleculeViewProtocol {
|
||||
open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeViewProtocol, ModelMoleculeViewProtocol {
|
||||
|
||||
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
||||
open var json: [AnyHashable: Any]?
|
||||
@ -68,7 +68,7 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi
|
||||
}
|
||||
|
||||
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let collectionModel = model as? CarouselItemModel else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -11,11 +11,11 @@ import UIKit
|
||||
@objcMembers open class MoleculeTableViewCell: TableViewCell {
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
|
||||
guard let model = model,
|
||||
let moleculeModel = (model as? ListItemModelProtocol)?.molecule,
|
||||
let moleculeModel = (model as? ListItemModel)?.molecule,
|
||||
let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(moleculeModel, delegateObject, true) else {
|
||||
return
|
||||
}
|
||||
@ -23,7 +23,7 @@ import UIKit
|
||||
}
|
||||
|
||||
public override class func name(forReuse molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||
guard let moleculeModel = (molecule as? ListItemModelProtocol)?.molecule else {
|
||||
guard let moleculeModel = (molecule as? ListItemModel)?.molecule else {
|
||||
return "\(self)<>"
|
||||
}
|
||||
let className = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moleculeModel) as? ModelMoleculeViewProtocol
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
open class StackItem: MoleculeContainer {
|
||||
var stackItemModel: MoleculeStackItemModel? {
|
||||
get { return model as? MoleculeStackItemModel }
|
||||
var stackItemModel: StackItemModel? {
|
||||
get { return model as? StackItemModel }
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import Foundation
|
||||
|
||||
@objcMembers public class MoleculeStackItemModel: MoleculeContainerModel, MoleculeProtocol {
|
||||
@objcMembers public class StackItemModel: MoleculeContainerModel, MoleculeProtocol {
|
||||
public static var identifier: String = "stackItem"
|
||||
public var backgroundColor: Color?
|
||||
public var spacing: CGFloat?
|
||||
@ -11,12 +11,8 @@ import UIKit
|
||||
@objcMembers open class TableViewCell: UITableViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol, ModelMoleculeViewProtocol {
|
||||
|
||||
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
||||
open var json: [AnyHashable: Any]?
|
||||
open var listItemModel: ListItemModel?
|
||||
open var listItemModel: ListItemModelProtocol?
|
||||
public let containerHelper = ContainerHelper()
|
||||
|
||||
// In updateView, will set padding to default.
|
||||
open var updateViewHorizontalDefaults = true
|
||||
|
||||
// For the accessory view convenience.
|
||||
private var caretView: CaretView?
|
||||
@ -26,19 +22,10 @@ import UIKit
|
||||
// For separation between cells.
|
||||
public var topSeparatorView: Line?
|
||||
public var bottomSeparatorView: Line?
|
||||
public enum SeparatorFrequency: String {
|
||||
case all
|
||||
case allExceptTop
|
||||
case allExceptBottom
|
||||
case between
|
||||
}
|
||||
|
||||
/// For subclasses that want to use a custom accessory view.
|
||||
open var customAccessoryView = false
|
||||
|
||||
open var topMarginPadding: CGFloat = 24
|
||||
open var bottomMarginPadding: CGFloat = 24
|
||||
|
||||
private var heroAccessoryCenter: CGPoint?
|
||||
|
||||
// MARK: - Styling
|
||||
@ -62,36 +49,36 @@ import UIKit
|
||||
}
|
||||
|
||||
open func styleStandard() {
|
||||
topMarginPadding = 24
|
||||
bottomMarginPadding = 24
|
||||
listItemModel?.topMarginPadding = 24
|
||||
listItemModel?.bottomMarginPadding = 24
|
||||
topSeparatorView?.setStyle(.none)
|
||||
bottomSeparatorView?.setStyle(.standard)
|
||||
}
|
||||
|
||||
open func styleTallDivider() {
|
||||
topMarginPadding = 48
|
||||
bottomMarginPadding = 16
|
||||
listItemModel?.topMarginPadding = 48
|
||||
listItemModel?.bottomMarginPadding = 16
|
||||
topSeparatorView?.setStyle(.none)
|
||||
bottomSeparatorView?.setStyle(.thin)
|
||||
}
|
||||
|
||||
open func styleShortDivider() {
|
||||
topMarginPadding = 32
|
||||
bottomMarginPadding = 16
|
||||
listItemModel?.topMarginPadding = 32
|
||||
listItemModel?.bottomMarginPadding = 16
|
||||
topSeparatorView?.setStyle(.none)
|
||||
bottomSeparatorView?.setStyle(.thin)
|
||||
}
|
||||
|
||||
open func styleFooter() {
|
||||
topMarginPadding = 24
|
||||
bottomMarginPadding = 0
|
||||
listItemModel?.topMarginPadding = 24
|
||||
listItemModel?.bottomMarginPadding = 0
|
||||
topSeparatorView?.setStyle(.none)
|
||||
bottomSeparatorView?.setStyle(.none)
|
||||
}
|
||||
|
||||
open func styleNone() {
|
||||
topMarginPadding = 0
|
||||
bottomMarginPadding = 0
|
||||
listItemModel?.topMarginPadding = 0
|
||||
listItemModel?.bottomMarginPadding = 0
|
||||
topSeparatorView?.setStyle(.none)
|
||||
bottomSeparatorView?.setStyle(.none)
|
||||
}
|
||||
@ -125,7 +112,7 @@ import UIKit
|
||||
|
||||
// MARK: - MFViewProtocol
|
||||
public func updateView(_ size: CGFloat) {
|
||||
MFStyler.setMarginsFor(self, size: size, defaultHorizontal: updateViewHorizontalDefaults, top: topMarginPadding, bottom: bottomMarginPadding)
|
||||
containerHelper.updateViewMargins(self, model: listItemModel, size: size)
|
||||
|
||||
if accessoryView != nil {
|
||||
// Smaller left margin if accessory view.
|
||||
@ -155,23 +142,14 @@ import UIKit
|
||||
}
|
||||
|
||||
//TODO: Model, Change to model
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
guard let model = model as? ListItemModel else {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let model = model as? ListItemModelProtocol else {
|
||||
return
|
||||
}
|
||||
|
||||
self.listItemModel = model
|
||||
style(with: model.style)
|
||||
|
||||
if let useHorizontalMargins = model.useHorizontalMargins {
|
||||
updateViewHorizontalDefaults = useHorizontalMargins
|
||||
}
|
||||
|
||||
if (model.useVerticalMargins ?? true) == false {
|
||||
topMarginPadding = 0
|
||||
bottomMarginPadding = 0
|
||||
}
|
||||
|
||||
if let backgroundColor = model.backgroundColor {
|
||||
self.backgroundColor = backgroundColor.uiColor
|
||||
}
|
||||
@ -192,12 +170,11 @@ import UIKit
|
||||
}
|
||||
|
||||
guard let molecule = molecule else { return }
|
||||
containerHelper.set(with: json, for: molecule)
|
||||
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
||||
}
|
||||
|
||||
public func reset() {
|
||||
molecule?.reset?()
|
||||
updateViewHorizontalDefaults = true
|
||||
styleStandard()
|
||||
backgroundColor = .white
|
||||
}
|
||||
@ -254,23 +231,19 @@ import UIKit
|
||||
|
||||
// MARK: - MoleculeListCellProtocol
|
||||
/// For when the separator between cells shows using json and frequency. Default is type: standard, frequency: allExceptTop.
|
||||
//TODO: Change to model
|
||||
public func setSeparatorWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath) {
|
||||
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?, indexPath: IndexPath) {
|
||||
addSeparatorsIfNeeded()
|
||||
if let json = json {
|
||||
topSeparatorView?.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
bottomSeparatorView?.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
if let separatorFrequencyString = json.optionalStringForKey("frequency"), let separatorFrequency = SeparatorFrequency(rawValue: separatorFrequencyString) {
|
||||
setSeparatorFrequency(separatorFrequency, indexPath: indexPath)
|
||||
}
|
||||
if let model = model {
|
||||
topSeparatorView?.setWithModel(model, delegateObject, additionalData)
|
||||
bottomSeparatorView?.setWithModel(model, delegateObject, additionalData)
|
||||
} else {
|
||||
topSeparatorView?.setStyle(.standard)
|
||||
bottomSeparatorView?.setStyle(.standard)
|
||||
setSeparatorFrequency(TableViewCell.SeparatorFrequency.allExceptTop, indexPath: indexPath)
|
||||
}
|
||||
setSeparatorFrequency(model?.frequency ?? .allExceptTop, indexPath: indexPath)
|
||||
}
|
||||
|
||||
public func didSelectCell(atIndex indexPath: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
//TODO: Use object when handleAction is rewrote to handle action model
|
||||
if let actionMap = self.listItemModel?.action?.toJSON() {
|
||||
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
|
||||
@ -304,7 +277,7 @@ import UIKit
|
||||
}
|
||||
|
||||
/// For when the separator between cells shows.
|
||||
public func setSeparatorFrequency(_ separatorFrequency: SeparatorFrequency, indexPath: IndexPath) {
|
||||
public func setSeparatorFrequency(_ separatorFrequency: LineModel.Frequency, indexPath: IndexPath) {
|
||||
switch separatorFrequency {
|
||||
case .all:
|
||||
if indexPath.row == 0 {
|
||||
|
||||
54
MVMCoreUI/Molecules/Items/TabsListItemModel.swift
Normal file
54
MVMCoreUI/Molecules/Items/TabsListItemModel.swift
Normal file
@ -0,0 +1,54 @@
|
||||
//
|
||||
// TabsListItemModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/13/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import UIKit
|
||||
|
||||
public class TabsListItemModel: ContainerModel, ListItemModelProtocol {
|
||||
public static var identifier: String = "tabsListItem"
|
||||
var tabs: TabsModel
|
||||
var molecules: [[ListItemModelProtocol]]
|
||||
|
||||
public var backgroundColor: Color?
|
||||
public var hideArrow: Bool? = true
|
||||
public var line: LineModel? = LineModel(type: .standard)
|
||||
|
||||
enum TabsListItemCodingKeys: String, CodingKey {
|
||||
case tabs
|
||||
case molecules
|
||||
case backgroundColor
|
||||
case line
|
||||
}
|
||||
|
||||
public init(with tabs: TabsModel, molecules: [[ListItemModelProtocol]]) {
|
||||
self.tabs = tabs
|
||||
self.molecules = molecules
|
||||
super.init()
|
||||
self.topMarginPadding = 8
|
||||
self.bottomMarginPadding = 0
|
||||
}
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: TabsListItemCodingKeys.self)
|
||||
tabs = try typeContainer.decode(TabsModel.self, forKey: .tabs)
|
||||
molecules = try typeContainer.decodeMolecules2D(codingKey: .molecules) as! [[ListItemModelProtocol]]
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
if let lineModel = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) {
|
||||
line = lineModel
|
||||
}
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
public override func encode(to encoder: Encoder) throws {
|
||||
try super.encode(to: encoder)
|
||||
var container = encoder.container(keyedBy: TabsListItemCodingKeys.self)
|
||||
try container.encode(tabs, forKey: .tabs)
|
||||
try container.encodeModels2D(molecules, forKey: .molecules)
|
||||
try container.encode(backgroundColor, forKey: .backgroundColor)
|
||||
try container.encodeIfPresent(line, forKey: .line)
|
||||
}
|
||||
}
|
||||
@ -9,6 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class TabsTableViewCell: TableViewCell {
|
||||
var tabsListItemModel: TabsListItemModel?
|
||||
let tabs = TopTabbar(frame: .zero)
|
||||
var delegateObject: MVMCoreUIDelegateObject?
|
||||
var previousTabIndex = 0
|
||||
@ -20,8 +21,6 @@ import UIKit
|
||||
return
|
||||
}
|
||||
tabs.paddingBeforeFirstTab = false
|
||||
topMarginPadding = 8
|
||||
bottomMarginPadding = 0
|
||||
|
||||
tabs.translatesAutoresizingMaskIntoConstraints = false
|
||||
tabs.delegate = self
|
||||
@ -39,7 +38,7 @@ import UIKit
|
||||
|
||||
// MARK: - MoleculeDelegateProtocol
|
||||
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
self.delegateObject = delegateObject
|
||||
tabs.reloadData()
|
||||
@ -47,17 +46,13 @@ import UIKit
|
||||
|
||||
public override func reset() {
|
||||
super.reset()
|
||||
topMarginPadding = 8
|
||||
bottomMarginPadding = 0
|
||||
tabs.reset()
|
||||
}
|
||||
}
|
||||
|
||||
//TODO: Models changes
|
||||
|
||||
extension TabsTableViewCell: TopTabbarDelegate {
|
||||
public func shouldSelectItem(at index: Int, topTabbar: TopTabbar) -> Bool {
|
||||
if let moleculesArrays = json?.arrayForKey(KeyMolecules),
|
||||
let molecules = moleculesArrays[topTabbar.selectedIndex] as? [[AnyHashable: Any]] {
|
||||
if let molecules = tabsListItemModel?.molecules[topTabbar.selectedIndex] {
|
||||
delegateObject?.moleculeDelegate?.removeMolecules(molecules, sender: self, animation: index < tabs.selectedIndex ? .right : .left)
|
||||
}
|
||||
previousTabIndex = tabs.selectedIndex
|
||||
@ -65,8 +60,7 @@ extension TabsTableViewCell: TopTabbarDelegate {
|
||||
}
|
||||
|
||||
public func topTabbar(_ topTabbar: TopTabbar, didSelectItemAt index: Int) {
|
||||
if let moleculesArrays = json?.arrayForKey(KeyMolecules),
|
||||
let molecules = moleculesArrays[index] as? [[AnyHashable: Any]] {
|
||||
if let molecules = tabsListItemModel?.molecules[index] {
|
||||
delegateObject?.moleculeDelegate?.addMolecules(molecules, sender: self, animation: index < previousTabIndex ? .left : .right)
|
||||
}
|
||||
}
|
||||
@ -74,11 +68,11 @@ extension TabsTableViewCell: TopTabbarDelegate {
|
||||
|
||||
extension TabsTableViewCell: TopTabbarDataSource {
|
||||
public func number(ofTopTabbarItems topTabbar: TopTabbar) -> Int {
|
||||
return json?.optionalDictionaryForKey("tabs")?.optionalArrayForKey("tabs")?.count ?? 0
|
||||
return tabsListItemModel?.tabs.tabs.count ?? 0
|
||||
}
|
||||
|
||||
public func topTabbar(_ topTabbar: TopTabbar, titleForItemAt index: Int) -> String? {
|
||||
guard let tabs = json?.optionalDictionaryForKey("tabs")?.arrayForKey("tabs"), let label = tabs[index] as? [AnyHashable: Any], let title = label.optionalStringForKey(KeyText) else {
|
||||
guard let title = tabsListItemModel?.tabs.tabs[index].text else {
|
||||
return "Select"
|
||||
}
|
||||
return title
|
||||
|
||||
@ -37,7 +37,7 @@ import UIKit
|
||||
|
||||
//MARK: - MVMCoreMoleculeViewProtocol
|
||||
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
// guard let headlineModel = model as? headlinebodyswitch
|
||||
// headlineBody.setWithModel(mode, <#T##delegateObject: MVMCoreUIDelegateObject?##MVMCoreUIDelegateObject?#>, <#T##additionalData: [String : AnyHashable]?##[String : AnyHashable]?#>)
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import Foundation
|
||||
|
||||
public protocol ModelMoleculeViewProtocol {
|
||||
func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String: AnyHashable]?)
|
||||
func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?)
|
||||
func nameForReuse(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String?
|
||||
static func estimatedHeight(forRow molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat?
|
||||
static func requiredModules(_ molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]?
|
||||
|
||||
@ -19,7 +19,7 @@ open class ModuleMolecule: Container {
|
||||
super.setupView()
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String: AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
|
||||
guard let moduleMoleculeModel = model as? ModuleMoleculeModel,
|
||||
|
||||
@ -25,7 +25,7 @@ open class MoleculeContainer: Container {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
if let casteModel = model as? MoleculeContainerModel {
|
||||
if view != nil {
|
||||
(view as? ModelMoleculeViewProtocol)?.setWithModel(casteModel.molecule, delegateObject, additionalData)
|
||||
|
||||
@ -28,7 +28,7 @@ import UIKit
|
||||
constraint.isActive = true
|
||||
}
|
||||
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
#warning("This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.")
|
||||
//TODO: This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.
|
||||
setUpDefaultWithModel(model, delegateObject, additionalData)
|
||||
|
||||
@ -42,7 +42,7 @@ public class StandardHeaderView: MoleculeContainer {
|
||||
}
|
||||
}
|
||||
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
|
||||
guard let headerModel = model as? HeaderModel else {
|
||||
|
||||
@ -34,10 +34,10 @@ struct EyebrowHeadlineBodyLinkModel: MoleculeProtocol {
|
||||
guard stack.superview == nil else {
|
||||
return
|
||||
}
|
||||
let eyebrowStackItem = MoleculeStackItemModel(with: casteModel!.eyeBrow!)
|
||||
let headlineStackItem = MoleculeStackItemModel(with: casteModel!.headline!)
|
||||
let bodyStackItem = MoleculeStackItemModel(with: casteModel!.body!)
|
||||
let linkStackItem = MoleculeStackItemModel(with: casteModel!.link!)
|
||||
let eyebrowStackItem = StackItemModel(with: casteModel!.eyeBrow!)
|
||||
let headlineStackItem = StackItemModel(with: casteModel!.headline!)
|
||||
let bodyStackItem = StackItemModel(with: casteModel!.body!)
|
||||
let linkStackItem = StackItemModel(with: casteModel!.link!)
|
||||
|
||||
// To visually take into account the extra padding in the intrinsic content of a button.
|
||||
linkStackItem.spacing = -6
|
||||
|
||||
@ -119,7 +119,7 @@ open class HeadlineBody: View {
|
||||
}
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let headlineBodyModel = model as? HeadlineBodyModel else {
|
||||
|
||||
@ -81,7 +81,7 @@ open class Carousel: ViewConstrainingView, ModelMoleculeViewProtocol {
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
//TODO: Model, Change to model
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
guard let caroselModel = model as? CarouselModel else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -11,11 +11,11 @@ import Foundation
|
||||
@objcMembers public class MoleculeStackModel: ContainerModel, MoleculeProtocol {
|
||||
public static var identifier: String = "moleculeStack"
|
||||
public var backgroundColor: Color?
|
||||
public var molecules: [MoleculeStackItemModel]
|
||||
public var molecules: [StackItemModel]
|
||||
public var axis: NSLayoutConstraint.Axis = .vertical
|
||||
public var spacing: CGFloat = 16.0
|
||||
|
||||
public init(molecules: [MoleculeStackItemModel]) {
|
||||
public init(molecules: [StackItemModel]) {
|
||||
self.molecules = molecules
|
||||
super.init()
|
||||
}
|
||||
@ -29,7 +29,7 @@ import Foundation
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: StackCodingKeys.self)
|
||||
molecules = try typeContainer.decodeMolecules(codingKey: .molecules) as! [MoleculeStackItemModel]
|
||||
molecules = try typeContainer.decodeMolecules(codingKey: .molecules) as! [StackItemModel]
|
||||
if let axisString = try typeContainer.decodeIfPresent(String.self, forKey: .axis), let optionalAxis = NSLayoutConstraint.Axis(rawValue: axisString) {
|
||||
axis = optionalAxis
|
||||
}
|
||||
@ -95,7 +95,7 @@ open class MoleculeStackView: Container {
|
||||
}
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
|
||||
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
let previousModel = stackModel
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
removeAllItemViews()
|
||||
@ -139,9 +139,9 @@ open class MoleculeStackView: Container {
|
||||
let data = try! JSONSerialization.data(withJSONObject: json!)
|
||||
let decoder = JSONDecoder()
|
||||
let model = try! decoder.decode(MoleculeStackModel.self, from: data)
|
||||
setWithModel(model, delegateObject, additionalData as? [String : AnyHashable])
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
} else {
|
||||
setWithModel(model, delegateObject, additionalData as? [String : AnyHashable])
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -210,7 +210,7 @@ open class MoleculeStackView: Container {
|
||||
func addView(_ view: View, lastItem: Bool) {
|
||||
guard let model = view.model else { return }
|
||||
let stackItem = StackItem(andContain: view)
|
||||
stackItem.model = MoleculeStackItemModel(with: model)
|
||||
stackItem.model = StackItemModel(with: model)
|
||||
addStackItem(stackItem, lastItem: lastItem)
|
||||
}
|
||||
|
||||
|
||||
@ -12,7 +12,7 @@ public protocol MoleculeDelegateProtocol {
|
||||
|
||||
/// returns a module for the corresponding module name.
|
||||
func getModuleWithName(_ name: String?) -> [AnyHashable : Any]?
|
||||
func getModuleWithName(_ moleculeName: String) -> Model?
|
||||
func getModuleWithName(_ moleculeName: String) -> MoleculeProtocol?
|
||||
|
||||
/// Notifies the delegate that the molecule layout update. Should be called when the layout may change due to an async method.
|
||||
func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) //optional
|
||||
|
||||
@ -14,7 +14,7 @@ import Foundation
|
||||
ModelRegistry.register(HeaderModel.self)
|
||||
ModelRegistry.register(HeadlineBodyModel.self)
|
||||
ModelRegistry.register(MoleculeStackModel.self)
|
||||
ModelRegistry.register(MoleculeStackItemModel.self)
|
||||
ModelRegistry.register(StackItemModel.self)
|
||||
ModelRegistry.register(ListItemModel.self)
|
||||
ModelRegistry.register(TextFieldModel.self)
|
||||
ModelRegistry.register(LineModel.self)
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
//
|
||||
// MoleculeListCellProtocol.h
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 5/22/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
#import <UIKit/UIKit.h>
|
||||
@class MVMCoreUIDelegateObject;
|
||||
|
||||
@protocol MoleculeListCellProtocol <NSObject>
|
||||
@optional
|
||||
|
||||
/// Can set the separator according to what the moleculeList commands.
|
||||
- (void)setSeparatorWithJSON:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData indexPath:(nonnull NSIndexPath *)indexPath;
|
||||
|
||||
/// Handle action
|
||||
- (void)didSelectCellAtIndex:(nonnull NSIndexPath *)indexPath delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData;
|
||||
|
||||
- (void)willDisplay;
|
||||
|
||||
@end
|
||||
32
MVMCoreUI/Templates/MoleculeListCellProtocol.swift
Normal file
32
MVMCoreUI/Templates/MoleculeListCellProtocol.swift
Normal file
@ -0,0 +1,32 @@
|
||||
//
|
||||
// MoleculeListCellProtocol.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/10/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public protocol MoleculeListCellProtocol {
|
||||
/// Can set the separator according to what the moleculeList commands.
|
||||
func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath)
|
||||
|
||||
/// Handle action when cell is pressed
|
||||
func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?)
|
||||
|
||||
/// Called by the list when the cell will display.
|
||||
func willDisplay()
|
||||
}
|
||||
|
||||
// Default implementation does nothing
|
||||
extension MoleculeListCellProtocol {
|
||||
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?, indexPath: IndexPath) {
|
||||
}
|
||||
|
||||
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
}
|
||||
|
||||
func willDisplay() {
|
||||
}
|
||||
}
|
||||
@ -85,7 +85,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
let moleculeCell = cell as? MVMCoreUIMoleculeViewProtocol
|
||||
moleculeCell?.reset?()
|
||||
if let protocolCell = cell as? MoleculeListCellProtocol {
|
||||
protocolCell.setSeparatorWithJSON?(loadObject?.pageJSON?.optionalDictionaryForKey("separator"), delegateObject: delegate, additionalData: nil, indexPath: indexPath)
|
||||
protocolCell.setLines(with: templateModel?.line, delegateObject: delegate, additionalData: nil, indexPath: indexPath)
|
||||
}
|
||||
(moleculeCell as? ModelMoleculeViewProtocol)?.setWithModel(moleculeInfo.molecule, delegate, nil)
|
||||
moleculeCell?.updateView(tableView.bounds.width)
|
||||
@ -95,13 +95,13 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
open override func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) {
|
||||
|
||||
if let protocolCell = cell as? MoleculeListCellProtocol {
|
||||
protocolCell.willDisplay?()
|
||||
protocolCell.willDisplay()
|
||||
}
|
||||
}
|
||||
|
||||
open override func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
||||
if let cell = tableView.cellForRow(at: indexPath) as? MoleculeListCellProtocol {
|
||||
cell.didSelectCell?(atIndex: indexPath, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, additionalData: nil)
|
||||
cell.didSelectCell(at: indexPath, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, additionalData: nil)
|
||||
}
|
||||
}
|
||||
|
||||
@ -167,7 +167,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
||||
func getMoleculeInfo(with listItem: ListItemModelProtocol?) -> (identifier: String, class: AnyClass, molecule: ListItemModelProtocol)? {
|
||||
guard let listItem = listItem,
|
||||
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(listItem),
|
||||
let moleculeName = (moleculeClass as? ModelMoleculeViewProtocol)?.nameForReuse(listItem, delegateObject() as? MVMCoreUIDelegateObject) ?? listItem.molecule.moleculeName else {
|
||||
let moleculeName = (moleculeClass as? ModelMoleculeViewProtocol)?.nameForReuse(listItem, delegateObject() as? MVMCoreUIDelegateObject) else {
|
||||
return nil
|
||||
}
|
||||
return (moleculeName, moleculeClass, listItem)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user