merge dev
This commit is contained in:
commit
2b85991bfd
@ -97,6 +97,8 @@
|
|||||||
0AE14F64238315D2005417F8 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14F63238315D2005417F8 /* TextField.swift */; };
|
0AE14F64238315D2005417F8 /* TextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE14F63238315D2005417F8 /* TextField.swift */; };
|
||||||
0AE98BAF23FEF956004C5109 /* ExternalLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BAE23FEF956004C5109 /* ExternalLink.swift */; };
|
0AE98BAF23FEF956004C5109 /* ExternalLink.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BAE23FEF956004C5109 /* ExternalLink.swift */; };
|
||||||
0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */; };
|
0AE98BB323FF0934004C5109 /* ExternalLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */; };
|
||||||
|
0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB423FF18D2004C5109 /* Arrow.swift */; };
|
||||||
|
0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */; };
|
||||||
31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; };
|
31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */; };
|
||||||
31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; };
|
31BE15CC23D8924D00452370 /* CheckboxModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 31BE15CA23D8924C00452370 /* CheckboxModel.swift */; };
|
||||||
522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; };
|
522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = 522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */; };
|
||||||
@ -439,6 +441,8 @@
|
|||||||
0AE14F63238315D2005417F8 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = "<group>"; };
|
0AE14F63238315D2005417F8 /* TextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextField.swift; sourceTree = "<group>"; };
|
||||||
0AE98BAE23FEF956004C5109 /* ExternalLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLink.swift; sourceTree = "<group>"; };
|
0AE98BAE23FEF956004C5109 /* ExternalLink.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLink.swift; sourceTree = "<group>"; };
|
||||||
0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLinkModel.swift; sourceTree = "<group>"; };
|
0AE98BB223FF0934004C5109 /* ExternalLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExternalLinkModel.swift; sourceTree = "<group>"; };
|
||||||
|
0AE98BB423FF18D2004C5109 /* Arrow.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Arrow.swift; sourceTree = "<group>"; };
|
||||||
|
0AE98BB623FF18E9004C5109 /* ArrowModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArrowModel.swift; sourceTree = "<group>"; };
|
||||||
31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxLabelModel.swift; sourceTree = "<group>"; };
|
31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxLabelModel.swift; sourceTree = "<group>"; };
|
||||||
31BE15CA23D8924C00452370 /* CheckboxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxModel.swift; sourceTree = "<group>"; };
|
31BE15CA23D8924C00452370 /* CheckboxModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CheckboxModel.swift; sourceTree = "<group>"; };
|
||||||
522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = "<group>"; };
|
522679BF23FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListLeftVariableCheckboxAllTextAndLinks.swift; sourceTree = "<group>"; };
|
||||||
@ -1031,6 +1035,7 @@
|
|||||||
D22B38EA23F4E08B00490EF6 /* List */ = {
|
D22B38EA23F4E08B00490EF6 /* List */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
|
52267A0523FFE0A900906CBA /* OneColumn */,
|
||||||
AA4FC2A323F4F69600E251DB /* RightVariable */,
|
AA4FC2A323F4F69600E251DB /* RightVariable */,
|
||||||
D22B38EB23F4E0AE00490EF6 /* LeftVariable */,
|
D22B38EB23F4E0AE00490EF6 /* LeftVariable */,
|
||||||
);
|
);
|
||||||
@ -1053,7 +1058,6 @@
|
|||||||
D22B38EC23F4E10700490EF6 /* SectionDividers */ = {
|
D22B38EC23F4E10700490EF6 /* SectionDividers */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
52267A0523FFE0A900906CBA /* OneColumn */,
|
|
||||||
D22B38ED23F4E11100490EF6 /* ThreeColumn */,
|
D22B38ED23F4E11100490EF6 /* ThreeColumn */,
|
||||||
);
|
);
|
||||||
path = SectionDividers;
|
path = SectionDividers;
|
||||||
@ -1346,6 +1350,8 @@
|
|||||||
0AA33B392398524F0067DD0F /* Toggle.swift */,
|
0AA33B392398524F0067DD0F /* Toggle.swift */,
|
||||||
D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */,
|
D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */,
|
||||||
012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */,
|
012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */,
|
||||||
|
0AE98BB623FF18E9004C5109 /* ArrowModel.swift */,
|
||||||
|
0AE98BB423FF18D2004C5109 /* Arrow.swift */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1862,6 +1868,7 @@
|
|||||||
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
|
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
|
||||||
D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */,
|
D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */,
|
||||||
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
|
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
|
||||||
|
0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */,
|
||||||
017BEB4223620AD20024EF95 /* FormModelProtocol.swift in Sources */,
|
017BEB4223620AD20024EF95 /* FormModelProtocol.swift in Sources */,
|
||||||
D2D90B442404789000DD6EC9 /* MoleculeContainerProtocol.swift in Sources */,
|
D2D90B442404789000DD6EC9 /* MoleculeContainerProtocol.swift in Sources */,
|
||||||
012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */,
|
012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */,
|
||||||
@ -1886,6 +1893,7 @@
|
|||||||
01EB369323609801006832FA /* HeaderModel.swift in Sources */,
|
01EB369323609801006832FA /* HeaderModel.swift in Sources */,
|
||||||
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
|
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
|
||||||
0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */,
|
0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */,
|
||||||
|
0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */,
|
||||||
D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */,
|
D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */,
|
||||||
012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */,
|
012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */,
|
||||||
94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */,
|
94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */,
|
||||||
|
|||||||
@ -125,7 +125,7 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
setTitleColor(disabledColor, for: .disabled)
|
setTitleColor(disabledColor, for: .disabled)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let caretLinkModel = model as? CaretLinkModel else { return }
|
guard let caretLinkModel = model as? CaretLinkModel else { return }
|
||||||
if let color = caretLinkModel.backgroundColor {
|
if let color = caretLinkModel.backgroundColor {
|
||||||
backgroundColor = color.uiColor
|
backgroundColor = color.uiColor
|
||||||
@ -147,7 +147,7 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol {
|
|||||||
return .leading
|
return .leading
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 10.5
|
return 10.5
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -20,8 +20,8 @@ open class ExternalLink: Link {
|
|||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ExternalLinkModel else { return }
|
guard let model = model as? ExternalLinkModel else { return }
|
||||||
|
|
||||||
|
|||||||
@ -40,9 +40,8 @@ import UIKit
|
|||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? LinkModel else { return }
|
guard let model = model as? LinkModel else { return }
|
||||||
|
|
||||||
setTitle(model.title, for: .normal)
|
setTitle(model.title, for: .normal)
|
||||||
@ -52,7 +51,7 @@ import UIKit
|
|||||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 31.0
|
return 31.0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -119,9 +119,9 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol, FormValidation
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
// The button will get styled in the enable check in super.
|
// The button will get styled in the enable check in super.
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ButtonModel else { return }
|
guard let model = model as? ButtonModel else { return }
|
||||||
setTitle(model.title, for: .normal)
|
setTitle(model.title, for: .normal)
|
||||||
@ -132,8 +132,8 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol, FormValidation
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
PillButton.getHeight(for: (molecule as? ButtonModel)?.size, size: MVMCoreUIUtility.getWidth())
|
PillButton.getHeight(for: (model as? ButtonModel)?.size, size: MVMCoreUIUtility.getWidth())
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
|
|||||||
@ -10,9 +10,7 @@ import Foundation
|
|||||||
|
|
||||||
// temporary until link is finished
|
// temporary until link is finished
|
||||||
extension PrimaryButton: ModelMoleculeViewProtocol {
|
extension PrimaryButton: ModelMoleculeViewProtocol {
|
||||||
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
|
||||||
|
|
||||||
guard let model = model as? ButtonModel else { return }
|
guard let model = model as? ButtonModel else { return }
|
||||||
|
|
||||||
setTitle(model.title, for: .normal)
|
setTitle(model.title, for: .normal)
|
||||||
|
|||||||
@ -69,12 +69,12 @@ import UIKit
|
|||||||
dropDownCaretView.centerYAnchor.constraint(equalTo: container.centerYAnchor).isActive = true
|
dropDownCaretView.centerYAnchor.constraint(equalTo: container.centerYAnchor).isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? BaseDropdownEntryFieldModel else { return }
|
guard let model = model as? BaseDropdownEntryFieldModel else { return }
|
||||||
|
|
||||||
dropDownCaretView.setWithModel(model.caretView, delegateObject, additionalData)
|
dropDownCaretView.setOptional(with: model.caretView, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -111,8 +111,8 @@ import UIKit
|
|||||||
setTextWith(date: datePicker?.date)
|
setTextWith(date: datePicker?.date)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? DateDropdownEntryFieldModel else { return }
|
guard let model = model as? DateDropdownEntryFieldModel else { return }
|
||||||
|
|
||||||
|
|||||||
@ -328,7 +328,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
|
|
||||||
guard let model = model as? DigitEntryFieldModel else { return }
|
guard let model = model as? DigitEntryFieldModel else { return }
|
||||||
@ -341,7 +341,7 @@ import UIKit
|
|||||||
MVMCoreUICommonViewsUtility.addDismissToolbar(digitBox.digitField, delegate: delegateObject as? UITextFieldDelegate)
|
MVMCoreUICommonViewsUtility.addDismissToolbar(digitBox.digitField, delegate: delegateObject as? UITextFieldDelegate)
|
||||||
}
|
}
|
||||||
|
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -240,13 +240,13 @@ import UIKit
|
|||||||
entryFieldContainer.reset()
|
entryFieldContainer.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
|
|
||||||
guard let model = model as? EntryFieldModel else { return }
|
guard let model = model as? EntryFieldModel else { return }
|
||||||
|
|
||||||
entryFieldContainer.setWithModel(model, delegateObject, additionalData)
|
entryFieldContainer.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
title = model.title
|
title = model.title
|
||||||
feedback = model.feedback
|
feedback = model.feedback
|
||||||
|
|||||||
@ -95,8 +95,8 @@ open class ItemDropdownEntryField: BaseDropdownEntryField {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? ItemDropdownEntryFieldModel else { return }
|
guard let model = model as? ItemDropdownEntryFieldModel else { return }
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@ enum TextType: String {
|
|||||||
}
|
}
|
||||||
extension MFTextField: ModelMoleculeViewProtocol {
|
extension MFTextField: ModelMoleculeViewProtocol {
|
||||||
//
|
//
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
//TODO: Need to create setWithModel in ViewConstraining View
|
//TODO: Need to create setWithModel in ViewConstraining View
|
||||||
#warning("This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.")
|
#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.
|
//TODO: This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.
|
||||||
|
|||||||
@ -277,8 +277,8 @@ import UIKit
|
|||||||
resignFirstResponder()
|
resignFirstResponder()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? TextEntryFieldModel else { return }
|
guard let model = model as? TextEntryFieldModel else { return }
|
||||||
|
|
||||||
|
|||||||
100
MVMCoreUI/Atoms/Views/Arrow.swift
Normal file
100
MVMCoreUI/Atoms/Views/Arrow.swift
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
//
|
||||||
|
// Arrow.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 2/20/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
open class Arrow: View {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
var arrowLayer = CAShapeLayer()
|
||||||
|
|
||||||
|
public var arrowModel: ArrowModel? {
|
||||||
|
return model as? ArrowModel
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Constraints
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public var heightConstraint: NSLayoutConstraint?
|
||||||
|
public var widthConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
public func pinHeightAndWidth(constant: CGFloat = 12) {
|
||||||
|
|
||||||
|
heightConstraint = heightAnchor.constraint(equalToConstant: constant)
|
||||||
|
widthConstraint = widthAnchor.constraint(equalToConstant: constant)
|
||||||
|
heightConstraint?.isActive = true
|
||||||
|
widthConstraint?.isActive = true
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Lifecycle
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
open override func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
|
||||||
|
drawShapeLayer()
|
||||||
|
isOpaque = false
|
||||||
|
layer.addSublayer(arrowLayer)
|
||||||
|
arrowLayer.strokeEnd = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Drawing
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
open override func draw(_ rect: CGRect) {
|
||||||
|
super.draw(rect)
|
||||||
|
|
||||||
|
arrowLayer.transform = CATransform3DIdentity
|
||||||
|
drawShapeLayer()
|
||||||
|
|
||||||
|
if let degrees = arrowModel?.degrees {
|
||||||
|
let radians = CGFloat(degrees * Float.pi / 180)
|
||||||
|
arrowLayer.transform = CATransform3DMakeRotation(-radians, 0.0, 0.0, 1.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private func drawShapeLayer() {
|
||||||
|
|
||||||
|
arrowLayer.frame = bounds
|
||||||
|
arrowLayer.strokeColor = arrowModel?.color.cgColor
|
||||||
|
arrowLayer.fillColor = UIColor.clear.cgColor
|
||||||
|
arrowLayer.path = arrowPath()
|
||||||
|
arrowLayer.lineJoin = .miter
|
||||||
|
arrowLayer.lineCap = .butt
|
||||||
|
arrowLayer.lineWidth = arrowModel?.lineWidth ?? 1
|
||||||
|
}
|
||||||
|
|
||||||
|
private func arrowPath() -> CGPath {
|
||||||
|
|
||||||
|
let length = max(bounds.size.height, bounds.size.width)
|
||||||
|
let inset = (arrowModel?.lineWidth ?? 1) / 2
|
||||||
|
let midLength = length / 2
|
||||||
|
|
||||||
|
var startPoint = CGPoint(x: midLength, y: inset)
|
||||||
|
let pivotPoint = CGPoint(x: length - inset, y: midLength)
|
||||||
|
var endPoint = CGPoint(x: midLength, y: length - inset)
|
||||||
|
|
||||||
|
let bezierPath = UIBezierPath()
|
||||||
|
bezierPath.move(to: startPoint)
|
||||||
|
bezierPath.addLine(to: pivotPoint)
|
||||||
|
bezierPath.addLine(to: endPoint)
|
||||||
|
|
||||||
|
startPoint = CGPoint(x: inset, y: midLength)
|
||||||
|
endPoint = CGPoint(x: length - inset, y: midLength)
|
||||||
|
|
||||||
|
bezierPath.move(to: startPoint)
|
||||||
|
bezierPath.addLine(to: pivotPoint)
|
||||||
|
|
||||||
|
return bezierPath.cgPath
|
||||||
|
}
|
||||||
|
}
|
||||||
80
MVMCoreUI/Atoms/Views/ArrowModel.swift
Normal file
80
MVMCoreUI/Atoms/Views/ArrowModel.swift
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
//
|
||||||
|
// ArrowModel.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kevin Christiano on 2/20/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
open class ArrowModel: MoleculeModelProtocol {
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Properties
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
public static var identifier: String = "arrow"
|
||||||
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
|
public var color: Color = Color(uiColor: .mvmBlack)
|
||||||
|
public var degrees: Float = 0
|
||||||
|
public var lineWidth: CGFloat = 1
|
||||||
|
|
||||||
|
public var height: CGFloat = 12
|
||||||
|
public var width: CGFloat = 12
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Keys
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
case moleculeName
|
||||||
|
case backgroundColor
|
||||||
|
case color
|
||||||
|
case degrees
|
||||||
|
case size
|
||||||
|
case lineWidth
|
||||||
|
case height
|
||||||
|
case width
|
||||||
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - Codec
|
||||||
|
//--------------------------------------------------
|
||||||
|
|
||||||
|
required public init(from decoder: Decoder) throws {
|
||||||
|
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||||
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
|
|
||||||
|
if let color = try typeContainer.decodeIfPresent(Color.self, forKey: .color) {
|
||||||
|
self.color = color
|
||||||
|
}
|
||||||
|
|
||||||
|
if let degrees = try typeContainer.decodeIfPresent(Float.self, forKey: .degrees) {
|
||||||
|
self.degrees = degrees
|
||||||
|
}
|
||||||
|
|
||||||
|
if let lineWidth = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .lineWidth) {
|
||||||
|
self.lineWidth = lineWidth
|
||||||
|
}
|
||||||
|
|
||||||
|
if let height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height) {
|
||||||
|
self.lineWidth = height
|
||||||
|
}
|
||||||
|
|
||||||
|
if let width = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .width) {
|
||||||
|
self.width = width
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func encode(to encoder: Encoder) throws {
|
||||||
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
|
try container.encode(color, forKey: .color)
|
||||||
|
try container.encode(degrees, forKey: .degrees)
|
||||||
|
try container.encodeIfPresent(backgroundColor, forKey: .lineWidth)
|
||||||
|
try container.encode(width, forKey: .width)
|
||||||
|
try container.encode(height, forKey: .height)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -184,12 +184,12 @@ open class CaretView: View {
|
|||||||
|
|
||||||
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 }
|
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: CaretViewModel.self) else { return }
|
||||||
setWithModel(model, delegateObject, additionalData)
|
set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
//MARK: - MVMCoreMoleculeViewProtocol
|
//MARK: - MVMCoreMoleculeViewProtocol
|
||||||
override public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
override public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let caretModel = model as? CaretViewModel else {
|
guard let caretModel = model as? CaretViewModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -395,7 +395,7 @@ import MVMCore
|
|||||||
heightConstraint?.constant = dimension
|
heightConstraint?.constant = dimension
|
||||||
}
|
}
|
||||||
|
|
||||||
layoutIfNeeded()
|
//layoutIfNeeded()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
@ -456,8 +456,8 @@ import MVMCore
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? CheckboxModel else { return }
|
guard let model = model as? CheckboxModel else { return }
|
||||||
|
|
||||||
|
|||||||
@ -115,15 +115,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let checkBoxWithLabelModel = model as? CheckboxLabelModel else { return }
|
guard let checkBoxWithLabelModel = model as? CheckboxLabelModel else { return }
|
||||||
|
|
||||||
if let checkboxAlignment = checkBoxWithLabelModel.checkboxAlignment {
|
if let checkboxAlignment = checkBoxWithLabelModel.checkboxAlignment {
|
||||||
alignCheckbox(checkboxAlignment)
|
alignCheckbox(checkboxAlignment)
|
||||||
}
|
}
|
||||||
|
|
||||||
checkbox.setWithModel(checkBoxWithLabelModel.checkbox, delegateObject, additionalData)
|
checkbox.set(with: checkBoxWithLabelModel.checkbox, delegateObject, additionalData)
|
||||||
label.setWithModel(checkBoxWithLabelModel.label, delegateObject, additionalData)
|
label.set(with: checkBoxWithLabelModel.label, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -89,12 +89,12 @@ open class DashLine: View {
|
|||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
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 }
|
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: DashLineModel.self) else { return }
|
||||||
setWithModel(model, delegateObject, additionalData)
|
set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
//MARK: - MVMCoreMoleculeViewProtocol
|
//MARK: - MVMCoreMoleculeViewProtocol
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let dashLineModel = dashModel else {
|
guard let dashLineModel = dashModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,8 +26,8 @@ import UIKit
|
|||||||
widthAnchor.constraint(equalTo: heightAnchor).isActive = true
|
widthAnchor.constraint(equalTo: heightAnchor).isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
override open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? CircleProgressModel else { return }
|
guard let model = model as? CircleProgressModel else { return }
|
||||||
createGraphCircle(model)
|
createGraphCircle(model)
|
||||||
rotationAnimation(model)
|
rotationAnimation(model)
|
||||||
@ -35,7 +35,7 @@ import UIKit
|
|||||||
|
|
||||||
override open func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
override open func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: CircleProgressModel.self) else { return }
|
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: CircleProgressModel.self) else { return }
|
||||||
setWithModel(model, delegateObject, additionalData)
|
set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
class func getAngle(_ piValue: Double) -> Double {
|
class func getAngle(_ piValue: Double) -> Double {
|
||||||
|
|||||||
@ -302,7 +302,7 @@ public typealias ActionBlock = () -> ()
|
|||||||
case left
|
case left
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
|
||||||
clauses = []
|
clauses = []
|
||||||
|
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objcMembers open class LabelAttributeModel: Model {
|
@objcMembers open class LabelAttributeModel: ModelProtocol {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -179,13 +179,14 @@ import Foundation
|
|||||||
|
|
||||||
//MARK: - MVMCoreMoleculeViewProtocol
|
//MARK: - MVMCoreMoleculeViewProtocol
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let leftRightLabelModel = model as? LeftRightLabelModel else {
|
guard let leftRightLabelModel = model as? LeftRightLabelModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
leftTextLabel.setWithModel(leftRightLabelModel.leftText, delegateObject, additionalData)
|
leftTextLabel.set(with: leftRightLabelModel.leftText, delegateObject, additionalData)
|
||||||
rightTextLabel.setWithModel(leftRightLabelModel.rightText, delegateObject, additionalData)
|
rightTextLabel.setOptional(with: leftRightLabelModel.rightText, delegateObject, additionalData)
|
||||||
|
|
||||||
if !leftTextLabel.hasText {
|
if !leftTextLabel.hasText {
|
||||||
constrainRightLabel()
|
constrainRightLabel()
|
||||||
} else if !rightTextLabel.hasText {
|
} else if !rightTextLabel.hasText {
|
||||||
|
|||||||
@ -67,11 +67,11 @@ import UIKit
|
|||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
if let lineModel = model as? LineModel {
|
if let lineModel = model as? LineModel {
|
||||||
setStyle(lineModel.type ?? .standard)
|
setStyle(lineModel.type ?? .standard)
|
||||||
}
|
}
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
|
|||||||
@ -209,7 +209,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
// TODO: Temporary, should be moved to init once we have type erasure ready.
|
// TODO: Temporary, should be moved to init once we have type erasure ready.
|
||||||
setAsMolecule()
|
setAsMolecule()
|
||||||
|
|||||||
@ -9,16 +9,16 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension MFView {
|
extension MFView {
|
||||||
public func setUpDefaultWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func setUpDefaultWithModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
self.model = model
|
self.model = model
|
||||||
if let backgroundColor = model?.backgroundColor {
|
if let backgroundColor = model.backgroundColor {
|
||||||
self.backgroundColor = backgroundColor.uiColor
|
self.backgroundColor = backgroundColor.uiColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ModelMoleculeViewProtocol where Self: MFView {
|
extension ModelMoleculeViewProtocol where Self: MFView {
|
||||||
func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
setUpDefaultWithModel(model, delegateObject, additionalData)
|
setUpDefaultWithModel(model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import Foundation
|
|||||||
|
|
||||||
// temporary until link is finished
|
// temporary until link is finished
|
||||||
extension MVMCoreUISwitch: ModelMoleculeViewProtocol {
|
extension MVMCoreUISwitch: ModelMoleculeViewProtocol {
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
guard let model = model as? ToggleModel else { return }
|
guard let model = model as? ToggleModel else { return }
|
||||||
|
|
||||||
if let castSelf = self as? FormValidationProtocol {
|
if let castSelf = self as? FormValidationProtocol {
|
||||||
|
|||||||
@ -64,8 +64,8 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
//MARK: - MVMCoreMoleculeViewProtocol
|
//MARK: - MVMCoreMoleculeViewProtocol
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let multiProgressModel = multiProgressModel else {
|
guard let multiProgressModel = multiProgressModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -83,6 +83,6 @@ import UIKit
|
|||||||
|
|
||||||
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: MultiProgressBarModel.self) else { return }
|
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: MultiProgressBarModel.self) else { return }
|
||||||
setWithModel(model, delegateObject, additionalData)
|
set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,7 +51,7 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
//MARK: - MVMCoreMoleculeViewProtocol
|
//MARK: - MVMCoreMoleculeViewProtocol
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let progressBarModel = model as? ProgressBarModel else {
|
guard let progressBarModel = model as? ProgressBarModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -66,7 +66,7 @@ import Foundation
|
|||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// 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 }
|
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: ProgressBarModel.self) else { return }
|
||||||
setWithModel(model, delegateObject, additionalData)
|
set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func reset() {
|
public func reset() {
|
||||||
|
|||||||
@ -334,7 +334,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let toggleModel = model as? ToggleModel else {
|
guard let toggleModel = model as? ToggleModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -343,7 +343,7 @@ public typealias ActionBlockConfirmation = () -> (Bool)
|
|||||||
setWithJSON(toggleModelJSON, delegateObject: delegateObject, additionalData: additionalData)
|
setWithJSON(toggleModelJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return Self.getContainerHeight()
|
return Self.getContainerHeight()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -87,10 +87,10 @@ public typealias ButtonAction = (Button) -> ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
self.model = model
|
self.model = model
|
||||||
|
|
||||||
if let backgroundColor = model?.backgroundColor {
|
if let backgroundColor = model.backgroundColor {
|
||||||
self.backgroundColor = backgroundColor.uiColor
|
self.backgroundColor = backgroundColor.uiColor
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,15 +100,15 @@ public typealias ButtonAction = (Button) -> ()
|
|||||||
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
set(with: model.action, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
open class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
return model?.moleculeName
|
return model.moleculeName
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,22 +48,22 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
self.model = model
|
self.model = model
|
||||||
if let backgroundColor = model?.backgroundColor {
|
if let backgroundColor = model.backgroundColor {
|
||||||
self.backgroundColor = backgroundColor.uiColor
|
self.backgroundColor = backgroundColor.uiColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
open class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
return model?.moleculeName
|
return model.moleculeName
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -150,8 +150,8 @@ import UIKit
|
|||||||
contentView.preservesSuperviewLayoutMargins = false
|
contentView.preservesSuperviewLayoutMargins = false
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: Model, Change to model
|
//TODO: ModelProtocol, Change to model
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let model = model as? ListItemModelProtocol else { return }
|
guard let model = model as? ListItemModelProtocol else { return }
|
||||||
|
|
||||||
self.listItemModel = model
|
self.listItemModel = model
|
||||||
@ -169,7 +169,7 @@ import UIKit
|
|||||||
// override the separator
|
// override the separator
|
||||||
if let separator = model.line {
|
if let separator = model.line {
|
||||||
addSeparatorsIfNeeded()
|
addSeparatorsIfNeeded()
|
||||||
bottomSeparatorView?.setWithModel(separator, nil, nil)
|
bottomSeparatorView?.set(with: separator, nil, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let moleculeModel = model as? MoleculeModelProtocol,
|
if let moleculeModel = model as? MoleculeModelProtocol,
|
||||||
@ -183,11 +183,11 @@ import UIKit
|
|||||||
backgroundColor = .white
|
backgroundColor = .white
|
||||||
}
|
}
|
||||||
|
|
||||||
public class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
return model?.moleculeName
|
return model.moleculeName
|
||||||
}
|
}
|
||||||
|
|
||||||
public class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -246,8 +246,8 @@ import UIKit
|
|||||||
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?, indexPath: IndexPath) {
|
public func setLines(with model: LineModel?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?, indexPath: IndexPath) {
|
||||||
addSeparatorsIfNeeded()
|
addSeparatorsIfNeeded()
|
||||||
if let model = model {
|
if let model = model {
|
||||||
topSeparatorView?.setWithModel(model, delegateObject, additionalData)
|
topSeparatorView?.set(with: model, delegateObject, additionalData)
|
||||||
bottomSeparatorView?.setWithModel(model, delegateObject, additionalData)
|
bottomSeparatorView?.set(with: model, delegateObject, additionalData)
|
||||||
} else {
|
} else {
|
||||||
topSeparatorView?.setStyle(.standard)
|
topSeparatorView?.setStyle(.standard)
|
||||||
bottomSeparatorView?.setStyle(.standard)
|
bottomSeparatorView?.setStyle(.standard)
|
||||||
|
|||||||
@ -40,22 +40,22 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
self.model = model
|
self.model = model
|
||||||
if let backgroundColor = model?.backgroundColor {
|
if let backgroundColor = model.backgroundColor {
|
||||||
self.backgroundColor = backgroundColor.uiColor
|
self.backgroundColor = backgroundColor.uiColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
open class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
return model?.moleculeName
|
return model.moleculeName
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,8 @@ open class Container: View, ContainerProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
override open func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
override open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let containerModel = model as? ContainerModelProtocol else { return }
|
guard let containerModel = model as? ContainerModelProtocol else { return }
|
||||||
containerHelper.set(with: containerModel, for: view as? MVMCoreUIViewConstrainingProtocol)
|
containerHelper.set(with: containerModel, for: view as? MVMCoreUIViewConstrainingProtocol)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -276,8 +276,8 @@ import UIKit
|
|||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,40 +30,40 @@ open class MoleculeContainer: Container {
|
|||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
if let casteModel = model as? MoleculeContainerModelProtocol {
|
if let casteModel = model as? MoleculeContainerModelProtocol {
|
||||||
if view != nil {
|
if view != nil {
|
||||||
(view as? ModelMoleculeViewProtocol)?.setWithModel(casteModel.molecule, delegateObject, additionalData)
|
(view as? ModelMoleculeViewProtocol)?.set(with: casteModel.molecule, delegateObject, additionalData)
|
||||||
} else {
|
} else {
|
||||||
if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(casteModel.molecule, delegateObject) {
|
if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(casteModel.molecule, delegateObject) {
|
||||||
addMolecule(molecule)
|
addMolecule(molecule)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override static func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public override static func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
guard let containerModel = model as? MoleculeContainerModelProtocol,
|
guard let containerModel = model as? MoleculeContainerModelProtocol,
|
||||||
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type,
|
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type,
|
||||||
let moleculeName = moleculeClass.nameForReuse(containerModel.molecule, delegateObject) else {
|
let moleculeName = moleculeClass.nameForReuse(with: containerModel.molecule, delegateObject) else {
|
||||||
return "\(model?.moleculeName ?? "moleculeContainer")<>"
|
return "\(model.moleculeName ?? "moleculeContainer")<>"
|
||||||
}
|
}
|
||||||
return "\(model?.moleculeName ?? "moleculeContainer")<\(moleculeName)>"
|
return "\(model.moleculeName ?? "moleculeContainer")<\(moleculeName)>"
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
guard let containerModel = molecule as? MoleculeContainerModelProtocol else { return 0 }
|
guard let containerModel = model as? MoleculeContainerModelProtocol else { return 0 }
|
||||||
guard let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type,
|
guard let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type,
|
||||||
let moleculeHeight = moleculeClass.estimatedHeight(forRow: containerModel.molecule, delegateObject: delegateObject) else {
|
let moleculeHeight = moleculeClass.estimatedHeight(with: containerModel.molecule, delegateObject) else {
|
||||||
return (containerModel.topMarginPadding ?? 0) + (containerModel.bottomMarginPadding ?? 0)
|
return (containerModel.topMarginPadding ?? 0) + (containerModel.bottomMarginPadding ?? 0)
|
||||||
}
|
}
|
||||||
return moleculeHeight + (containerModel.topMarginPadding ?? 0) + (containerModel.bottomMarginPadding ?? 0)
|
return moleculeHeight + (containerModel.topMarginPadding ?? 0) + (containerModel.bottomMarginPadding ?? 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
public override class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
guard let containerModel = molecule as? MoleculeContainerModelProtocol,
|
guard let containerModel = model as? MoleculeContainerModelProtocol,
|
||||||
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type else { return nil }
|
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type else { return nil }
|
||||||
return moleculeClass.requiredModules(containerModel.molecule, delegateObject: delegateObject, error: error)
|
return moleculeClass.requiredModules(with: containerModel.molecule, delegateObject, error: error)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public protocol FormModelProtocol: Model {
|
public protocol FormModelProtocol: ModelProtocol {
|
||||||
var required: Bool? { get }
|
var required: Bool? { get }
|
||||||
var fieldKey: String? { get }
|
var fieldKey: String? { get }
|
||||||
var groupName: String? { get }
|
var groupName: String? { get }
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public protocol MoleculeModelProtocol: Model {
|
public protocol MoleculeModelProtocol: ModelProtocol {
|
||||||
var moleculeName: String? { get }
|
var moleculeName: String? { get }
|
||||||
var backgroundColor: Color? { get set }
|
var backgroundColor: Color? { get set }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
public protocol TemplateModelProtocol: PageModelProtocol, Model {
|
public protocol TemplateModelProtocol: PageModelProtocol, ModelProtocol {
|
||||||
var template: String { get }
|
var template: String { get }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -11,30 +11,36 @@ import Foundation
|
|||||||
@objcMembers open class ListLeftVariableCheckboxAllTextAndLinks: TableViewCell {
|
@objcMembers open class ListLeftVariableCheckboxAllTextAndLinks: TableViewCell {
|
||||||
public let checkbox = Checkbox(frame: .zero)
|
public let checkbox = Checkbox(frame: .zero)
|
||||||
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
|
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
|
||||||
public let stack = Stack<StackModel>(frame: .zero)
|
public var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
// MARK: - Initializers
|
||||||
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
stack = Stack<StackModel>.createStack(with: [(view: checkbox, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
|
(view: eyebrowHeadlineBodyLink, model: StackItemModel(horizontalAlignment: .leading))],
|
||||||
|
axis: .horizontal)
|
||||||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
stack.stackItems = [StackItem(andContain: checkbox),StackItem(andContain: eyebrowHeadlineBodyLink)]
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
}
|
|
||||||
|
|
||||||
// MARK:- MVMCoreUIMoleculeViewProtocol
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
|
||||||
guard let model = model as? ListLeftVariableCheckboxAllTextAndLinksModel else { return}
|
|
||||||
checkbox.setWithModel(model.checkbox, delegateObject, additionalData)
|
|
||||||
eyebrowHeadlineBodyLink.setWithModel(model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
|
||||||
|
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill),
|
|
||||||
StackItemModel(horizontalAlignment: .leading)],
|
|
||||||
axis: .horizontal)
|
|
||||||
stack.model = stackModel
|
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
// MARK:- MVMCoreUIMoleculeViewProtocol
|
||||||
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
guard let model = model as? ListLeftVariableCheckboxAllTextAndLinksModel else { return}
|
||||||
|
checkbox.set(with: model.checkbox, delegateObject, additionalData)
|
||||||
|
eyebrowHeadlineBodyLink.set(with: model.eyebrowHeadlineBodyLink, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 140
|
return 140
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,39 +17,46 @@ import UIKit
|
|||||||
let leftImage = MFLoadImageView(pinnedEdges: .all)
|
let leftImage = MFLoadImageView(pinnedEdges: .all)
|
||||||
let leftLabel = Label.commonLabelB2(true)
|
let leftLabel = Label.commonLabelB2(true)
|
||||||
let rightLabel = Label.commonLabelB2(true)
|
let rightLabel = Label.commonLabelB2(true)
|
||||||
let stack = Stack<StackModel>(frame: .zero)
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//-----------------------------------------------------
|
||||||
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
stack = Stack<StackModel>.createStack(with: [(view: leftImage, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
|
(view: leftLabel, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
|
(view: rightLabel, model: StackItemModel(spacing: 4, horizontalAlignment: .trailing))],
|
||||||
|
axis: .horizontal)
|
||||||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
stack.stackItems = [StackItem(andContain: leftImage),StackItem(andContain: leftLabel),StackItem(andContain: rightLabel)]
|
|
||||||
addMolecule(stack)
|
|
||||||
leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal)
|
leftLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 901), for: .horizontal)
|
||||||
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
rightLabel.setContentHuggingPriority(UILayoutPriority(rawValue: 902), for: .horizontal)
|
||||||
|
addMolecule(stack)
|
||||||
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ListLeftVariableIconWithRightCaretModel else { return}
|
guard let model = model as? ListLeftVariableIconWithRightCaretModel else { return}
|
||||||
leftImage.setWithModel(model.image, delegateObject, additionalData)
|
leftImage.set(with: model.image, delegateObject, additionalData)
|
||||||
leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData)
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
|
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .fill),
|
|
||||||
StackItemModel(horizontalAlignment: .fill),
|
|
||||||
StackItemModel(horizontalAlignment: .trailing)],
|
|
||||||
axis: .horizontal)
|
|
||||||
stack.model = stackModel
|
|
||||||
stack.restack()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 90
|
return 90
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,74 @@
|
|||||||
|
//
|
||||||
|
// ListOneColumnFullWidthTextAllTextAndLinks.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Kruthika KP on 14/02/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
@objcMembers public class ListOneColumnFullWidthTextAllTextAndLinks: TableViewCell {
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Outlets
|
||||||
|
//-----------------------------------------------------
|
||||||
|
var stack: Stack<StackModel>
|
||||||
|
let eyebrow = Label.commonLabelB3(true)
|
||||||
|
let headline = Label.commonLabelH3(true)
|
||||||
|
let subHeadline = Label.commonLabelB1(true)
|
||||||
|
let body = Label.commonLabelB2(true)
|
||||||
|
let link = Link()
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//-----------------------------------------------------
|
||||||
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
stack = Stack<StackModel>.createStack(with: [eyebrow, headline, subHeadline, body, link])
|
||||||
|
stack.stackModel?.spacing = 0
|
||||||
|
stack.stackModel?.molecules[4].spacing = 2
|
||||||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - View Lifecycle
|
||||||
|
//-----------------------------------------------------
|
||||||
|
override open func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
addMolecule(stack)
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){
|
||||||
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
guard let model = model as? ListOneColumnFullWidthTextAllTextAndLinksModel else { return }
|
||||||
|
eyebrow.setOptional(with: model.eyebrow, delegateObject, additionalData)
|
||||||
|
headline.setOptional(with: model.headline, delegateObject, additionalData)
|
||||||
|
subHeadline.setOptional(with: model.subHeadline, delegateObject, additionalData)
|
||||||
|
body.setOptional(with: model.body, delegateObject, additionalData)
|
||||||
|
link.setOptional(with: model.link, delegateObject, additionalData)
|
||||||
|
|
||||||
|
// Hide labels if neeeded.
|
||||||
|
stack.stackModel?.molecules[0].gone = !eyebrow.hasText
|
||||||
|
stack.stackModel?.molecules[1].gone = !headline.hasText
|
||||||
|
stack.stackModel?.molecules[2].gone = !subHeadline.hasText
|
||||||
|
stack.stackModel?.molecules[3].gone = !body.hasText
|
||||||
|
stack.stackModel?.molecules[4].gone = (link.titleLabel?.text?.count ?? 0) == 0
|
||||||
|
stack.restack()
|
||||||
|
}
|
||||||
|
|
||||||
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
return 90
|
||||||
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
super.reset()
|
||||||
|
eyebrow.styleB3(true)
|
||||||
|
headline.styleH3(true)
|
||||||
|
subHeadline.styleB1(true)
|
||||||
|
body.styleB2(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,7 +11,22 @@ import Foundation
|
|||||||
let wheel = GraphView(frame: .zero)
|
let wheel = GraphView(frame: .zero)
|
||||||
let leftLabel = Label.commonLabelB1(true)
|
let leftLabel = Label.commonLabelB1(true)
|
||||||
let rightLabel = Label.commonLabelB2(true)
|
let rightLabel = Label.commonLabelB2(true)
|
||||||
let stack = Stack<StackModel>(frame: .zero)
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//-----------------------------------------------------
|
||||||
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .leading)),
|
||||||
|
(view: wheel, model: StackItemModel(horizontalAlignment: .fill)),
|
||||||
|
(view: rightLabel, model: StackItemModel(spacing: 4, horizontalAlignment: .fill))],
|
||||||
|
axis: .horizontal)
|
||||||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// MARK: - Setup
|
// MARK: - Setup
|
||||||
@ -19,26 +34,19 @@ import Foundation
|
|||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: wheel),StackItem(andContain: rightLabel)]
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ListRVWheelModel else { return }
|
guard let model = model as? ListRVWheelModel else { return }
|
||||||
leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData)
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
rightLabel.setWithModel(model.rightLabel, delegateObject, additionalData)
|
rightLabel.set(with: model.rightLabel, delegateObject, additionalData)
|
||||||
wheel.setWithModel(model.wheel, delegateObject, additionalData)
|
wheel.set(with: model.wheel, delegateObject, additionalData)
|
||||||
|
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .leading),
|
|
||||||
StackItemModel(horizontalAlignment: .fill),
|
|
||||||
StackItemModel(spacing: 4, horizontalAlignment: .fill)],
|
|
||||||
axis: .horizontal)
|
|
||||||
stack.model = stackModel
|
|
||||||
stack.restack()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------
|
//-------------------------------------------------
|
||||||
@ -50,7 +58,7 @@ import Foundation
|
|||||||
rightLabel.styleB2(true)
|
rightLabel.styleB2(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 70
|
return 70
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -15,34 +15,42 @@ import Foundation
|
|||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
let leftLabel = Label.commonLabelB1(true)
|
let leftLabel = Label.commonLabelB1(true)
|
||||||
let rightImage = MFLoadImageView(pinnedEdges: .all)
|
let rightImage = MFLoadImageView(pinnedEdges: .all)
|
||||||
let stack = Stack<StackModel>(frame: .zero)
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
//-----------------------------------------------------
|
||||||
|
// MARK: - Initializers
|
||||||
|
//-----------------------------------------------------
|
||||||
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
stack = Stack<StackModel>.createStack(with: [(view: leftLabel, model: StackItemModel(horizontalAlignment: .leading)),
|
||||||
|
(view: rightImage, model: StackItemModel(horizontalAlignment: .fill))],
|
||||||
|
axis: .horizontal)
|
||||||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------
|
//-----------------------------------------------------
|
||||||
// MARK: - View Lifecycle
|
// MARK: - View Lifecycle
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
stack.stackItems = [StackItem(andContain: leftLabel),StackItem(andContain: rightImage)]
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
// MARK: - Molecule
|
// MARK: - Molecule
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ListRightVariablePaymentsModel else { return }
|
guard let model = model as? ListRightVariablePaymentsModel else { return }
|
||||||
leftLabel.setWithModel(model.leftLabel, delegateObject, additionalData)
|
leftLabel.set(with: model.leftLabel, delegateObject, additionalData)
|
||||||
rightImage.setWithModel(model.image, delegateObject, additionalData)
|
rightImage.set(with: model.image, delegateObject, additionalData)
|
||||||
|
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(horizontalAlignment: .leading),
|
|
||||||
StackItemModel(horizontalAlignment: .fill)],
|
|
||||||
axis: .horizontal)
|
|
||||||
stack.model = stackModel
|
|
||||||
stack.restack()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 65
|
return 65
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,65 +0,0 @@
|
|||||||
//
|
|
||||||
// ListOneColumnFullWidthTextAllTextAndLinks.swift
|
|
||||||
// MVMCoreUI
|
|
||||||
//
|
|
||||||
// Created by Kruthika KP on 14/02/20.
|
|
||||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
@objcMembers public class ListOneColumnFullWidthTextAllTextAndLinks: TableViewCell {
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
// MARK: - Outlets
|
|
||||||
//-----------------------------------------------------
|
|
||||||
|
|
||||||
let stack = Stack<StackModel>(frame: .zero)
|
|
||||||
let eyebrow = Label.commonLabelB3(true)
|
|
||||||
let headline = Label.commonLabelH3(true)
|
|
||||||
let subHeadline = Label.commonLabelB1(true)
|
|
||||||
let body = Label.commonLabelB2(true)
|
|
||||||
let link = Link()
|
|
||||||
|
|
||||||
//-----------------------------------------------------
|
|
||||||
// MARK: - View Lifecycle
|
|
||||||
//-------------------------------------------------------
|
|
||||||
override open func setupView() {
|
|
||||||
super.setupView()
|
|
||||||
stack.stackItems = [StackItem(andContain: eyebrow),
|
|
||||||
StackItem(andContain: headline),
|
|
||||||
StackItem(andContain: subHeadline),
|
|
||||||
StackItem(andContain: body),
|
|
||||||
StackItem(andContain: link)]
|
|
||||||
addMolecule(stack)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?){
|
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
|
||||||
guard let model = model as? ListOneColumnFullWidthTextAllTextAndLinksModel else { return}
|
|
||||||
eyebrow.setWithModel(model.eyebrow, delegateObject, additionalData)
|
|
||||||
headline.setWithModel(model.headline, delegateObject, additionalData)
|
|
||||||
subHeadline.setWithModel(model.subHeadline, delegateObject, additionalData)
|
|
||||||
body.setWithModel(model.body, delegateObject, additionalData)
|
|
||||||
link.setWithModel(model.link, delegateObject, additionalData)
|
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(spacing: 2, gone: !eyebrow.hasText),
|
|
||||||
StackItemModel(spacing: 2, gone: !headline.hasText),
|
|
||||||
StackItemModel(spacing: 2, gone: !subHeadline.hasText),
|
|
||||||
StackItemModel(spacing: 2, gone: !body.hasText),
|
|
||||||
StackItemModel(spacing: 2, gone: (link.titleLabel?.text?.count ?? 0) == 0)])
|
|
||||||
stack.model = stackModel
|
|
||||||
stack.restack()
|
|
||||||
}
|
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat?{
|
|
||||||
return 90
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
eyebrow.styleB3(true)
|
|
||||||
headline.styleH3(true)
|
|
||||||
subHeadline.styleB1(true)
|
|
||||||
body.styleB2(true)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -13,35 +13,38 @@ import Foundation
|
|||||||
let leftHeadlineBody = HeadlineBody(frame: .zero)
|
let leftHeadlineBody = HeadlineBody(frame: .zero)
|
||||||
let centerHeadLineBody = HeadlineBody(frame: .zero)
|
let centerHeadLineBody = HeadlineBody(frame: .zero)
|
||||||
let rightHeadLineBody = HeadlineBody(frame: .zero)
|
let rightHeadLineBody = HeadlineBody(frame: .zero)
|
||||||
let stack = Stack<StackModel>(frame: .zero)
|
var stack: Stack<StackModel>
|
||||||
|
|
||||||
|
// MARK: - Initializers
|
||||||
|
public override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
|
||||||
|
stack = Stack<StackModel>.createStack(with: [(view: leftHeadlineBody, model: StackItemModel(percent: 33, horizontalAlignment: .leading)),
|
||||||
|
(view: centerHeadLineBody, model: StackItemModel(percent: 34, horizontalAlignment: .center)),
|
||||||
|
(view: rightHeadLineBody, model: StackItemModel(percent: 33, horizontalAlignment: .trailing))],
|
||||||
|
axis: .horizontal)
|
||||||
|
super.init(style: style, reuseIdentifier: reuseIdentifier)
|
||||||
|
}
|
||||||
|
|
||||||
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
|
fatalError("init(coder:) has not been implemented")
|
||||||
|
}
|
||||||
|
|
||||||
// MARK: - MFViewProtocol
|
// MARK: - MFViewProtocol
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
|
|
||||||
//using stackItems to align the three headlineBody
|
|
||||||
stack.stackItems = [StackItem(andContain: leftHeadlineBody),StackItem(andContain: centerHeadLineBody),StackItem(andContain: rightHeadLineBody)]
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ListThreeColumnPlanDataDividerModel else { return }
|
guard let model = model as? ListThreeColumnPlanDataDividerModel else { return }
|
||||||
leftHeadlineBody.setWithModel(model.leftHeadlineBody, delegateObject, additionalData)
|
leftHeadlineBody.set(with: model.leftHeadlineBody, delegateObject, additionalData)
|
||||||
centerHeadLineBody.setWithModel(model.centerHeadlineBody, delegateObject, additionalData)
|
centerHeadLineBody.set(with: model.centerHeadlineBody, delegateObject, additionalData)
|
||||||
rightHeadLineBody.setWithModel(model.rightHeadlineBody, delegateObject, additionalData)
|
rightHeadLineBody.set(with: model.rightHeadlineBody, delegateObject, additionalData)
|
||||||
|
|
||||||
// Create a stack model to use for the internal stack and set the alignment of models
|
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(percent: 33, horizontalAlignment: .leading),
|
|
||||||
StackItemModel(percent: 34, horizontalAlignment: .center),
|
|
||||||
StackItemModel(percent: 33, horizontalAlignment: .trailing)],
|
|
||||||
axis: .horizontal)
|
|
||||||
stack.model = stackModel
|
|
||||||
stack.restack()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
return 121
|
return 121
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -94,14 +94,14 @@ open class DoughnutChart: View {
|
|||||||
doughnutLayer.transform = CATransform3DMakeRotation(1 * .pi, 0.0, 0.0, 1.0)
|
doughnutLayer.transform = CATransform3DMakeRotation(1 * .pi, 0.0, 0.0, 1.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
clearLayers()
|
clearLayers()
|
||||||
guard let doughnutChartModel = doughnutChartModel else {
|
guard let doughnutChartModel = doughnutChartModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
titleLabel.setWithModel(doughnutChartModel.title, delegateObject, additionalData)
|
titleLabel.setOptional(with: doughnutChartModel.title, delegateObject, additionalData)
|
||||||
subTitleLabel.setWithModel(doughnutChartModel.subtitle, delegateObject, additionalData)
|
subTitleLabel.setOptional(with: doughnutChartModel.subtitle, delegateObject, additionalData)
|
||||||
titleLabel.textAlignment = .center
|
titleLabel.textAlignment = .center
|
||||||
subTitleLabel.textAlignment = .center
|
subTitleLabel.textAlignment = .center
|
||||||
updateLabelContainer()
|
updateLabelContainer()
|
||||||
|
|||||||
@ -65,11 +65,11 @@ import Foundation
|
|||||||
colorLablesStack.reset()
|
colorLablesStack.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = doughnutChartModel else { return }
|
guard let model = doughnutChartModel else { return }
|
||||||
doughnutChart.setWithModel(model, delegateObject, additionalData)
|
doughnutChart.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
// Create the stack model
|
// Create the stack model
|
||||||
var stackItems: [MoleculeStackItemModel] = []
|
var stackItems: [MoleculeStackItemModel] = []
|
||||||
@ -78,12 +78,12 @@ import Foundation
|
|||||||
}
|
}
|
||||||
let stack = MoleculeStackModel(molecules: stackItems)
|
let stack = MoleculeStackModel(molecules: stackItems)
|
||||||
stack.verticalAlignment = .fill
|
stack.verticalAlignment = .fill
|
||||||
colorLablesStack.setWithModel(stack, delegateObject, additionalData)
|
colorLablesStack.set(with: stack, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: DoughnutChartModel.self) else { return }
|
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: DoughnutChartModel.self) else { return }
|
||||||
setWithModel(model, delegateObject, additionalData)
|
set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,12 +94,12 @@ extension DoughnutChartView: MVMCoreUIViewConstrainingProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class ColorViewLabelsStack: MoleculeStackView {
|
class ColorViewLabelsStack: MoleculeStackView {
|
||||||
override func createStackItemsFromModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
override func createStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
guard let stackItemModels = stackModel?.molecules else { return }
|
guard let stackItemModels = stackModel?.molecules else { return }
|
||||||
for model in stackItemModels {
|
for model in stackItemModels {
|
||||||
let view = ColorViewWithLabel()
|
let view = ColorViewWithLabel()
|
||||||
let stackItem = MoleculeStackItem(andContain: view)
|
let stackItem = MoleculeStackItem(andContain: view)
|
||||||
stackItem.setWithModel(model, delegateObject, additionalData)
|
stackItem.set(with: model, delegateObject, additionalData)
|
||||||
stackItems.append(stackItem)
|
stackItems.append(stackItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -149,12 +149,12 @@ class ColorViewWithLabel: View {
|
|||||||
label.setAsMolecule()
|
label.setAsMolecule()
|
||||||
}
|
}
|
||||||
|
|
||||||
override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let chartItemModel = model as? DoughnutChartItemModel else {
|
guard let chartItemModel = model as? DoughnutChartItemModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
label.setWithModel(chartItemModel.label, delegateObject, additionalData)
|
label.set(with: chartItemModel.label, delegateObject, additionalData)
|
||||||
colorView.backgroundColor = chartItemModel.color.uiColor
|
colorView.backgroundColor = chartItemModel.color.uiColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,14 +51,14 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 95
|
return 95
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ImageHeadlineBodyModel else { return }
|
guard let model = model as? ImageHeadlineBodyModel else { return }
|
||||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
imageView.setWithModel(model.image, delegateObject, additionalData)
|
imageView.set(with: model.image, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,23 +101,24 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
guard let model = molecule as? TwoButtonViewModel else { return 0 }
|
guard let model = model as? TwoButtonViewModel,
|
||||||
return PillButton.estimatedHeight(forRow: model.primaryButton ?? model.secondaryButton, delegateObject: delegateObject)
|
let buttonModel = model.primaryButton ?? model.secondaryButton else { return 0 }
|
||||||
|
return PillButton.estimatedHeight(with: buttonModel, delegateObject)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? TwoButtonViewModel else { return }
|
guard let model = model as? TwoButtonViewModel else { return }
|
||||||
if let secondaryModel = model.secondaryButton {
|
if let secondaryModel = model.secondaryButton {
|
||||||
showSecondaryButton()
|
showSecondaryButton()
|
||||||
secondaryButton.setWithModel(secondaryModel, delegateObject, additionalData)
|
secondaryButton.set(with: secondaryModel, delegateObject, additionalData)
|
||||||
} else {
|
} else {
|
||||||
hideSecondaryButton()
|
hideSecondaryButton()
|
||||||
}
|
}
|
||||||
if let primaryModel = model.primaryButton {
|
if let primaryModel = model.primaryButton {
|
||||||
showPrimaryButton()
|
showPrimaryButton()
|
||||||
primaryButton.setWithModel(primaryModel, delegateObject, additionalData)
|
primaryButton.set(with: primaryModel, delegateObject, additionalData)
|
||||||
} else {
|
} else {
|
||||||
hidePrimaryButton()
|
hidePrimaryButton()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -44,12 +44,12 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
dropDownListItemModel = model as? DropDownListItemModel
|
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
if let dropDownListItemModel = model as? DropDownListItemModel {
|
||||||
dropDown.setWithModel(dropDownListItemModel?.dropDown, delegateObject, additionalData)
|
dropDown.set(with: dropDownListItemModel.dropDown, delegateObject, additionalData)
|
||||||
|
}
|
||||||
dropDown.observingTextFieldDelegate = delegateObject?.uiTextFieldDelegate as? ObservingTextFieldDelegate
|
dropDown.observingTextFieldDelegate = delegateObject?.uiTextFieldDelegate as? ObservingTextFieldDelegate
|
||||||
dropDown.uiTextFieldDelegate = delegateObject?.uiTextFieldDelegate
|
dropDown.uiTextFieldDelegate = delegateObject?.uiTextFieldDelegate
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ import UIKit
|
|||||||
bottomSeparatorView?.setStyle(.none)
|
bottomSeparatorView?.setStyle(.none)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 80
|
return 80
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -68,7 +68,7 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let collectionModel = model as? CarouselItemModel else {
|
guard let collectionModel = model as? CarouselItemModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -98,7 +98,7 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi
|
|||||||
molecule = moleculeView
|
molecule = moleculeView
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
(molecule as? ModelMoleculeViewProtocol)?.setWithModel(collectionModel.molecule, delegateObject, additionalData)
|
(molecule as? ModelMoleculeViewProtocol)?.set(with: collectionModel.molecule, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let molecule = molecule else { return }
|
guard let molecule = molecule else { return }
|
||||||
@ -114,10 +114,10 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi
|
|||||||
backgroundColor = .white
|
backgroundColor = .white
|
||||||
}
|
}
|
||||||
|
|
||||||
public class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public class func nameForReuse(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
guard let molecule = (model as? CarouselItemModel)?.molecule,
|
guard let molecule = (model as? CarouselItemModel)?.molecule,
|
||||||
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(molecule) as? ModelMoleculeViewProtocol.Type,
|
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(molecule) as? ModelMoleculeViewProtocol.Type,
|
||||||
let name = moleculeClass.nameForReuse(molecule, delegateObject) ?? molecule.moleculeName else {
|
let name = moleculeClass.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return name
|
return name
|
||||||
|
|||||||
@ -13,13 +13,13 @@ import UIKit
|
|||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let model = model as? MoleculeListItemModel else { return }
|
guard let model = model as? MoleculeListItemModel else { return }
|
||||||
|
|
||||||
if molecule != nil {
|
if molecule != nil {
|
||||||
(molecule as? ModelMoleculeViewProtocol)?.setWithModel(model.molecule, delegateObject, additionalData)
|
(molecule as? ModelMoleculeViewProtocol)?.set(with: model.molecule, delegateObject, additionalData)
|
||||||
|
|
||||||
} else if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(model.molecule, delegateObject, false) {
|
} else if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(model.molecule, delegateObject, false) {
|
||||||
addMolecule(moleculeView)
|
addMolecule(moleculeView)
|
||||||
@ -28,11 +28,11 @@ import UIKit
|
|||||||
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
containerHelper.set(with: model, for: molecule as? MVMCoreUIViewConstrainingProtocol)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public override class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
guard let moleculeModel = (model as? MoleculeListItemModel)?.molecule else { return "\(self)<>" }
|
guard let moleculeModel = (model as? MoleculeListItemModel)?.molecule else { return "\(self)<>" }
|
||||||
|
|
||||||
let className = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moleculeModel) as? ModelMoleculeViewProtocol.Type
|
let className = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moleculeModel) as? ModelMoleculeViewProtocol.Type
|
||||||
let moleculeName = className?.nameForReuse(moleculeModel, delegateObject) ?? moleculeModel.moleculeName ?? ""
|
let moleculeName = className?.nameForReuse(with: moleculeModel, delegateObject) ?? moleculeModel.moleculeName ?? ""
|
||||||
|
|
||||||
return "\(self)<\(moleculeName)>"
|
return "\(self)<\(moleculeName)>"
|
||||||
}
|
}
|
||||||
@ -45,10 +45,10 @@ import UIKit
|
|||||||
return theClass.requiredModules?(moleculeJSON, delegateObject: delegateObject, error: error)
|
return theClass.requiredModules?(moleculeJSON, delegateObject: delegateObject, error: error)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
guard let moleculeModel = (molecule as? MoleculeContainerModel)?.molecule,
|
guard let moleculeModel = (model as? MoleculeContainerModel)?.molecule,
|
||||||
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moleculeModel) as? ModelMoleculeViewProtocol.Type,
|
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moleculeModel) as? ModelMoleculeViewProtocol.Type,
|
||||||
let height = classType.estimatedHeight(forRow: moleculeModel, delegateObject: delegateObject)
|
let height = classType.estimatedHeight(with: moleculeModel, delegateObject)
|
||||||
else { return 80 }
|
else { return 80 }
|
||||||
|
|
||||||
return max(2 * PaddingDefaultVerticalSpacing3, height)
|
return max(2 * PaddingDefaultVerticalSpacing3, height)
|
||||||
|
|||||||
@ -36,8 +36,8 @@ import UIKit
|
|||||||
|
|
||||||
// MARK: - MoleculeDelegateProtocol
|
// MARK: - MoleculeDelegateProtocol
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
self.delegateObject = delegateObject
|
self.delegateObject = delegateObject
|
||||||
tabs.reloadData()
|
tabs.reloadData()
|
||||||
}
|
}
|
||||||
@ -47,7 +47,7 @@ import UIKit
|
|||||||
tabs.reset()
|
tabs.reset()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 46
|
return 46
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -114,14 +114,14 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 197
|
return 197
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? ActionDetailWithImageModel else { return }
|
guard let model = model as? ActionDetailWithImageModel else { return }
|
||||||
headlineBodyButton.setWithModel(model.headlineBodyButton, delegateObject, additionalData)
|
headlineBodyButton.set(with: model.headlineBodyButton, delegateObject, additionalData)
|
||||||
imageLoader.setWithModel(model.image, delegateObject, additionalData)
|
imageLoader.set(with: model.image, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -166,19 +166,19 @@ import UIKit
|
|||||||
return 34
|
return 34
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? CornerLabelsModel else { return }
|
guard let model = model as? CornerLabelsModel else { return }
|
||||||
if middleView != nil {
|
if middleView != nil {
|
||||||
(middleView as? ModelMoleculeViewProtocol)?.setWithModel(model, delegateObject, additionalData)
|
(middleView as? ModelMoleculeViewProtocol)?.set(with: model, delegateObject, additionalData)
|
||||||
} else if let moleculeModel = model.molecule, let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(moleculeModel, delegateObject) {
|
} else if let moleculeModel = model.molecule, let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(moleculeModel, delegateObject) {
|
||||||
addMiddleView(molecule)
|
addMiddleView(molecule)
|
||||||
}
|
}
|
||||||
|
|
||||||
topLeftLabel.setWithModel(model.topLeftLabel, delegateObject, additionalData)
|
topLeftLabel.setOptional(with: model.topLeftLabel, delegateObject, additionalData)
|
||||||
topRightLabel.setWithModel(model.topRightLabel, delegateObject, additionalData)
|
topRightLabel.setOptional(with: model.topRightLabel, delegateObject, additionalData)
|
||||||
bottomLeftLabel.setWithModel(model.bottomLeftLabel, delegateObject, additionalData)
|
bottomLeftLabel.setOptional(with: model.bottomLeftLabel, delegateObject, additionalData)
|
||||||
bottomRightLabel.setWithModel(model.bottomRightLabel, delegateObject, additionalData)
|
bottomRightLabel.setOptional(with: model.bottomRightLabel, delegateObject, additionalData)
|
||||||
|
|
||||||
topLabelToMoleculeConstraint?.constant = (middleView != nil && (topLeftLabel.hasText || topRightLabel.hasText)) ? spaceAboveMolecule : 0
|
topLabelToMoleculeConstraint?.constant = (middleView != nil && (topLeftLabel.hasText || topRightLabel.hasText)) ? spaceAboveMolecule : 0
|
||||||
bottomLabelToMoleculeConstraint?.constant = (middleView != nil && (bottomLeftLabel.hasText || bottomRightLabel.hasText)) ? spaceBelowMolecule : 0
|
bottomLabelToMoleculeConstraint?.constant = (middleView != nil && (bottomLeftLabel.hasText || bottomRightLabel.hasText)) ? spaceBelowMolecule : 0
|
||||||
|
|||||||
@ -38,15 +38,16 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? HeadlineBodyLinkToggleModel else { return }
|
guard let model = model as? HeadlineBodyLinkToggleModel else { return }
|
||||||
headlineBodyLink.setWithModel(model.headlineBodyLink, delegateObject, additionalData)
|
headlineBodyLink.set(with: model.headlineBodyLink, delegateObject, additionalData)
|
||||||
toggle.setWithModel(model.toggle, delegateObject, additionalData)
|
toggle.set(with: model.toggle, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return HeadlineBodyLink.estimatedHeight(forRow: (molecule as? HeadlineBodyLinkToggleModel)?.headlineBodyLink, delegateObject: delegateObject)
|
guard let model = model as? HeadlineBodyLinkToggleModel else { return nil }
|
||||||
|
return HeadlineBodyLink.estimatedHeight(with: model.headlineBodyLink, delegateObject)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -35,18 +35,18 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else {
|
guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setWithJSON(headlineBodyToggleModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData)
|
setWithJSON(headlineBodyToggleModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open class override func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
guard let model = molecule as? HeadlineBodyToggleModel,
|
guard let model = model as? HeadlineBodyToggleModel,
|
||||||
let toggleHeight = Toggle.estimatedHeight(forRow: model.toggle, delegateObject: delegateObject),
|
let toggleHeight = Toggle.estimatedHeight(with: model.toggle, delegateObject),
|
||||||
let headlineBody = HeadlineBody.estimatedHeight(forRow: model.headlineBody, delegateObject: delegateObject) else { return nil }
|
let headlineBody = HeadlineBody.estimatedHeight(with: model.headlineBody, delegateObject) else { return nil }
|
||||||
return max(toggleHeight, headlineBody)
|
return max(toggleHeight, headlineBody)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -32,19 +32,19 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
open override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
guard let model = molecule as? LabelToggleModel,
|
guard let model = model as? LabelToggleModel,
|
||||||
let toggleHeight = Toggle.estimatedHeight(forRow: model.toggle, delegateObject: delegateObject),
|
let toggleHeight = Toggle.estimatedHeight(with: model.toggle, delegateObject),
|
||||||
let labelHeight = Label.estimatedHeight(forRow: model.label, delegateObject: delegateObject) else { return nil }
|
let labelHeight = Label.estimatedHeight(with: model.label, delegateObject) else { return nil }
|
||||||
return max(toggleHeight, labelHeight)
|
return max(toggleHeight, labelHeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let labelToggleModel = model as? LabelToggleModel else {
|
guard let labelToggleModel = model as? LabelToggleModel else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
label.setWithModel(labelToggleModel.label, delegateObject, additionalData)
|
label.set(with: labelToggleModel.label, delegateObject, additionalData)
|
||||||
toggle.setWithModel(labelToggleModel.toggle, delegateObject, additionalData)
|
toggle.set(with: labelToggleModel.toggle, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
|
|||||||
@ -9,20 +9,20 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public protocol ModelMoleculeViewProtocol {
|
public protocol ModelMoleculeViewProtocol {
|
||||||
func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?)
|
func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?)
|
||||||
static func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String?
|
static func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String?
|
||||||
static func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat?
|
static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat?
|
||||||
static func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]?
|
static func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]?
|
||||||
}
|
}
|
||||||
|
|
||||||
extension ModelMoleculeViewProtocol {
|
extension ModelMoleculeViewProtocol {
|
||||||
public static func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public static func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
return model?.moleculeName
|
return model.moleculeName
|
||||||
}
|
}
|
||||||
public static func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
public static func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
public static func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
// Temporary
|
// Temporary
|
||||||
@ -31,4 +31,10 @@ extension ModelMoleculeViewProtocol {
|
|||||||
let decoder = JSONDecoder()
|
let decoder = JSONDecoder()
|
||||||
return try decoder.decode(type, from: data)
|
return try decoder.decode(type, from: data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func setOptional<T: MoleculeModelProtocol>(with model: T?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
|
if let model = model {
|
||||||
|
set(with: model, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,8 +19,8 @@ open class ModuleMolecule: Container {
|
|||||||
super.setupView()
|
super.setupView()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let moduleMoleculeModel = model as? ModuleMoleculeModel,
|
guard let moduleMoleculeModel = model as? ModuleMoleculeModel,
|
||||||
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMoleculeModel.moduleName) else {
|
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMoleculeModel.moduleName) else {
|
||||||
@ -42,36 +42,36 @@ open class ModuleMolecule: Container {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
moduleMolecule?.setWithModel(model, delegateObject, additionalData)
|
moduleMolecule?.set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
|
||||||
guard let moduleMolecule = molecule as? ModuleMoleculeModel,
|
guard let moduleMolecule = model as? ModuleMoleculeModel,
|
||||||
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName),
|
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName),
|
||||||
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type,
|
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type,
|
||||||
let height = classType.estimatedHeight(forRow: moduleModel, delegateObject: delegateObject)else {
|
let height = classType.estimatedHeight(with: moduleModel, delegateObject) else {
|
||||||
// Critical error
|
// Critical error
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
return height
|
return height
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public override class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
guard let moduleMolecule = model as? ModuleMoleculeModel,
|
guard let moduleMolecule = model as? ModuleMoleculeModel,
|
||||||
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName),
|
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName),
|
||||||
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type,
|
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type,
|
||||||
let name = classType.nameForReuse(moduleModel, delegateObject) else {
|
let name = classType.nameForReuse(with: moduleModel, delegateObject) else {
|
||||||
// Critical error
|
// Critical error
|
||||||
return "moduleMolecule<>"
|
return "moduleMolecule<>"
|
||||||
}
|
}
|
||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
public override class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
|
|
||||||
guard let moduleName = (molecule as? ModuleMoleculeModel)?.moduleName,
|
guard let moduleName = (model as? ModuleMoleculeModel)?.moduleName,
|
||||||
let _ = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else {
|
let _ = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else {
|
||||||
if let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: CoreUIErrorCode.ErrorCodeModuleMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) {
|
if let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: CoreUIErrorCode.ErrorCodeModuleMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) {
|
||||||
error?.pointee = errorObject
|
error?.pointee = errorObject
|
||||||
|
|||||||
@ -37,11 +37,11 @@ public class MoleculeHeaderView: MoleculeContainer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let headerModel = headerModel else { return }
|
guard let headerModel = headerModel else { return }
|
||||||
if let lineModel = headerModel.line {
|
if let lineModel = headerModel.line {
|
||||||
line.setWithModel(lineModel, delegateObject, additionalData)
|
line.set(with: lineModel, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,10 +29,10 @@ import UIKit
|
|||||||
constraint.isActive = true
|
constraint.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
if let casteModel = model as? ScrollerModel {
|
if let casteModel = model as? ScrollerModel {
|
||||||
if view != nil {
|
if view != nil {
|
||||||
(view as? ModelMoleculeViewProtocol)?.setWithModel(casteModel.molecule, delegateObject, additionalData)
|
(view as? ModelMoleculeViewProtocol)?.set(with: casteModel.molecule, delegateObject, additionalData)
|
||||||
} else {
|
} else {
|
||||||
if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(casteModel.molecule, delegateObject) {
|
if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(casteModel.molecule, delegateObject) {
|
||||||
contentView.addSubview(molecule)
|
contentView.addSubview(molecule)
|
||||||
@ -41,6 +41,6 @@ import UIKit
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
@objcMembers open class EyebrowHeadlineBodyLink: Container {
|
@objcMembers open class EyebrowHeadlineBodyLink: View {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Outlets
|
// MARK: - Outlets
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -29,10 +29,8 @@ import UIKit
|
|||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
stack.stackItems = [StackItem(andContain: eyebrow),
|
stack.setAndCreateModel(with: [eyebrow, headline, body, link])
|
||||||
StackItem(andContain: headline),
|
stack.stackModel?.spacing = 0
|
||||||
StackItem(andContain: body),
|
|
||||||
StackItem(andContain: link)]
|
|
||||||
addSubview(stack)
|
addSubview(stack)
|
||||||
NSLayoutConstraint.constraintPinSubview(toSuperview: stack)
|
NSLayoutConstraint.constraintPinSubview(toSuperview: stack)
|
||||||
}
|
}
|
||||||
@ -49,7 +47,6 @@ import UIKit
|
|||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
stack.reset()
|
stack.reset()
|
||||||
stack.stackModel?.spacing = 0
|
|
||||||
eyebrow.styleB3(true)
|
eyebrow.styleB3(true)
|
||||||
headline.styleB1(true)
|
headline.styleB1(true)
|
||||||
body.styleB2(true)
|
body.styleB2(true)
|
||||||
@ -59,25 +56,23 @@ import UIKit
|
|||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
eyebrow.setWithModel(casteModel?.eyebrow, delegateObject, additionalData)
|
eyebrow.setOptional(with: casteModel?.eyebrow, delegateObject, additionalData)
|
||||||
headline.setWithModel(casteModel?.headline, delegateObject, additionalData)
|
headline.setOptional(with: casteModel?.headline, delegateObject, additionalData)
|
||||||
body.setWithModel(casteModel?.body, delegateObject, additionalData)
|
body.setOptional(with: casteModel?.body, delegateObject, additionalData)
|
||||||
link.setWithModel(casteModel?.link, delegateObject, additionalData)
|
link.setOptional(with: casteModel?.link, delegateObject, additionalData)
|
||||||
|
|
||||||
// Create a stack model to use for the internal stack.
|
// Hide labels if neeeded.
|
||||||
let stackModel = StackModel(molecules: [StackItemModel(gone: !eyebrow.hasText),
|
stack.stackModel?.molecules[0].gone = !eyebrow.hasText
|
||||||
StackItemModel(gone: !headline.hasText),
|
stack.stackModel?.molecules[1].gone = !headline.hasText
|
||||||
StackItemModel(gone: !body.hasText),
|
stack.stackModel?.molecules[2].gone = !body.hasText
|
||||||
StackItemModel(gone: (link.titleLabel?.text?.count ?? 0) == 0)])
|
stack.stackModel?.molecules[3].gone = (link.titleLabel?.text?.count ?? 0) == 0
|
||||||
stackModel.spacing = 0
|
|
||||||
stack.model = stackModel
|
|
||||||
stack.restack()
|
stack.restack()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 65
|
return 65
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -73,17 +73,17 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 320
|
return 320
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? HeadlineBodyCaretLinkImageModel else { return }
|
guard let model = model as? HeadlineBodyCaretLinkImageModel else { return }
|
||||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
caretButton.setWithModel(model.caretLink, delegateObject, additionalData)
|
caretButton.setOptional(with: model.caretLink, delegateObject, additionalData)
|
||||||
caretButton.isHidden = model.caretLink == nil
|
caretButton.isHidden = model.caretLink == nil
|
||||||
backgroundImageView.setWithModel(model.image, delegateObject, additionalData)
|
backgroundImageView.set(with: model.image, delegateObject, additionalData)
|
||||||
backgroundImageView.alignFillHorizontal()
|
backgroundImageView.alignFillHorizontal()
|
||||||
backgroundImageView.alignFillVertical()
|
backgroundImageView.alignFillVertical()
|
||||||
}
|
}
|
||||||
|
|||||||
@ -124,19 +124,19 @@ open class HeadlineBody: View {
|
|||||||
// MARK: - ModelMoleculeViewProtocol
|
// MARK: - ModelMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 58
|
return 58
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let headlineBodyModel = model as? HeadlineBodyModel else { return }
|
guard let headlineBodyModel = model as? HeadlineBodyModel else { return }
|
||||||
|
|
||||||
style(with: headlineBodyModel.style)
|
style(with: headlineBodyModel.style)
|
||||||
|
|
||||||
headlineLabel.setWithModel(headlineBodyModel.headline, delegateObject, additionalData)
|
headlineLabel.setOptional(with: headlineBodyModel.headline, delegateObject, additionalData)
|
||||||
messageLabel.setWithModel(headlineBodyModel.body, delegateObject, additionalData)
|
messageLabel.setOptional(with: headlineBodyModel.body, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -108,15 +108,15 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 320
|
return 320
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? HeadlineBodyButtonModel else { return }
|
guard let model = model as? HeadlineBodyButtonModel else { return }
|
||||||
buttonHeadlinePadding = model.buttonHeadlinePadding
|
buttonHeadlinePadding = model.buttonHeadlinePadding
|
||||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
button.setWithModel(model.button, delegateObject, additionalData)
|
button.set(with: model.button, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -67,14 +67,14 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK:- ModelMoleculeViewProtocol
|
// MARK:- ModelMoleculeViewProtocol
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? HeadlineBodyLinkModel else { return }
|
guard let model = model as? HeadlineBodyLinkModel else { return }
|
||||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
headlineBody.set(with: model.headlineBody, delegateObject, additionalData)
|
||||||
link.setWithModel(model.link, delegateObject, additionalData)
|
link.set(with: model.link, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
return 60
|
return 60
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import UIKit
|
|||||||
|
|
||||||
// This class is only temporarily necessary. Eventually we will have initWithModel instad of just init for moleculeviews, which will remove this need.
|
// This class is only temporarily necessary. Eventually we will have initWithModel instad of just init for moleculeviews, which will remove this need.
|
||||||
open class StringAndMoleculeStack: MoleculeStackView {
|
open class StringAndMoleculeStack: MoleculeStackView {
|
||||||
override func createStackItemsFromModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
override open func createStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
guard let model = stackModel else { return }
|
guard let model = stackModel else { return }
|
||||||
for stackItemModel in model.molecules {
|
for stackItemModel in model.molecules {
|
||||||
guard let stringAndMoleculeModel = stackItemModel.molecule as? StringAndMoleculeModel,
|
guard let stringAndMoleculeModel = stackItemModel.molecule as? StringAndMoleculeModel,
|
||||||
@ -21,7 +21,7 @@ open class StringAndMoleculeStack: MoleculeStackView {
|
|||||||
}
|
}
|
||||||
let view = StringAndMoleculeView(string: stringAndMoleculeModel.string, molecule: molecule)
|
let view = StringAndMoleculeView(string: stringAndMoleculeModel.string, molecule: molecule)
|
||||||
let stackItem = MoleculeStackItem(andContain: view)
|
let stackItem = MoleculeStackItem(andContain: view)
|
||||||
stackItem.setWithModel(stackItemModel, delegateObject, nil)
|
stackItem.set(with: stackItemModel, delegateObject, nil)
|
||||||
stackItems.append(stackItem)
|
stackItems.append(stackItem)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -76,11 +76,11 @@ open class StringAndMoleculeView: View {
|
|||||||
(molecule as? MoleculeViewProtocol)?.reset?()
|
(molecule as? MoleculeViewProtocol)?.reset?()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let model = model as? StringAndMoleculeModel else { return }
|
guard let model = model as? StringAndMoleculeModel else { return }
|
||||||
label.text = model.string
|
label.text = model.string
|
||||||
molecule.setWithModel(model.molecule, delegateObject, additionalData)
|
molecule.set(with: model.molecule, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateLeftViewWidthConstraint(_ percent: CGFloat) {
|
func updateLeftViewWidthConstraint(_ percent: CGFloat) {
|
||||||
|
|||||||
@ -83,8 +83,8 @@ open class Carousel: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
guard let carouselModel = model as? CarouselModel else { return }
|
guard let carouselModel = model as? CarouselModel else { return }
|
||||||
collectionView.backgroundColor = backgroundColor
|
collectionView.backgroundColor = backgroundColor
|
||||||
collectionView.layer.borderColor = backgroundColor?.cgColor
|
collectionView.layer.borderColor = backgroundColor?.cgColor
|
||||||
@ -159,7 +159,7 @@ open class Carousel: View {
|
|||||||
/// Returns the (identifier, class) of the molecule for the given map.
|
/// Returns the (identifier, class) of the molecule for the given map.
|
||||||
func getMoleculeInfo(with molecule: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject?) -> (identifier: String, class: AnyClass, molecule: MoleculeModelProtocol)? {
|
func getMoleculeInfo(with molecule: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject?) -> (identifier: String, class: AnyClass, molecule: MoleculeModelProtocol)? {
|
||||||
guard let className = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(molecule) ,
|
guard let className = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(molecule) ,
|
||||||
let moleculeName = (className as? ModelMoleculeViewProtocol.Type)?.nameForReuse(molecule, delegateObject) ?? molecule.moleculeName else {
|
let moleculeName = (className as? ModelMoleculeViewProtocol.Type)?.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
return (moleculeName, className, molecule)
|
return (moleculeName, className, molecule)
|
||||||
@ -275,7 +275,7 @@ extension Carousel: UICollectionViewDataSource {
|
|||||||
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: moleculeInfo.identifier, for: indexPath)
|
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: moleculeInfo.identifier, for: indexPath)
|
||||||
if let protocolCell = cell as? MVMCoreUIMoleculeViewProtocol & ModelMoleculeViewProtocol {
|
if let protocolCell = cell as? MVMCoreUIMoleculeViewProtocol & ModelMoleculeViewProtocol {
|
||||||
protocolCell.reset?()
|
protocolCell.reset?()
|
||||||
protocolCell.setWithModel(moleculeInfo.molecule, nil, nil)
|
protocolCell.set(with: moleculeInfo.molecule, nil, nil)
|
||||||
protocolCell.updateView(collectionView.bounds.width)
|
protocolCell.updateView(collectionView.bounds.width)
|
||||||
}
|
}
|
||||||
setAccessiblity(cell, index: indexPath.row)
|
setAccessiblity(cell, index: indexPath.row)
|
||||||
|
|||||||
@ -33,7 +33,7 @@ open class MoleculeStackView: Stack<MoleculeStackModel> {
|
|||||||
|
|
||||||
// MARK: - Adding to stack
|
// MARK: - Adding to stack
|
||||||
/// Creates all of the stackItems for the stackItemModels
|
/// Creates all of the stackItems for the stackItemModels
|
||||||
override func createStackItemsFromModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
override open func createStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||||
guard let stackItemModels = stackModel?.molecules else { return }
|
guard let stackItemModels = stackModel?.molecules else { return }
|
||||||
for model in stackItemModels {
|
for model in stackItemModels {
|
||||||
if let stackItem = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(model, delegateObject) as? MoleculeStackItem {
|
if let stackItem = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(model, delegateObject) as? MoleculeStackItem {
|
||||||
|
|||||||
@ -9,7 +9,7 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
open class Stack<T>: Container where T: StackModelProtocol {
|
open class Stack<T>: Container where T: (StackModelProtocol & MoleculeModelProtocol) {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -24,7 +24,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
// MARK: - Helpers
|
// MARK: - Helpers
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public func pinView(_ view: UIView, toView: UIView, attribute: NSLayoutConstraint.Attribute, relation: NSLayoutConstraint.Relation, priority: UILayoutPriority, constant: CGFloat) {
|
open func pinView(_ view: UIView, toView: UIView, attribute: NSLayoutConstraint.Attribute, relation: NSLayoutConstraint.Relation, priority: UILayoutPriority, constant: CGFloat) {
|
||||||
|
|
||||||
let constraint = NSLayoutConstraint(item: view, attribute: attribute, relatedBy: relation, toItem: toView, attribute: attribute, multiplier: 1.0, constant: constant)
|
let constraint = NSLayoutConstraint(item: view, attribute: attribute, relatedBy: relation, toItem: toView, attribute: attribute, multiplier: 1.0, constant: constant)
|
||||||
constraint.priority = priority
|
constraint.priority = priority
|
||||||
@ -32,7 +32,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Restacks the existing items.
|
/// Restacks the existing items.
|
||||||
func restack() {
|
open func restack() {
|
||||||
removeAllItemViews()
|
removeAllItemViews()
|
||||||
guard let stackModel = stackModel else { return }
|
guard let stackModel = stackModel else { return }
|
||||||
let stackItems = self.stackItems
|
let stackItems = self.stackItems
|
||||||
@ -49,7 +49,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Removes all stack items views from the view.
|
/// Removes all stack items views from the view.
|
||||||
func removeAllItemViews() {
|
open func removeAllItemViews() {
|
||||||
for item in stackItems {
|
for item in stackItems {
|
||||||
item.removeFromSuperview()
|
item.removeFromSuperview()
|
||||||
}
|
}
|
||||||
@ -63,20 +63,52 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(withJSON json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
/// The main initializer for model driven
|
||||||
|
public init(with model: T, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
|
super.init(frame: .zero)
|
||||||
|
setOptional(with: model, delegateObject, additionalData)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// The main initializer for hardcode driven
|
||||||
|
public init(with model: T, stackItems: [UIView]) {
|
||||||
super.init(frame: CGRect.zero)
|
super.init(frame: CGRect.zero)
|
||||||
setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
self.model = model
|
||||||
|
self.stackItems = stackItems
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init?(coder aDecoder: NSCoder) {
|
public required init?(coder aDecoder: NSCoder) {
|
||||||
fatalError("init(coder:) has not been implemented")
|
fatalError("init(coder:) has not been implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a Stack created with a StackModel and StackItems containing the passed in views.
|
||||||
|
public static func createStack(with views: [UIView], axis: NSLayoutConstraint.Axis? = nil, spacing: CGFloat? = nil) -> Stack<StackModel> {
|
||||||
|
var items: [StackItem] = []
|
||||||
|
var models: [StackItemModel] = []
|
||||||
|
for view in views {
|
||||||
|
items.append(StackItem(andContain: view))
|
||||||
|
models.append(StackItemModel())
|
||||||
|
}
|
||||||
|
let model = StackModel(molecules: models, axis: axis, spacing: spacing)
|
||||||
|
return Stack<StackModel>(with: model, stackItems: items)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Returns a Stack created with a StackModel containing the passed in views and using the passed in stackitems.
|
||||||
|
public static func createStack(with viewModels:[(view: UIView, model: StackItemModel)], axis: NSLayoutConstraint.Axis? = nil, spacing: CGFloat? = nil) -> Stack<StackModel> {
|
||||||
|
var stackItems: [StackItem] = []
|
||||||
|
var models: [StackItemModel] = []
|
||||||
|
for item in viewModels {
|
||||||
|
stackItems.append(StackItem(andContain: item.view))
|
||||||
|
models.append(item.model)
|
||||||
|
}
|
||||||
|
let model = StackModel(molecules: models, axis: axis, spacing: spacing)
|
||||||
|
return Stack<StackModel>(with: model, stackItems: stackItems)
|
||||||
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - MFViewProtocol
|
// MARK: - MFViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
guard contentView.superview == nil else { return }
|
guard contentView.superview == nil else { return }
|
||||||
MVMCoreUIUtility.setMarginsFor(contentView, leading: 0, top: 0, trailing: 0, bottom: 0)
|
MVMCoreUIUtility.setMarginsFor(contentView, leading: 0, top: 0, trailing: 0, bottom: 0)
|
||||||
@ -88,7 +120,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
contentView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
contentView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
for item in stackItems {
|
for item in stackItems {
|
||||||
(item as? MVMCoreViewProtocol)?.updateView(size)
|
(item as? MVMCoreViewProtocol)?.updateView(size)
|
||||||
@ -99,7 +131,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
for item in stackItems {
|
for item in stackItems {
|
||||||
@ -107,13 +139,13 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
let previousModel = self.model
|
let previousModel = self.model
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.set(with: model, delegateObject, additionalData)
|
||||||
removeAllItemViews()
|
removeAllItemViews()
|
||||||
|
|
||||||
// If the items in the stack are different, clear them, create new ones.
|
// If the items in the stack are different, clear them, create new ones.
|
||||||
if (previousModel == nil) || Self.nameForReuse(previousModel, delegateObject) != Self.nameForReuse(model, delegateObject) {
|
if (previousModel == nil) || Self.nameForReuse(with: previousModel!, delegateObject) != Self.nameForReuse(with: model, delegateObject) {
|
||||||
stackItems = []
|
stackItems = []
|
||||||
createStackItemsFromModel(model, delegateObject, additionalData)
|
createStackItemsFromModel(model, delegateObject, additionalData)
|
||||||
} else {
|
} else {
|
||||||
@ -123,7 +155,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
restack()
|
restack()
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func nameForReuse(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
open override class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
// This will aggregate names of molecules to make an id.
|
// This will aggregate names of molecules to make an id.
|
||||||
guard let model = model as? T else {
|
guard let model = model as? T else {
|
||||||
return "stack<>"
|
return "stack<>"
|
||||||
@ -132,7 +164,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
for case let item in model.molecules {
|
for case let item in model.molecules {
|
||||||
if let moleculeName = item.moleculeName {
|
if let moleculeName = item.moleculeName {
|
||||||
if let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping[moleculeName] as? ModelMoleculeViewProtocol.Type,
|
if let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping[moleculeName] as? ModelMoleculeViewProtocol.Type,
|
||||||
let nameForReuse = moleculeClass.nameForReuse(item, delegateObject) {
|
let nameForReuse = moleculeClass.nameForReuse(with: item, delegateObject) {
|
||||||
name.append(nameForReuse + ",")
|
name.append(nameForReuse + ",")
|
||||||
} else {
|
} else {
|
||||||
name.append(moleculeName + ",")
|
name.append(moleculeName + ",")
|
||||||
@ -144,14 +176,14 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Need to update to take into account first spacing flag
|
// Need to update to take into account first spacing flag
|
||||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
guard let model = molecule as? T else { return 0 }
|
guard let model = model as? T else { return 0 }
|
||||||
let horizontal = model.axis == .horizontal
|
let horizontal = model.axis == .horizontal
|
||||||
var estimatedHeight: CGFloat = 0
|
var estimatedHeight: CGFloat = 0
|
||||||
|
|
||||||
for case let item in model.molecules {
|
for case let item in model.molecules {
|
||||||
if item.gone { continue }
|
if item.gone { continue }
|
||||||
let height = (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(item) as? ModelMoleculeViewProtocol.Type)?.estimatedHeight(forRow: item, delegateObject: delegateObject) ?? 0
|
let height = (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(item) as? ModelMoleculeViewProtocol.Type)?.estimatedHeight(with: item, delegateObject) ?? 0
|
||||||
if !horizontal {
|
if !horizontal {
|
||||||
// Vertical stack aggregates the items
|
// Vertical stack aggregates the items
|
||||||
let spacing = item.spacing ?? model.spacing
|
let spacing = item.spacing ?? model.spacing
|
||||||
@ -164,11 +196,11 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
return estimatedHeight
|
return estimatedHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func requiredModules(_ molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
open override class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
guard let model = molecule as? T else { return nil }
|
guard let model = model as? T else { return nil }
|
||||||
var modules: [String] = []
|
var modules: [String] = []
|
||||||
for case let item in model.molecules {
|
for case let item in model.molecules {
|
||||||
if let modulesForMolecule = (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(item) as? ModelMoleculeViewProtocol.Type)?.requiredModules(item, delegateObject: delegateObject, error: error) {
|
if let modulesForMolecule = (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(item) as? ModelMoleculeViewProtocol.Type)?.requiredModules(with: item, delegateObject, error: error) {
|
||||||
modules += modulesForMolecule
|
modules += modulesForMolecule
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -180,19 +212,43 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
/// Can be subclassed to create views when we get stack item models and have no views yet
|
/// Can be subclassed to create views when we get stack item models and have no views yet
|
||||||
func createStackItemsFromModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { }
|
open func createStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { }
|
||||||
|
|
||||||
/// Can be subclassed to set stack items with model when we already have views
|
/// Can be subclassed to set stack items with model when we already have views
|
||||||
func setStackItemsFromModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open func setStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
guard let models = stackModel?.molecules else { return }
|
guard let models = stackModel?.molecules else { return }
|
||||||
for (index, element) in models.enumerated() {
|
for (index, element) in models.enumerated() {
|
||||||
(stackItems[index] as? ModelMoleculeViewProtocol)?.setWithModel(element, delegateObject, additionalData)
|
(stackItems[index] as? ModelMoleculeViewProtocol)?.set(with: element, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Adding to stack
|
// MARK: - Adding to stack
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
/// Sets the stack with StackItems containing the passed in views and creates a StackModel with StackItems.
|
||||||
|
open func setAndCreateModel(with views: [UIView]) {
|
||||||
|
var stackItems: [StackItem] = []
|
||||||
|
var models: [StackItemModel] = []
|
||||||
|
for view in views {
|
||||||
|
stackItems.append(StackItem(andContain: view))
|
||||||
|
models.append(StackItemModel())
|
||||||
|
}
|
||||||
|
self.stackItems = stackItems
|
||||||
|
model = StackModel(molecules: models)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Sets the stack with StackItems containing the passed in views and sets the StackModel with models.
|
||||||
|
open func set(with viewModels:[(view: UIView, model: T.AnyStackItemModel)]) {
|
||||||
|
guard var stackModel = self.stackModel else { return }
|
||||||
|
var stackItems: [StackItem] = []
|
||||||
|
var models: [T.AnyStackItemModel] = []
|
||||||
|
for item in viewModels {
|
||||||
|
stackItems.append(StackItem(andContain: item.view))
|
||||||
|
models.append(item.model)
|
||||||
|
}
|
||||||
|
stackModel.molecules = models
|
||||||
|
self.stackItems = stackItems
|
||||||
|
}
|
||||||
|
|
||||||
/// Gets the percent modifier. This value is used to help properly calculate percent for stack items when spacing is involved.
|
/// Gets the percent modifier. This value is used to help properly calculate percent for stack items when spacing is involved.
|
||||||
private func getTotalSpace() -> CGFloat {
|
private func getTotalSpace() -> CGFloat {
|
||||||
@ -237,7 +293,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
if first {
|
if first {
|
||||||
pinView(view, toView: contentView, attribute: .top, relation: .equal, priority: .required, constant: stackModel.useStackSpacingBeforeFirstItem ? spacing : model.spacing ?? 0)
|
pinView(view, toView: contentView, attribute: .top, relation: .equal, priority: .required, constant: stackModel.useStackSpacingBeforeFirstItem ? spacing : model.spacing ?? 0)
|
||||||
} else if let previousView = stackItems.last(where: { item in
|
} else if let previousView = stackItems.last(where: { item in
|
||||||
return !model.gone
|
return item.superview != nil
|
||||||
}) {
|
}) {
|
||||||
view.topAnchor.constraint(equalTo: previousView.bottomAnchor, constant: spacing).isActive = true
|
view.topAnchor.constraint(equalTo: previousView.bottomAnchor, constant: spacing).isActive = true
|
||||||
}
|
}
|
||||||
@ -256,7 +312,7 @@ open class Stack<T>: Container where T: StackModelProtocol {
|
|||||||
// First horizontal item has no spacing by default unless told otherwise.
|
// First horizontal item has no spacing by default unless told otherwise.
|
||||||
pinView(view, toView: contentView, attribute: .leading, relation: .equal, priority: .required, constant: stackModel.useStackSpacingBeforeFirstItem ? spacing : model.spacing ?? 0)
|
pinView(view, toView: contentView, attribute: .leading, relation: .equal, priority: .required, constant: stackModel.useStackSpacingBeforeFirstItem ? spacing : model.spacing ?? 0)
|
||||||
} else if let previousView = stackItems.last(where: { item in
|
} else if let previousView = stackItems.last(where: { item in
|
||||||
return !model.gone
|
return item.superview != nil
|
||||||
}) {
|
}) {
|
||||||
view.leftAnchor.constraint(equalTo: previousView.rightAnchor, constant: spacing).isActive = true
|
view.leftAnchor.constraint(equalTo: previousView.rightAnchor, constant: spacing).isActive = true
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,16 +9,23 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objcMembers public class StackModel: StackModelProtocol, MoleculeModelProtocol {
|
@objcMembers public class StackModel: StackModelProtocol, MoleculeModelProtocol {
|
||||||
|
static let defaultSpacing: CGFloat = 16.0
|
||||||
|
|
||||||
public static var identifier: String = "simpleStack"
|
public static var identifier: String = "simpleStack"
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var molecules: [StackItemModel]
|
public var molecules: [StackItemModel]
|
||||||
public var axis: NSLayoutConstraint.Axis = .vertical
|
public var axis: NSLayoutConstraint.Axis = .vertical
|
||||||
public var spacing: CGFloat = 16.0
|
public var spacing: CGFloat = StackModel.defaultSpacing
|
||||||
public var useStackSpacingBeforeFirstItem = false
|
public var useStackSpacingBeforeFirstItem = false
|
||||||
|
|
||||||
public init(molecules: [StackItemModel], axis: NSLayoutConstraint.Axis = .vertical) {
|
public init(molecules: [StackItemModel], axis: NSLayoutConstraint.Axis? = nil, spacing: CGFloat? = nil) {
|
||||||
self.molecules = molecules
|
self.molecules = molecules
|
||||||
self.axis = axis
|
if let axis = axis {
|
||||||
|
self.axis = axis
|
||||||
|
}
|
||||||
|
if let spacing = spacing {
|
||||||
|
self.spacing = spacing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private enum CodingKeys: String, CodingKey {
|
private enum CodingKeys: String, CodingKey {
|
||||||
|
|||||||
@ -10,7 +10,7 @@ import Foundation
|
|||||||
|
|
||||||
public extension MVMCoreUIMoleculeMappingObject {
|
public extension MVMCoreUIMoleculeMappingObject {
|
||||||
|
|
||||||
func register<M: Model, V: MVMCoreUIMoleculeViewProtocol>(viewClass: V.Type, viewModelClass: M.Type) {
|
func register<M: ModelProtocol, V: MVMCoreUIMoleculeViewProtocol>(viewClass: V.Type, viewModelClass: M.Type) {
|
||||||
try? ModelRegistry.register(viewModelClass)
|
try? ModelRegistry.register(viewModelClass)
|
||||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(viewClass, forKey: viewModelClass.identifier as NSString)
|
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(viewClass, forKey: viewModelClass.identifier as NSString)
|
||||||
}
|
}
|
||||||
@ -34,7 +34,7 @@ public extension MVMCoreUIMoleculeMappingObject {
|
|||||||
|
|
||||||
let setData = {() in
|
let setData = {() in
|
||||||
if let molecule = molecule as? ModelMoleculeViewProtocol {
|
if let molecule = molecule as? ModelMoleculeViewProtocol {
|
||||||
molecule.setWithModel(model, delegateObject, nil)
|
molecule.set(with: model, delegateObject, nil)
|
||||||
} else {
|
} else {
|
||||||
molecule.setWithJSON?(model.toJSON(), delegateObject: delegateObject, additionalData: nil)
|
molecule.setWithJSON?(model.toJSON(), delegateObject: delegateObject, additionalData: nil)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,6 +52,7 @@ import Foundation
|
|||||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self)
|
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self)
|
||||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self)
|
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self)
|
||||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self)
|
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self)
|
||||||
|
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self)
|
||||||
|
|
||||||
// Horizontal Combination Molecules
|
// Horizontal Combination Molecules
|
||||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self)
|
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self)
|
||||||
|
|||||||
@ -106,7 +106,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
|
|
||||||
open override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
|
open override func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat {
|
||||||
guard let moleculeInfo = moleculesInfo?[indexPath.row],
|
guard let moleculeInfo = moleculesInfo?[indexPath.row],
|
||||||
let estimatedHeight = (moleculeInfo.class as? ModelMoleculeViewProtocol.Type)?.estimatedHeight(forRow: moleculeInfo.molecule, delegateObject: delegateObject() as? MVMCoreUIDelegateObject)
|
let estimatedHeight = (moleculeInfo.class as? ModelMoleculeViewProtocol.Type)?.estimatedHeight(with: moleculeInfo.molecule, delegateObject() as? MVMCoreUIDelegateObject)
|
||||||
else { return 0 }
|
else { return 0 }
|
||||||
|
|
||||||
return estimatedHeight
|
return estimatedHeight
|
||||||
@ -130,7 +130,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
protocolCell.setLines(with: templateModel?.line, 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 as? ModelMoleculeViewProtocol)?.set(with: moleculeInfo.molecule, delegate, nil)
|
||||||
moleculeCell?.updateView(tableView.bounds.width)
|
moleculeCell?.updateView(tableView.bounds.width)
|
||||||
|
|
||||||
return cell
|
return cell
|
||||||
@ -283,7 +283,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
|
|
||||||
guard let listItem = listItem,
|
guard let listItem = listItem,
|
||||||
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(listItem),
|
let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(listItem),
|
||||||
let moleculeName = (moleculeClass as? ModelMoleculeViewProtocol.Type)?.nameForReuse(listItem, delegateObject() as? MVMCoreUIDelegateObject) ?? listItem.moleculeName
|
let moleculeName = (moleculeClass as? ModelMoleculeViewProtocol.Type)?.nameForReuse(with: listItem, delegateObject() as? MVMCoreUIDelegateObject) ?? listItem.moleculeName
|
||||||
else { return nil }
|
else { return nil }
|
||||||
|
|
||||||
return (moleculeName, moleculeClass, listItem)
|
return (moleculeName, moleculeClass, listItem)
|
||||||
|
|||||||
@ -55,7 +55,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
|
|||||||
let stack = MoleculeStackView(frame: .zero)
|
let stack = MoleculeStackView(frame: .zero)
|
||||||
moleculeStackModel.useStackSpacingBeforeFirstItem = true
|
moleculeStackModel.useStackSpacingBeforeFirstItem = true
|
||||||
moleculeStackModel.useHorizontalMargins = true
|
moleculeStackModel.useHorizontalMargins = true
|
||||||
stack.setWithModel(moleculeStackModel, delegateObject() as? MVMCoreUIDelegateObject, nil)
|
stack.set(with: moleculeStackModel, delegateObject() as? MVMCoreUIDelegateObject, nil)
|
||||||
return stack
|
return stack
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user