From 39fc20ef7933f957e61fe1e9bf889a8de31b7ff7 Mon Sep 17 00:00:00 2001 From: "Pfeil, Scott Robert" Date: Fri, 20 Mar 2020 15:54:55 -0400 Subject: [PATCH] cleanup --- MVMCoreUI.xcodeproj/project.pbxproj | 100 ++++------ .../Atoms/Buttons/ButtonModel.swift | 0 .../Atoms/Buttons/CaretLink.swift | 31 ++- .../Atoms/Buttons/CaretLinkModel.swift | 0 .../Atoms/Buttons/Link/ExternalLink.swift | 2 +- .../Buttons/Link/ExternalLinkModel.swift | 0 .../Atoms/Buttons/Link/Link.swift | 2 +- .../Atoms/Buttons/Link/LinkModel.swift | 0 .../Atoms/Buttons/PillButton.swift | 2 +- .../Atoms/Buttons}/RadioButton.swift | 0 .../Atoms/Buttons}/RadioButtonModel.swift | 0 .../Buttons}/RadioButtonSelectionHelper.swift | 0 .../TextFields/BaseDropdownEntryField.swift | 16 +- .../BaseDropdownEntryFieldModel.swift | 0 .../TextFields/DateDropdownEntryField.swift | 18 +- .../DateDropdownEntryFieldModel.swift | 0 .../Atoms/TextFields/DigitBox.swift | 0 .../Atoms/TextFields/DigitEntryField.swift | 34 +--- .../TextFields/DigitEntryFieldModel.swift | 0 .../Atoms/TextFields/EntryField.swift | 47 +---- .../Atoms/TextFields/EntryFieldModel.swift | 0 .../TextFields/ItemDropdownEntryField.swift | 19 +- .../ItemDropdownEntryFieldModel.swift | 0 .../Atoms/TextFields/MdnEntryField.swift | 4 + .../Atoms/TextFields/MdnEntryFieldModel.swift | 0 .../Atoms/TextFields/TextEntryField.swift | 62 +----- .../TextFields/TextEntryFieldModel.swift | 0 .../{ => Atomic}/Atoms/Views/Arrow.swift | 0 .../{ => Atomic}/Atoms/Views/ArrowModel.swift | 0 .../{ => Atomic}/Atoms/Views/CaretView.swift | 8 +- .../Atoms/Views/CaretViewModel.swift | 0 .../{ => Atomic}/Atoms/Views/Checkbox.swift | 6 +- .../Atoms/Views/CheckboxLabel.swift | 38 ++-- .../Atoms/Views/CheckboxLabelModel.swift | 0 .../Atoms/Views/CheckboxModel.swift | 0 .../Atoms/Views/CircleProgressModel.swift | 0 .../{ => Atomic}/Atoms/Views/DashLine.swift | 6 - .../Atoms/Views/DashLineModel.swift | 0 .../{ => Atomic}/Atoms/Views/GraphView.swift | 5 - .../Views/GraphViewAnimationHandler.swift | 0 .../Atoms/Views/ImageViewModel.swift | 0 .../Atoms/Views/Label/Label.swift | 18 +- .../Label/LabelAttributeActionModel.swift | 0 .../Label/LabelAttributeColorModel.swift | 0 .../Views/Label/LabelAttributeFontModel.swift | 0 .../Label/LabelAttributeImageModel.swift | 0 .../Views/Label/LabelAttributeModel.swift | 0 .../LabelAttributeStrikeThroughModel.swift | 0 .../Label/LabelAttributeUnderlineModel.swift | 0 .../Atoms/Views/Label/LabelModel.swift | 0 .../Atoms/Views/LeftRightLabelModel.swift | 0 .../Atoms/Views/LeftRightLabelView.swift | 22 --- MVMCoreUI/{ => Atomic}/Atoms/Views/Line.swift | 30 +-- .../{ => Atomic}/Atoms/Views/LineModel.swift | 0 .../Atoms/Views/MFLoadImageView.swift | 50 +---- .../Atoms/Views/MFTransparentGIFView.swift | 0 .../Atoms/Views/MultiProgress.swift | 7 +- .../Atoms/Views/MultiProgressModel.swift | 0 .../Atoms/Views/ProgressBar.swift | 14 +- .../Atoms/Views/ProgressBarModel.swift | 0 .../{ => Atomic}/Atoms/Views/Toggle.swift | 52 ++--- .../Atoms/Views/ToggleModel.swift | 28 ++- MVMCoreUI/Atomic/MoleculeObjectMapping.swift | 184 ++++++++++++++++++ .../Headers/HeadersH2NoButtonsBodyText.swift | 0 .../HeadersH2NoButtonsBodyTextModel.swift | 0 ...tLeftVariableCheckboxAllTextAndLinks.swift | 2 +- ...VariableCheckboxAllTextAndLinksModel.swift | 0 .../ListLeftVariableIconWithRightCaret.swift | 0 ...tLeftVariableIconWithRightCaretModel.swift | 0 ...tVariableRadioButtonAndPaymentMethod.swift | 0 ...ableRadioButtonAndPaymentMethodModel.swift | 0 ...neColumnFullWidthTextAllTextAndLinks.swift | 0 ...umnFullWidthTextAllTextAndLinksModel.swift | 0 .../ListOneColumnFullWidthTextBodyText.swift | 0 ...tOneColumnFullWidthTextBodyTextModel.swift | 0 .../List/RightVariable/ListRVWheel.swift | 4 +- .../List/RightVariable/ListRVWheelModel.swift | 0 .../ListRightVariablePayments.swift | 0 .../ListRightVariablePaymentsModel.swift | 0 .../ListRightVariableTotalData.swift | 0 .../ListRightVariableTotalDataModel.swift | 0 .../ListTwoColumnCompareChanges.swift | 0 .../ListTwoColumnCompareChangesModel.swift | 0 .../ListTwoColumnPriceDescription.swift | 0 .../ListTwoColumnPriceDescriptionModel.swift | 0 .../TwoColumn/ListTwoColumnPriceDetails.swift | 2 +- .../ListTwoColumnPriceDetailsModel.swift | 0 .../LockUps/ListProgressBarData.swift | 4 +- .../LockUps/ListProgressBarDataModel.swift | 0 .../ListFourColumnDataUsageDivider.swift | 4 +- .../ListFourColumnDataUsageDividerModel.swift | 0 ...ColumnFullWidthTextDividerSubsection.swift | 0 ...nFullWidthTextDividerSubsectionModel.swift | 0 ...ColumnTextWithWhitespaceDividerShort.swift | 0 ...nTextWithWhitespaceDividerShortModel.swift | 0 ...eColumnTextWithWhitespaceDividerTall.swift | 0 ...mnTextWithWhitespaceDividerTallModel.swift | 0 .../ListThreeColumnPlanDataDivider.swift | 2 +- .../ListThreeColumnPlanDataDividerModel.swift | 0 .../Molecules/Doughnut/DoughnutChart.swift | 5 - .../Doughnut/DoughnutChartModel.swift | 0 .../Doughnut/DoughnutChartView.swift | 9 - .../{ => Atomic}/Molecules/FooterModel.swift | 0 MVMCoreUI/Atomic/Molecules/FooterView.swift | 12 ++ MVMCoreUI/{ => Atomic}/Molecules/Header.swift | 12 +- .../{ => Atomic}/Molecules/HeaderModel.swift | 0 .../ImageHeadlineBody.swift | 4 +- .../ImageHeadlineBodyModel.swift | 0 .../RadioButtonLabel.swift | 0 .../RadioButtonLabelModel.swift | 0 .../TabsModel.swift | 0 .../TwoButtonView.swift | 4 +- .../TwoButtonViewModel.swift | 0 .../Items/AccordionListItemModel.swift | 0 .../AccordionMoleculeTableViewCell.swift | 0 .../Molecules/Items/CarouselItemModel.swift | 0 .../Items/DropDownFilterTableViewCell.swift | 0 .../Items/DropDownListItemModel.swift | 0 .../Molecules/Items/ListItemModel.swift | 0 .../Items/MoleculeCollectionViewCell.swift | 25 +-- .../Items/MoleculeListItemModel.swift | 0 .../Molecules/Items/MoleculeStackItem.swift | 0 .../Items/MoleculeStackItemModel.swift | 0 .../Items/MoleculeTableViewCell.swift | 20 +- .../Molecules/Items/StackItem.swift | 0 .../Molecules/Items/StackItemModel.swift | 0 .../Items/StackItemModelProtocol.swift | 0 .../Molecules/Items/TabsListItemModel.swift | 0 .../Molecules/Items/TabsTableViewCell.swift | 3 +- .../ActionDetailWithImage.swift | 7 +- .../ActionDetailWithImageModel.swift | 0 .../LeftRightViews/CornerLabels.swift | 13 +- .../LeftRightViews/CornerLabelsModel.swift | 0 .../HeadlineBodyLinkToggle.swift | 2 +- .../HeadlineBodyLinkToggleModel.swift | 0 .../ToggleMolecules/HeadlineBodyToggle.swift | 11 +- .../HeadlineBodyToggleModel.swift | 0 .../ToggleMolecules/LabelToggle.swift | 4 +- .../ToggleMolecules/LabelToggleModel.swift | 0 .../Molecules/ModuleMolecule.swift | 10 +- .../Molecules/ModuleMoleculeModel.swift | 0 .../Molecules/MoleculeHeaderModel.swift | 0 .../Molecules/MoleculeHeaderView.swift | 11 +- .../NavigationItemModelProtocol.swift | 0 .../{ => Atomic}/Molecules/Scroller.swift | 4 +- .../Molecules/ScrollerModel.swift | 0 .../EyebrowHeadlineBodyLink.swift | 4 +- .../EyebrowHeadlineBodyLinkModel.swift | 0 .../HeadLineBodyCaretLinkImage.swift | 4 +- .../HeadlineBody.swift | 22 +-- .../HeadlineBodyButton.swift | 12 +- .../HeadlineBodyButtonModel.swift | 63 ++++++ .../HeadlineBodyCaretLinkImageModel.swift | 0 .../HeadlineBodyLink.swift | 4 +- .../HeadlineBodyLinkModel.swift | 0 .../HeadlineBodyModel.swift | 0 .../Lists/NumberedList.swift | 0 .../Lists/NumberedListModel.swift | 0 .../StringAndMoleculeModel.swift | 0 .../StringAndMoleculeStack.swift | 3 +- .../StringAndMoleculeView.swift | 6 +- .../Lists/UnOrderedList.swift | 0 .../Lists/UnOrderedListModel.swift | 0 .../{ => Atomic}/Organisms/Carousel.swift | 19 +- .../Organisms/CarouselModel.swift | 0 .../Organisms/MoleculeStackModel.swift | 0 .../Organisms/MoleculeStackView.swift | 2 +- MVMCoreUI/{ => Atomic}/Organisms/Stack.swift | 12 +- .../{ => Atomic}/Organisms/StackModel.swift | 0 .../Organisms/StackModelProtocol.swift | 0 .../Protocols/MoleculeDelegateProtocol.swift} | 4 +- .../Protocols/MoleculeViewProtocol.swift} | 42 +++- .../Protocols}/TemplateProtocol.swift | 0 .../Templates/ListPageTemplateModel.swift | 31 +-- .../Templates/ModalMoleculeListTemplate.swift | 0 .../ModalMoleculeListTemplate.swift.orig | 30 +++ .../ModalMoleculeStackTemplate.swift | 0 .../Templates/MoleculeListCellProtocol.swift | 0 .../Templates/MoleculeListTemplate.swift | 47 ++--- .../MoleculeStackCenteredTemplate.swift | 0 .../Templates/MoleculeStackTemplate.swift | 16 +- .../StackCenteredPageTemplateModel.swift | 0 .../Templates/StackPageTemplateModel.swift | 0 .../StackPageTemplateModel.swift.orig | 58 ++++++ .../Templates/TemplateModel.swift | 14 +- .../ThreeLayerPageTemplateModel.swift | 0 .../Templates/ThreeLayerTemplate.swift | 6 +- .../Buttons/MFCustomButton+ActionModel.swift | 25 --- ...maryButton+MoleculeProtocolExtension.swift | 38 ---- .../Atoms/TextFields/TextFieldModel.swift | 27 --- .../Atoms/Views/MFView+ModelExtension.swift | 24 --- .../Atoms/Views/MVMCoreUISwitch+Model.swift | 28 --- MVMCoreUI/BaseClasses/Button.swift | 16 +- .../BaseClasses/ButtonModelProtocol.swift | 1 - MVMCoreUI/BaseClasses/Control.swift | 23 +-- MVMCoreUI/BaseClasses/TableViewCell.swift | 10 +- MVMCoreUI/BaseClasses/TextField.swift | 24 +-- MVMCoreUI/BaseClasses/View.swift | 28 +-- .../BaseControllers/ViewController.swift | 15 +- .../Categories/UIStackView+Extension.swift | 4 +- .../Views/Container/Container.swift | 25 +-- .../Views/EntryFieldContainer.swift | 12 +- .../Containers/Views/MoleculeContainer.swift | 29 +-- .../Controllers/MFViewController+Model.swift | 2 +- MVMCoreUI/Legacy/Views/ButtonView.swift | 26 +-- MVMCoreUI/Legacy/Views/LabelView.m | 6 +- .../Views/LabelWithInternalButton.swift | 57 +----- MVMCoreUI/Legacy/Views/MFCustomButton.h | 1 - MVMCoreUI/Legacy/Views/MFDigitTextField.m | 17 +- MVMCoreUI/Legacy/Views/MFTextButton.h | 2 +- MVMCoreUI/Legacy/Views/MFTextButton.m | 23 --- MVMCoreUI/Legacy/Views/MFTextField.h | 2 +- MVMCoreUI/Legacy/Views/MFTextField.m | 15 -- MVMCoreUI/Legacy/Views/MFView.h | 6 +- MVMCoreUI/Legacy/Views/MFView.m | 20 -- MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.h | 2 +- MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.m | 35 +--- .../Views/MVMCoreUIMoleculeViewProtocol.h | 39 ---- MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h | 3 +- MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m | 19 -- MVMCoreUI/Legacy/Views/MVMCoreUISwitch.h | 3 +- MVMCoreUI/Legacy/Views/MVMCoreUISwitch.m | 47 +---- MVMCoreUI/Legacy/Views/PrimaryButton.h | 3 +- MVMCoreUI/Legacy/Views/PrimaryButton.m | 95 ++------- MVMCoreUI/Legacy/Views/PrimaryButtonView.m | 18 -- MVMCoreUI/Legacy/Views/SeparatorView.m | 51 +---- MVMCoreUI/Legacy/Views/ViewConstrainingView.h | 12 -- MVMCoreUI/Legacy/Views/ViewConstrainingView.m | 121 +----------- MVMCoreUI/MVMCoreUI.h | 2 - .../ModelProtocols/PageModelProtocol.swift | 2 - MVMCoreUI/Molecules/FooterView.swift | 18 -- .../Molecules/MoleculeViewProtocol.swift | 37 ---- .../HeadlineBodyButtonModel.swift | 19 -- MVMCoreUI/OtherHandlers/CoreUIObject.swift | 4 +- ...MoleculeMappingObject+ModelExtension.swift | 49 ----- .../MVMCoreUIMoleculeMappingObject.h | 42 ---- .../MVMCoreUIMoleculeMappingObject.m | 101 ---------- .../OtherHandlers/MoleculeObjectMapping.swift | 143 -------------- 238 files changed, 811 insertions(+), 1938 deletions(-) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/ButtonModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/CaretLink.swift (91%) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/CaretLinkModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/Link/ExternalLink.swift (98%) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/Link/ExternalLinkModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/Link/Link.swift (98%) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/Link/LinkModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Buttons/PillButton.swift (99%) rename MVMCoreUI/{Atoms/Views => Atomic/Atoms/Buttons}/RadioButton.swift (100%) rename MVMCoreUI/{Atoms/Views => Atomic/Atoms/Buttons}/RadioButtonModel.swift (100%) rename MVMCoreUI/{Molecules => Atomic/Atoms/Buttons}/RadioButtonSelectionHelper.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/BaseDropdownEntryField.swift (84%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/BaseDropdownEntryFieldModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/DateDropdownEntryField.swift (87%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/DateDropdownEntryFieldModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/DigitBox.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/DigitEntryField.swift (94%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/DigitEntryFieldModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/EntryField.swift (87%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/EntryFieldModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/ItemDropdownEntryField.swift (90%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/ItemDropdownEntryFieldModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/MdnEntryField.swift (97%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/MdnEntryFieldModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/TextEntryField.swift (86%) rename MVMCoreUI/{ => Atomic}/Atoms/TextFields/TextEntryFieldModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Arrow.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/ArrowModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/CaretView.swift (94%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/CaretViewModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Checkbox.swift (99%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/CheckboxLabel.swift (84%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/CheckboxLabelModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/CheckboxModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/CircleProgressModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/DashLine.swift (89%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/DashLineModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/GraphView.swift (95%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/GraphViewAnimationHandler.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/ImageViewModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/Label.swift (98%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelAttributeActionModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelAttributeColorModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelAttributeFontModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelAttributeImageModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelAttributeModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelAttributeUnderlineModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Label/LabelModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/LeftRightLabelModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/LeftRightLabelView.swift (85%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Line.swift (73%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/LineModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/MFLoadImageView.swift (90%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/MFTransparentGIFView.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/MultiProgress.swift (88%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/MultiProgressModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/ProgressBar.swift (76%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/ProgressBarModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/Toggle.swift (89%) rename MVMCoreUI/{ => Atomic}/Atoms/Views/ToggleModel.swift (63%) create mode 100644 MVMCoreUI/Atomic/MoleculeObjectMapping.swift rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyText.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyTextModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift (96%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift (96%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift (100%) rename MVMCoreUI/{Molecules/DesignedComponents/List => Atomic/Molecules/DesignedComponents/SectionDividers}/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift (100%) rename MVMCoreUI/{Molecules/DesignedComponents/List => Atomic/Molecules/DesignedComponents/SectionDividers}/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift (98%) rename MVMCoreUI/{ => Atomic}/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Doughnut/DoughnutChart.swift (98%) rename MVMCoreUI/{ => Atomic}/Molecules/Doughnut/DoughnutChartModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Doughnut/DoughnutChartView.swift (93%) rename MVMCoreUI/{ => Atomic}/Molecules/FooterModel.swift (100%) create mode 100644 MVMCoreUI/Atomic/Molecules/FooterView.swift rename MVMCoreUI/{ => Atomic}/Molecules/Header.swift (86%) rename MVMCoreUI/{ => Atomic}/Molecules/HeaderModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift (96%) rename MVMCoreUI/{ => Atomic}/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift (100%) rename MVMCoreUI/{Molecules => Atomic/Molecules/HorizontalCombinationViews}/RadioButtonLabel.swift (100%) rename MVMCoreUI/{Molecules => Atomic/Molecules/HorizontalCombinationViews}/RadioButtonLabelModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/HorizontalCombinationViews/TabsModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/HorizontalCombinationViews/TwoButtonView.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/AccordionListItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/AccordionMoleculeTableViewCell.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/CarouselItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/DropDownFilterTableViewCell.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/DropDownListItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/ListItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/MoleculeCollectionViewCell.swift (85%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/MoleculeListItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/MoleculeStackItem.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/MoleculeStackItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/MoleculeTableViewCell.swift (58%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/StackItem.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/StackItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/StackItemModelProtocol.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/TabsListItemModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Items/TabsTableViewCell.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ActionDetailWithImage.swift (94%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ActionDetailWithImageModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/CornerLabels.swift (95%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/CornerLabelsModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggle.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggle.swift (86%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift (95%) rename MVMCoreUI/{ => Atomic}/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/ModuleMolecule.swift (84%) rename MVMCoreUI/{ => Atomic}/Molecules/ModuleMoleculeModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/MoleculeHeaderModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/MoleculeHeaderView.swift (71%) rename MVMCoreUI/{ => Atomic}/Molecules/NavigationItemModelProtocol.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/Scroller.swift (85%) rename MVMCoreUI/{ => Atomic}/Molecules/ScrollerModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift (96%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/HeadlineBody.swift (82%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/HeadlineBodyButton.swift (90%) create mode 100644 MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/HeadlineBodyCaretLinkImageModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/HeadlineBodyLink.swift (97%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/Lists/NumberedList.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeStack.swift (84%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift (94%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/Lists/UnOrderedList.swift (100%) rename MVMCoreUI/{ => Atomic}/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Organisms/Carousel.swift (95%) rename MVMCoreUI/{ => Atomic}/Organisms/CarouselModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Organisms/MoleculeStackModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Organisms/MoleculeStackView.swift (89%) rename MVMCoreUI/{ => Atomic}/Organisms/Stack.swift (95%) rename MVMCoreUI/{ => Atomic}/Organisms/StackModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Organisms/StackModelProtocol.swift (100%) rename MVMCoreUI/{OtherHandlers/ModelMoleculeDelegateProtocol.swift => Atomic/Protocols/MoleculeDelegateProtocol.swift} (88%) rename MVMCoreUI/{Molecules/ModelMoleculeViewProtocol.swift => Atomic/Protocols/MoleculeViewProtocol.swift} (55%) rename MVMCoreUI/{Templates => Atomic/Protocols}/TemplateProtocol.swift (100%) rename MVMCoreUI/{ => Atomic}/Templates/ListPageTemplateModel.swift (65%) rename MVMCoreUI/{ => Atomic}/Templates/ModalMoleculeListTemplate.swift (100%) create mode 100644 MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift.orig rename MVMCoreUI/{ => Atomic}/Templates/ModalMoleculeStackTemplate.swift (100%) rename MVMCoreUI/{ => Atomic}/Templates/MoleculeListCellProtocol.swift (100%) rename MVMCoreUI/{ => Atomic}/Templates/MoleculeListTemplate.swift (81%) rename MVMCoreUI/{ => Atomic}/Templates/MoleculeStackCenteredTemplate.swift (100%) rename MVMCoreUI/{ => Atomic}/Templates/MoleculeStackTemplate.swift (70%) rename MVMCoreUI/{ => Atomic}/Templates/StackCenteredPageTemplateModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Templates/StackPageTemplateModel.swift (100%) create mode 100644 MVMCoreUI/Atomic/Templates/StackPageTemplateModel.swift.orig rename MVMCoreUI/{ => Atomic}/Templates/TemplateModel.swift (77%) rename MVMCoreUI/{ => Atomic}/Templates/ThreeLayerPageTemplateModel.swift (100%) rename MVMCoreUI/{ => Atomic}/Templates/ThreeLayerTemplate.swift (76%) delete mode 100644 MVMCoreUI/Atoms/Buttons/MFCustomButton+ActionModel.swift delete mode 100644 MVMCoreUI/Atoms/Buttons/PrimaryButton+MoleculeProtocolExtension.swift delete mode 100644 MVMCoreUI/Atoms/TextFields/TextFieldModel.swift delete mode 100644 MVMCoreUI/Atoms/Views/MFView+ModelExtension.swift delete mode 100644 MVMCoreUI/Atoms/Views/MVMCoreUISwitch+Model.swift rename MVMCoreUI/{Atoms => Legacy}/Views/LabelWithInternalButton.swift (92%) delete mode 100644 MVMCoreUI/Legacy/Views/MVMCoreUIMoleculeViewProtocol.h delete mode 100644 MVMCoreUI/Molecules/FooterView.swift delete mode 100644 MVMCoreUI/Molecules/MoleculeViewProtocol.swift delete mode 100644 MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift delete mode 100644 MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift delete mode 100644 MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.h delete mode 100644 MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m delete mode 100644 MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift diff --git a/MVMCoreUI.xcodeproj/project.pbxproj b/MVMCoreUI.xcodeproj/project.pbxproj index af3081dc..3b3c7871 100644 --- a/MVMCoreUI.xcodeproj/project.pbxproj +++ b/MVMCoreUI.xcodeproj/project.pbxproj @@ -35,11 +35,10 @@ 012A88C2238D7BCA00FE3DA1 /* CarouselItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88C1238D7BCA00FE3DA1 /* CarouselItemModel.swift */; }; 012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88C3238D86E600FE3DA1 /* CarouselItemModelProtocol.swift */; }; 012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88C5238DA34000FE3DA1 /* ModuleMoleculeModel.swift */; }; - 012A88C8238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88C7238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift */; }; + 012A88C8238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88C7238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift */; }; 012A88DB238ED45900FE3DA1 /* CarouselModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88AE238C626E00FE3DA1 /* CarouselModel.swift */; }; 012A88EC238F084D00FE3DA1 /* FooterModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88EB238F084D00FE3DA1 /* FooterModel.swift */; }; 012A88F123985E0100FE3DA1 /* Color.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012A88F023985E0100FE3DA1 /* Color.swift */; }; - 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */; }; 013F801923FB4A8E00AD8013 /* UIContentMode+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 013F801823FB4A8E00AD8013 /* UIContentMode+Extension.swift */; }; 014AA72423C501E2006F3E93 /* MoleculeContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */; }; 014AA72523C501E2006F3E93 /* ContainerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 014AA72223C501E2006F3E93 /* ContainerModel.swift */; }; @@ -54,10 +53,7 @@ 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01509D942327ED1900EF99AA /* HeadlineBodyLinkToggle.swift */; }; 017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */; }; 017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB3B2361EA1D0024EF95 /* MFViewController+Model.swift */; }; - 017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB3F23620A230024EF95 /* TextFieldModel.swift */; }; - 017BEB442362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB432362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift */; }; 017BEB48236230DB0024EF95 /* MoleculeViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */; }; - 017BEB4A236235BA0024EF95 /* ModelMoleculeViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */; }; 017BEB7B236763000024EF95 /* LineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7A236763000024EF95 /* LineModel.swift */; }; 017BEB7F23676E870024EF95 /* MoleculeObjectMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */; }; 0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0198F7A02256A80A0066C936 /* MFRadioButton.h */; settings = {ATTRIBUTES = (Public, ); }; }; @@ -213,15 +209,14 @@ D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */; }; D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; }; D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; }; + D22D8393241C27B100D3DF69 /* TemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8392241C27B100D3DF69 /* TemplateModel.swift */; }; D22D8395241FB41200D3DF69 /* UIStackView+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */; }; D236E5B4241FEB1000C38625 /* ListTwoColumnPriceDescription.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */; }; D236E5B5241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */; }; - D22D8393241C27B100D3DF69 /* TemplateModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D22D8392241C27B100D3DF69 /* TemplateModel.swift */; }; D236E5B7242007C500C38625 /* MVMControllerModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D236E5B6242007C500C38625 /* MVMControllerModelProtocol.swift */; }; D243859923A16B1800332775 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = D243859823A16B1800332775 /* Container.swift */; }; D256E9932412880000360572 /* Header.swift in Sources */ = {isa = PBXBuildFile; fileRef = D256E9922412880000360572 /* Header.swift */; }; D260105323CEA61600764D80 /* ToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105223CEA61600764D80 /* ToggleModel.swift */; }; - D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */; }; D260105923D0A92900764D80 /* ContainerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105823D0A92900764D80 /* ContainerProtocol.swift */; }; D260105B23D0BB7100764D80 /* StackModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105A23D0BB7100764D80 /* StackModelProtocol.swift */; }; D260105D23D0BCD400764D80 /* Stack.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105C23D0BCD400764D80 /* Stack.swift */; }; @@ -242,7 +237,6 @@ D282AAB4223FDDAE00C46919 /* MFLoadImageView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB3223FDDAE00C46919 /* MFLoadImageView.swift */; }; D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */; }; D282AACB2243C61700C46919 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AACA2243C61700C46919 /* ButtonView.swift */; }; - D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */; }; D28A837923C7D5BC00DFE4FC /* PageModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837823C7D5BC00DFE4FC /* PageModelProtocol.swift */; }; D28A837B23C928DA00DFE4FC /* MoleculeListCellProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837A23C928DA00DFE4FC /* MoleculeListCellProtocol.swift */; }; D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837C23CCA86A00DFE4FC /* TabsListItemModel.swift */; }; @@ -252,7 +246,6 @@ D28A838523CCCA8900DFE4FC /* ScrollerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838423CCCA8900DFE4FC /* ScrollerModel.swift */; }; D28A838923CCCFCB00DFE4FC /* LinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838823CCCFCB00DFE4FC /* LinkModel.swift */; }; D28A838B23CCDA6B00DFE4FC /* ButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838A23CCDA6B00DFE4FC /* ButtonModel.swift */; }; - D28A838D23CCDCC200DFE4FC /* PrimaryButton+MoleculeProtocolExtension.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838C23CCDCC200DFE4FC /* PrimaryButton+MoleculeProtocolExtension.swift */; }; D28A838F23CCDEDE00DFE4FC /* TwoButtonViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */; }; D28A839123CD4FD400DFE4FC /* CornerLabelsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */; }; D28A839323CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */; }; @@ -356,9 +349,6 @@ D29E28D823D21AB800ACEA85 /* StringAndMoleculeView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29E28D723D21AB800ACEA85 /* StringAndMoleculeView.swift */; }; D29E28DA23D21AFA00ACEA85 /* StringAndMoleculeModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29E28D923D21AFA00ACEA85 /* StringAndMoleculeModel.swift */; }; D29E28DD23D7404C00ACEA85 /* ContainerHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = D29E28DC23D7404C00ACEA85 /* ContainerHelper.swift */; }; - D2A514582211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.h in Headers */ = {isa = PBXBuildFile; fileRef = D2A514562211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.h */; settings = {ATTRIBUTES = (Public, ); }; }; - D2A514592211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m in Sources */ = {isa = PBXBuildFile; fileRef = D2A514572211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m */; }; - D2A5145D2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D2A5145C2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; }; D2A5145F2211DDC100345BFB /* MoleculeStackView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5145E2211DDC100345BFB /* MoleculeStackView.swift */; }; D2A5146122121FBF00345BFB /* MoleculeStackTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */; }; D2A514632213643100345BFB /* MoleculeStackCenteredTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2A514622213643100345BFB /* MoleculeStackCenteredTemplate.swift */; }; @@ -436,10 +426,9 @@ 012A88C1238D7BCA00FE3DA1 /* CarouselItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemModel.swift; sourceTree = ""; }; 012A88C3238D86E600FE3DA1 /* CarouselItemModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CarouselItemModelProtocol.swift; sourceTree = ""; }; 012A88C5238DA34000FE3DA1 /* ModuleMoleculeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleMoleculeModel.swift; sourceTree = ""; }; - 012A88C7238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMoleculeDelegateProtocol.swift; sourceTree = ""; }; + 012A88C7238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeDelegateProtocol.swift; sourceTree = ""; }; 012A88EB238F084D00FE3DA1 /* FooterModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FooterModel.swift; sourceTree = ""; }; 012A88F023985E0100FE3DA1 /* Color.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Color.swift; sourceTree = ""; }; - 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFView+ModelExtension.swift"; sourceTree = ""; }; 013F801823FB4A8E00AD8013 /* UIContentMode+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIContentMode+Extension.swift"; sourceTree = ""; }; 014AA72123C501E2006F3E93 /* MoleculeContainerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MoleculeContainerModel.swift; sourceTree = ""; }; 014AA72223C501E2006F3E93 /* ContainerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ContainerModel.swift; sourceTree = ""; }; @@ -454,10 +443,7 @@ 01509D942327ED1900EF99AA /* HeadlineBodyLinkToggle.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HeadlineBodyLinkToggle.swift; sourceTree = ""; }; 017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioButtonLabel.swift; sourceTree = ""; }; 017BEB3B2361EA1D0024EF95 /* MFViewController+Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFViewController+Model.swift"; sourceTree = ""; }; - 017BEB3F23620A230024EF95 /* TextFieldModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TextFieldModel.swift; sourceTree = ""; }; - 017BEB432362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUIMoleculeMappingObject+ModelExtension.swift"; sourceTree = ""; }; 017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeViewProtocol.swift; sourceTree = ""; }; - 017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMoleculeViewProtocol.swift; sourceTree = ""; }; 017BEB7A236763000024EF95 /* LineModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineModel.swift; sourceTree = ""; }; 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeObjectMapping.swift; sourceTree = ""; }; 0198F7A02256A80A0066C936 /* MFRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFRadioButton.h; sourceTree = ""; }; @@ -569,8 +555,8 @@ AAA74A182410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadersH2NoButtonsBodyTextModel.swift; sourceTree = ""; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = ""; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = ""; }; - BB6C6ABE242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ListOneColumnTextWithWhitespaceDividerTallModel.swift; path = MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift; sourceTree = SOURCE_ROOT; }; - BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ListOneColumnTextWithWhitespaceDividerTall.swift; path = MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift; sourceTree = SOURCE_ROOT; }; + BB6C6ABE242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTallModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerTallModel.swift; sourceTree = ""; }; + BB6C6ABF242232DF005F7224 /* ListOneColumnTextWithWhitespaceDividerTall.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerTall.swift; sourceTree = ""; }; BB6C6AC62422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShort.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShort.swift; sourceTree = ""; }; BB6C6AC72422528F005F7224 /* ListOneColumnTextWithWhitespaceDividerShortModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListOneColumnTextWithWhitespaceDividerShortModel.swift; sourceTree = ""; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = ""; }; @@ -603,15 +589,14 @@ D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUISwitch.m; sourceTree = ""; }; D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = ""; }; D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = ""; }; + D22D8392241C27B100D3DF69 /* TemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateModel.swift; sourceTree = ""; }; D22D8394241FB41200D3DF69 /* UIStackView+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIStackView+Extension.swift"; sourceTree = ""; }; D236E5B2241FEB1000C38625 /* ListTwoColumnPriceDescription.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescription.swift; sourceTree = ""; }; D236E5B3241FEB1000C38625 /* ListTwoColumnPriceDescriptionModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListTwoColumnPriceDescriptionModel.swift; sourceTree = ""; }; - D22D8392241C27B100D3DF69 /* TemplateModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TemplateModel.swift; sourceTree = ""; }; D236E5B6242007C500C38625 /* MVMControllerModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MVMControllerModelProtocol.swift; sourceTree = ""; }; D243859823A16B1800332775 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = ""; }; D256E9922412880000360572 /* Header.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Header.swift; sourceTree = ""; }; D260105223CEA61600764D80 /* ToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleModel.swift; sourceTree = ""; }; - D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUISwitch+Model.swift"; sourceTree = ""; }; D260105823D0A92900764D80 /* ContainerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerProtocol.swift; sourceTree = ""; }; D260105A23D0BB7100764D80 /* StackModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackModelProtocol.swift; sourceTree = ""; }; D260105C23D0BCD400764D80 /* Stack.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Stack.swift; sourceTree = ""; }; @@ -631,7 +616,6 @@ D282AAB3223FDDAE00C46919 /* MFLoadImageView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFLoadImageView.swift; sourceTree = ""; }; D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFTransparentGIFView.swift; sourceTree = ""; }; D282AACA2243C61700C46919 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = ""; }; - D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFCustomButton+ActionModel.swift"; sourceTree = ""; }; D28A837823C7D5BC00DFE4FC /* PageModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageModelProtocol.swift; sourceTree = ""; }; D28A837A23C928DA00DFE4FC /* MoleculeListCellProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListCellProtocol.swift; sourceTree = ""; }; D28A837C23CCA86A00DFE4FC /* TabsListItemModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TabsListItemModel.swift; sourceTree = ""; }; @@ -641,7 +625,6 @@ D28A838423CCCA8900DFE4FC /* ScrollerModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ScrollerModel.swift; sourceTree = ""; }; D28A838823CCCFCB00DFE4FC /* LinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LinkModel.swift; sourceTree = ""; }; D28A838A23CCDA6B00DFE4FC /* ButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonModel.swift; sourceTree = ""; }; - D28A838C23CCDCC200DFE4FC /* PrimaryButton+MoleculeProtocolExtension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PrimaryButton+MoleculeProtocolExtension.swift"; sourceTree = ""; }; D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TwoButtonViewModel.swift; sourceTree = ""; }; D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CornerLabelsModel.swift; sourceTree = ""; }; D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyCaretLinkImageModel.swift; sourceTree = ""; }; @@ -760,9 +743,6 @@ D29E28D723D21AB800ACEA85 /* StringAndMoleculeView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringAndMoleculeView.swift; sourceTree = ""; }; D29E28D923D21AFA00ACEA85 /* StringAndMoleculeModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringAndMoleculeModel.swift; sourceTree = ""; }; D29E28DC23D7404C00ACEA85 /* ContainerHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerHelper.swift; sourceTree = ""; }; - D2A514562211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIMoleculeMappingObject.h; sourceTree = ""; }; - D2A514572211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIMoleculeMappingObject.m; sourceTree = ""; }; - D2A5145C2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIMoleculeViewProtocol.h; sourceTree = ""; }; D2A5145E2211DDC100345BFB /* MoleculeStackView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeStackView.swift; sourceTree = ""; }; D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeStackTemplate.swift; sourceTree = ""; }; D2A514622213643100345BFB /* MoleculeStackCenteredTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeStackCenteredTemplate.swift; sourceTree = ""; }; @@ -872,7 +852,7 @@ 01C74D87224298E2009C25A3 /* FormUIHelpers */ = { isa = PBXGroup; children = ( - 011D95882404249B000E3791 /* FormProtocol.swift */, + 011D95882404249B000E3791 /* FormHolderModelProtocol.swift */, 011D95AC2406BB57000E3791 /* FormHolderProtocol.swift */, 011D95AA2405C553000E3791 /* FormItemProtocol.swift */, 011D958624042492000E3791 /* FormFieldProtocol.swift */, @@ -1047,6 +1027,7 @@ D213347523842FF5008E41B3 /* Views */ = { isa = PBXGroup; children = ( + DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */, 94FB966023D797DA003D482B /* MFTextButton.h */, 94FB966123D797DA003D482B /* MFTextButton.m */, D29DF17E21E69E2E003B2FB9 /* MFView.h */, @@ -1094,7 +1075,6 @@ D29DF24321E6A176003B2FB9 /* MFDigitTextField.h */, D29DF24821E6A177003B2FB9 /* MFDigitTextField.m */, D29DF24A21E6A177003B2FB9 /* MFDigitTextField.xib */, - D2A5145C2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h */, D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */, D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */, 94F217B423E0BF6100A47C06 /* PrimaryButtonView.h */, @@ -1147,6 +1127,8 @@ D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */, D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */, D28A837E23CCA96400DFE4FC /* TabsModel.swift */, + 011D9625240EBB16000E3791 /* RadioButtonLabelModel.swift */, + 017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */, ); path = HorizontalCombinationViews; sourceTree = ""; @@ -1308,6 +1290,7 @@ D29DF0CE21E404D4003B2FB9 /* MVMCoreUI */ = { isa = PBXGroup; children = ( + D2C78CD324252F4E00B69FDE /* Atomic */, 01509D96232803B200EF99AA /* Models */, 012A88EF23985E0100FE3DA1 /* CustomPrimitives */, D2B18B7D236090D500A9AEDC /* BaseClasses */, @@ -1322,10 +1305,6 @@ D29DF10F21E67A7D003B2FB9 /* BaseControllers */, D29DF11E21E6851E003B2FB9 /* TopAlert */, 94C01508242155FE005811A9 /* Actions */, - D29DF10D21E67A70003B2FB9 /* Atoms */, - D29DF10E21E67A77003B2FB9 /* Molecules */, - D22479902316A9CB003FCCF9 /* Organisms */, - D29DF0DF21E418B2003B2FB9 /* Templates */, D29DF0CF21E404D4003B2FB9 /* MVMCoreUI.h */, D29DF0D021E404D4003B2FB9 /* Info.plist */, ); @@ -1335,7 +1314,6 @@ D29DF0DF21E418B2003B2FB9 /* Templates */ = { isa = PBXGroup; children = ( - 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */, D22D8392241C27B100D3DF69 /* TemplateModel.swift */, 014AA72823C5059B006F3E93 /* StackPageTemplateModel.swift */, D2A5146022121FBF00345BFB /* MoleculeStackTemplate.swift */, @@ -1385,15 +1363,10 @@ D2A514662213885800345BFB /* MoleculeHeaderView.swift */, 012A88EB238F084D00FE3DA1 /* FooterModel.swift */, D274CA322236A78900B01B62 /* FooterView.swift */, - 0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */, 012A88C5238DA34000FE3DA1 /* ModuleMoleculeModel.swift */, D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */, D28A838423CCCA8900DFE4FC /* ScrollerModel.swift */, D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */, - 011D9625240EBB16000E3791 /* RadioButtonLabelModel.swift */, - 017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */, - 017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */, - 017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */, D260105723CF9CC500764D80 /* Doughnut */, D20FB164241A5D75004AFC3A /* NavigationItemModelProtocol.swift */, ); @@ -1508,8 +1481,9 @@ DBC4391A224421A0001AB423 /* CaretLink.swift */, D28A838A23CCDA6B00DFE4FC /* ButtonModel.swift */, D2E2A99E23E07F8A000B42E6 /* PillButton.swift */, - D28A838C23CCDCC200DFE4FC /* PrimaryButton+MoleculeProtocolExtension.swift */, - D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */, + 0116A4E4228B19640094F3ED /* RadioButtonSelectionHelper.swift */, + 011D95AE2407266E000E3791 /* RadioButtonModel.swift */, + 01004F2F22721C3800991ECC /* RadioButton.swift */, ); path = Buttons; sourceTree = ""; @@ -1532,21 +1506,16 @@ D282AAB3223FDDAE00C46919 /* MFLoadImageView.swift */, 017BEB7A236763000024EF95 /* LineModel.swift */, D213347623843825008E41B3 /* Line.swift */, - DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */, 94C2D9822386F3E30006CF46 /* Label */, 31BE15CA23D8924C00452370 /* CheckboxModel.swift */, 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */, 31BE15C923D8924C00452370 /* CheckboxLabelModel.swift */, 0A7BAFA2232BE63400FB8E22 /* CheckboxLabel.swift */, - 011D95AE2407266E000E3791 /* RadioButtonModel.swift */, - 01004F2F22721C3800991ECC /* RadioButton.swift */, D28A838223CCBD3F00DFE4FC /* CircleProgressModel.swift */, 943784F3236B77BB006A1E82 /* GraphView.swift */, 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */, D260105223CEA61600764D80 /* ToggleModel.swift */, 0AA33B392398524F0067DD0F /* Toggle.swift */, - D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */, - 012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */, 0AE98BB623FF18E9004C5109 /* ArrowModel.swift */, 0AE98BB423FF18D2004C5109 /* Arrow.swift */, ); @@ -1571,7 +1540,6 @@ 0ABD136C237CAD1E0081388D /* DateDropdownEntryField.swift */, 0A7EF86423D8AFFF00B2AAD1 /* ItemDropdownEntryFieldModel.swift */, 0ABD1370237DB0450081388D /* ItemDropdownEntryField.swift */, - 017BEB3F23620A230024EF95 /* TextFieldModel.swift */, ); path = TextFields; sourceTree = ""; @@ -1607,11 +1575,6 @@ D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */, D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */, D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */, - 012A88C7238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift */, - D2A514562211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.h */, - D2A514572211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m */, - 017BEB432362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift */, - 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */, ); path = OtherHandlers; sourceTree = ""; @@ -1723,6 +1686,29 @@ path = BaseClasses; sourceTree = ""; }; + D2C78CD324252F4E00B69FDE /* Atomic */ = { + isa = PBXGroup; + children = ( + 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */, + D2C78CD424252F5D00B69FDE /* Protocols */, + D29DF10D21E67A70003B2FB9 /* Atoms */, + D29DF10E21E67A77003B2FB9 /* Molecules */, + D22479902316A9CB003FCCF9 /* Organisms */, + D29DF0DF21E418B2003B2FB9 /* Templates */, + ); + path = Atomic; + sourceTree = ""; + }; + D2C78CD424252F5D00B69FDE /* Protocols */ = { + isa = PBXGroup; + children = ( + 012A88C7238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift */, + 017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */, + 012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */, + ); + path = Protocols; + sourceTree = ""; + }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -1743,7 +1729,6 @@ D29DF29B21E7ADB9003B2FB9 /* StackableViewController.h in Headers */, D29770F421F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.h in Headers */, D29DF15421E69760003B2FB9 /* MVMCoreUIPanelButtonProtocol.h in Headers */, - D2A514582211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.h in Headers */, 9458C3172406C8FD00930963 /* UIFont+FontWrapping.h in Headers */, D29DF0D121E404D4003B2FB9 /* MVMCoreUI.h in Headers */, D29DF29A21E7ADB8003B2FB9 /* MFProgrammaticTableViewController.h in Headers */, @@ -1777,7 +1762,6 @@ 0A21DB88235E06EF00C160A2 /* MFMdnTextField.h in Headers */, D29DF13121E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.h in Headers */, D29DF2C421E7BF57003B2FB9 /* MFTabBarSwipeAnimator.h in Headers */, - D2A5145D2211D22A00345BFB /* MVMCoreUIMoleculeViewProtocol.h in Headers */, D29DF2CA21E7BFC8003B2FB9 /* MFSizeThreshold.h in Headers */, D29DF28021E7AA51003B2FB9 /* MVMCoreUIDetailViewProtocol.h in Headers */, D29DF2BD21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.h in Headers */, @@ -1926,11 +1910,10 @@ D29DF12F21E6851E003B2FB9 /* MVMCoreUITopAlertMainView.m in Sources */, 942C378C2412F4FA0066E45E /* ModalMoleculeListTemplate.swift in Sources */, BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */, - 012A88C8238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift in Sources */, + 012A88C8238DB02000FE3DA1 /* MoleculeDelegateProtocol.swift in Sources */, 0A7EF86123D8AC2500B2AAD1 /* DigitEntryFieldModel.swift in Sources */, DBC4392122491730001AB423 /* LabelWithInternalButton.swift in Sources */, D224798C231450C8003FCCF9 /* HeadlineBodyToggle.swift in Sources */, - 017BEB442362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift in Sources */, 9458C3182406C8FD00930963 /* UIFont+FontWrapping.m in Sources */, 522679C123FE886900906CBA /* ListLeftVariableCheckboxAllTextAndLinks.swift in Sources */, 9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */, @@ -1958,7 +1941,6 @@ 0A21DB91235E0EDB00C160A2 /* DigitBox.swift in Sources */, D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */, D28A838B23CCDA6B00DFE4FC /* ButtonModel.swift in Sources */, - D28A838D23CCDCC200DFE4FC /* PrimaryButton+MoleculeProtocolExtension.swift in Sources */, D2A5145F2211DDC100345BFB /* MoleculeStackView.swift in Sources */, C7F8012323E846C300396FBD /* ListRVWheelModel.swift in Sources */, D29DF27621E79E81003B2FB9 /* MVMCoreUILoggingHandler.m in Sources */, @@ -1976,7 +1958,6 @@ 8D084AD22410BF7600951227 /* ListOneColumnFullWidthTextBodyText.swift in Sources */, 94C0150C2421564A005811A9 /* ActionCollapseNotificationModel.swift in Sources */, 014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */, - 017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */, D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */, D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */, 94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */, @@ -1986,13 +1967,11 @@ 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */, 01EB369223609801006832FA /* MoleculeStackModel.swift in Sources */, - 012CA99E2385A2D3003F810F /* MFView+ModelExtension.swift in Sources */, 011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */, AAA74A192410C05800080241 /* HeadersH2NoButtonsBodyTextModel.swift in Sources */, D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */, 944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */, D213347723843825008E41B3 /* Line.swift in Sources */, - D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */, D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */, 525019DE2406430800EED91C /* ListProgressBarData.swift in Sources */, D28A837F23CCA96400DFE4FC /* TabsModel.swift in Sources */, @@ -2010,7 +1989,6 @@ D2A92886241ACD99004E01C6 /* ProgrammaticTableViewController.swift in Sources */, 01509D952327ED1900EF99AA /* HeadlineBodyLinkToggle.swift in Sources */, 31BE15CB23D8924D00452370 /* CheckboxLabelModel.swift in Sources */, - D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */, D29DF13021E6851E003B2FB9 /* MVMCoreUITopAlertShortView.m in Sources */, 5248BFEC23F12E350059236A /* ListThreeColumnPlanDataDivider.swift in Sources */, 0ABD136D237CAD1E0081388D /* DateDropdownEntryField.swift in Sources */, @@ -2110,7 +2088,6 @@ 0AE14F64238315D2005417F8 /* TextField.swift in Sources */, D29DF17B21E69E1F003B2FB9 /* PrimaryButton.m in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, - 017BEB4A236235BA0024EF95 /* ModelMoleculeViewProtocol.swift in Sources */, C695A68123C9830D00BFB94E /* NumberedListModel.swift in Sources */, 01EB3684236097C0006832FA /* MoleculeModelProtocol.swift in Sources */, D27CD4102339057800C1DC07 /* EyebrowHeadlineBodyLink.swift in Sources */, @@ -2182,7 +2159,6 @@ D29E28DD23D7404C00ACEA85 /* ContainerHelper.swift in Sources */, 012A88C2238D7BCA00FE3DA1 /* CarouselItemModel.swift in Sources */, D29DF29E21E7AE3B003B2FB9 /* MFStyler.m in Sources */, - D2A514592211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m in Sources */, 94C661D923CCF4B400D9FE5B /* LeftRightLabelModel.swift in Sources */, 011D95AB2405C553000E3791 /* FormItemProtocol.swift in Sources */, D21EE53C23AD3AD4003D1A30 /* NSLayoutConstraintAxis+Extension.swift in Sources */, diff --git a/MVMCoreUI/Atoms/Buttons/ButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Buttons/ButtonModel.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/ButtonModel.swift diff --git a/MVMCoreUI/Atoms/Buttons/CaretLink.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift similarity index 91% rename from MVMCoreUI/Atoms/Buttons/CaretLink.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift index 50eb7f83..697f4282 100644 --- a/MVMCoreUI/Atoms/Buttons/CaretLink.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/CaretLink.swift @@ -35,6 +35,27 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol { private var caretSpacingConstraint: NSLayoutConstraint? + //------------------------------------------------------ + // MARK: - Inits + //------------------------------------------------------ + + // Default values for view. + public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(frame: .zero) + backgroundColor = .clear + translatesAutoresizingMaskIntoConstraints = false + setTitleColor(enabledColor, for: .normal) + setTitleColor(disabledColor, for: .disabled) + } + + public override init(frame: CGRect) { + super.init(frame: frame) + } + + public required init?(coder: NSCoder) { + super.init(coder: coder) + } + //------------------------------------------------------ // MARK: - Lifecycle //------------------------------------------------------ @@ -115,16 +136,6 @@ open class CaretLink: Button, MVMCoreUIViewConstrainingProtocol { //------------------------------------------------------ // MARK: - Atomization //------------------------------------------------------ - - // Default values for view. - @objc open func setAsMolecule() { - - backgroundColor = .clear - translatesAutoresizingMaskIntoConstraints = false - setTitleColor(enabledColor, for: .normal) - setTitleColor(disabledColor, for: .disabled) - } - public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let caretLinkModel = model as? CaretLinkModel else { return } if let color = caretLinkModel.backgroundColor { diff --git a/MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/CaretLinkModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Buttons/CaretLinkModel.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/CaretLinkModel.swift diff --git a/MVMCoreUI/Atoms/Buttons/Link/ExternalLink.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/ExternalLink.swift similarity index 98% rename from MVMCoreUI/Atoms/Buttons/Link/ExternalLink.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/Link/ExternalLink.swift index 3cd601b6..9fe48936 100644 --- a/MVMCoreUI/Atoms/Buttons/Link/ExternalLink.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/ExternalLink.swift @@ -17,7 +17,7 @@ open class ExternalLink: Link { public var exportImageView: UIImageView? //-------------------------------------------------- - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //-------------------------------------------------- open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { diff --git a/MVMCoreUI/Atoms/Buttons/Link/ExternalLinkModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/ExternalLinkModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Buttons/Link/ExternalLinkModel.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/Link/ExternalLinkModel.swift diff --git a/MVMCoreUI/Atoms/Buttons/Link/Link.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift similarity index 98% rename from MVMCoreUI/Atoms/Buttons/Link/Link.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift index c64bd13b..d65ce3ce 100644 --- a/MVMCoreUI/Atoms/Buttons/Link/Link.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/Link/Link.swift @@ -44,7 +44,7 @@ import UIKit } //-------------------------------------------------- - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //-------------------------------------------------- public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { diff --git a/MVMCoreUI/Atoms/Buttons/Link/LinkModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/Link/LinkModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Buttons/Link/LinkModel.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/Link/LinkModel.swift diff --git a/MVMCoreUI/Atoms/Buttons/PillButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift similarity index 99% rename from MVMCoreUI/Atoms/Buttons/PillButton.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift index da8cf0c7..3d5bd46b 100644 --- a/MVMCoreUI/Atoms/Buttons/PillButton.swift +++ b/MVMCoreUI/Atomic/Atoms/Buttons/PillButton.swift @@ -118,7 +118,7 @@ open class PillButton: Button, MVMCoreUIViewConstrainingProtocol { return CGSize(width: max(width, getMinimumWidth()), height: getHeight()) } - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { // The button will get styled in the enable check in super. super.set(with: model, delegateObject, additionalData) diff --git a/MVMCoreUI/Atoms/Views/RadioButton.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/RadioButton.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/RadioButton.swift diff --git a/MVMCoreUI/Atoms/Views/RadioButtonModel.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/RadioButtonModel.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonModel.swift diff --git a/MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift b/MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift similarity index 100% rename from MVMCoreUI/Molecules/RadioButtonSelectionHelper.swift rename to MVMCoreUI/Atomic/Atoms/Buttons/RadioButtonSelectionHelper.swift diff --git a/MVMCoreUI/Atoms/TextFields/BaseDropdownEntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryField.swift similarity index 84% rename from MVMCoreUI/Atoms/TextFields/BaseDropdownEntryField.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryField.swift index b7c59fd5..f7083df5 100644 --- a/MVMCoreUI/Atoms/TextFields/BaseDropdownEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryField.swift @@ -52,6 +52,10 @@ import UIKit fatalError("DropdownEntryField does not support xib.") } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(model: model, delegateObject, additionalData) + } + //-------------------------------------------------- // MARK: - Setup //-------------------------------------------------- @@ -77,15 +81,3 @@ import UIKit dropDownCaretView.setOptional(with: model.caretView, delegateObject, additionalData) } } - -// MARK: - MVMCoreUIMoleculeViewProtocol -extension BaseDropdownEntryField { - - @objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let dictionary = json, !dictionary.isEmpty else { return } - - dropDownCaretView.setWithJSON(dictionary, delegateObject: delegateObject, additionalData: additionalData) - } -} diff --git a/MVMCoreUI/Atoms/TextFields/BaseDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/BaseDropdownEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/BaseDropdownEntryFieldModel.swift diff --git a/MVMCoreUI/Atoms/TextFields/DateDropdownEntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryField.swift similarity index 87% rename from MVMCoreUI/Atoms/TextFields/DateDropdownEntryField.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryField.swift index 95174096..a7a483fc 100644 --- a/MVMCoreUI/Atoms/TextFields/DateDropdownEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryField.swift @@ -58,6 +58,10 @@ import UIKit fatalError("DateDropdownEntryField init(coder:) has not been implemented") } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(model: model, delegateObject, additionalData) + } + //-------------------------------------------------- // MARK: - Methods //-------------------------------------------------- @@ -119,17 +123,3 @@ import UIKit dateFormat = model.dateFormat } } - -// MARK: - MVMCoreUIMoleculeViewProtocol -extension DateDropdownEntryField { - - @objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let dictionary = json, !dictionary.isEmpty else { return } - - if let dateFormat = dictionary["dateFormat"] as? String { - self.dateFormat = dateFormat - } - } -} diff --git a/MVMCoreUI/Atoms/TextFields/DateDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/DateDropdownEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/DateDropdownEntryFieldModel.swift diff --git a/MVMCoreUI/Atoms/TextFields/DigitBox.swift b/MVMCoreUI/Atomic/Atoms/TextFields/DigitBox.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/DigitBox.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/DigitBox.swift diff --git a/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryField.swift similarity index 94% rename from MVMCoreUI/Atoms/TextFields/DigitEntryField.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryField.swift index 53181bff..e6ab727e 100644 --- a/MVMCoreUI/Atoms/TextFields/DigitEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryField.swift @@ -193,6 +193,10 @@ import UIKit fatalError("DigitEntryField xib has not been implemented") } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(model: model, delegateObject, additionalData) + } + //-------------------------------------------------- // MARK: - Setup //-------------------------------------------------- @@ -343,6 +347,10 @@ import UIKit super.set(with: model, delegateObject, additionalData) } + + public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return 115 + } } // MARK: - TextField Delegate @@ -440,29 +448,3 @@ extension DigitEntryField { return proprietorTextDelegate?.textFieldShouldEndEditing?(textField) ?? true } } - -// MARK: - MVMCoreUIMoleculeViewProtocol -extension DigitEntryField { - - @objc open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let dictionary = json else { return } - - numberOfDigits = dictionary["digits"] as? Int ?? 4 - - if let _ = dictionary["secureEntry"] as? Bool { - setAsSecureTextEntry(true) - } - - if !dictionary.isEmpty{ - for digitBox in digitBoxes { - MVMCoreUICommonViewsUtility.addDismissToolbar(digitBox.digitField, delegate: delegateObject as? UITextFieldDelegate) - } - } - } - - @objc open override class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 115 - } -} diff --git a/MVMCoreUI/Atoms/TextFields/DigitEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/DigitEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/DigitEntryFieldModel.swift diff --git a/MVMCoreUI/Atoms/TextFields/EntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift similarity index 87% rename from MVMCoreUI/Atoms/TextFields/EntryField.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift index 43a15a3b..a0f0e7dc 100644 --- a/MVMCoreUI/Atoms/TextFields/EntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/EntryField.swift @@ -161,6 +161,11 @@ import UIKit fatalError("EntryField does not support xib.") } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(frame: .zero) + set(with: model, delegateObject, additionalData) + } + //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- @@ -226,6 +231,9 @@ import UIKit entryFieldContainer.updateView(size) } + //-------------------------------------------------- + // MARK: - MoleculeViewProtocol + //-------------------------------------------------- @objc open override func reset() { super.reset() @@ -258,45 +266,8 @@ import UIKit self.isSelected = isSelected } } -} -// MARK: - MVMCoreUIMoleculeViewProtocol -extension EntryField { - - @objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - self.delegateObject = delegateObject - - guard let dictionary = json, !dictionary.isEmpty else { return } - - entryFieldContainer.setWithJSON(dictionary, delegateObject: delegateObject, additionalData: additionalData) - - if let titleText = dictionary[KeyTitle] as? String { - title = titleText - } - - if let disable = dictionary[KeyDisable] as? String, disable.isEqual(StringY) || dictionary.boolForKey(KeyDisable) { - isEnabled = false - } - - if let feedback = dictionary["feedback"] as? String { - self.standardMessage = feedback - } - - if let errMessage = dictionary[KeyErrorMessage] as? String { - errorMessage = errMessage - } - - if let isLocked = dictionary["isLocked"] as? Bool { - self.isLocked = isLocked - } - - if let isSelected = dictionary["isSelected"] as? Bool { - self.isSelected = isSelected - } - } - - @objc open class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 115 } } diff --git a/MVMCoreUI/Atoms/TextFields/EntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/EntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/EntryFieldModel.swift diff --git a/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryField.swift similarity index 90% rename from MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryField.swift index 0ecfc4ad..bd6d793c 100644 --- a/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryField.swift @@ -51,6 +51,10 @@ open class ItemDropdownEntryField: BaseDropdownEntryField { fatalError("ItemDropdownEntryField init(coder:) has not been implemented") } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(model: model, delegateObject, additionalData) + } + //-------------------------------------------------- // MARK: - Methods //-------------------------------------------------- @@ -135,21 +139,6 @@ extension ItemDropdownEntryField: UIPickerViewDelegate, UIPickerViewDataSource { } } -// MARK: - MVMCoreUIMoleculeViewProtocol -extension ItemDropdownEntryField { - - @objc override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let dictionary = json, !dictionary.isEmpty else { return } - - if let options = dictionary["options"] as? [String] { - pickerData = options - setPickerDelegates(delegate: self) - } - } -} - // MARK: - Accessibility extension ItemDropdownEntryField { diff --git a/MVMCoreUI/Atoms/TextFields/ItemDropdownEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/ItemDropdownEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/ItemDropdownEntryFieldModel.swift diff --git a/MVMCoreUI/Atoms/TextFields/MdnEntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryField.swift similarity index 97% rename from MVMCoreUI/Atoms/TextFields/MdnEntryField.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryField.swift index 92a1e073..77b5a4a4 100644 --- a/MVMCoreUI/Atoms/TextFields/MdnEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryField.swift @@ -65,6 +65,10 @@ import MVMCore fatalError("MdnEntryField xib not supported.") } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(model: model, delegateObject, additionalData) + } + //-------------------------------------------------- // MARK: - Setup //-------------------------------------------------- diff --git a/MVMCoreUI/Atoms/TextFields/MdnEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/MdnEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/MdnEntryFieldModel.swift diff --git a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift b/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift similarity index 86% rename from MVMCoreUI/Atoms/TextFields/TextEntryField.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift index 4c56036e..12fe6de0 100644 --- a/MVMCoreUI/Atoms/TextFields/TextEntryField.swift +++ b/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryField.swift @@ -154,6 +154,10 @@ import UIKit fatalError("TextEntryField does not support xib.") } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(model: model, delegateObject, additionalData) + } + //-------------------------------------------------- // MARK: - Lifecycle //-------------------------------------------------- @@ -315,64 +319,6 @@ import UIKit } } -// MARK: - MVMCoreUIMoleculeViewProtocol -extension TextEntryField { - - @objc open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let delegateObject = delegateObject, - let dictionary = json - else { return } - - if let enabledTextColorHex = dictionary["enabledTextColor"] as? String { - textColor.enabled = UIColor.mfGet(forHex: enabledTextColorHex) - } - - if let disabledTextColorHex = dictionary["disabledTextColor"] as? String { - textColor.disabled = UIColor.mfGet(forHex: disabledTextColorHex) - } - - if let text = dictionary[KeyText] as? String { - self.text = text - } - - if let placeholder = dictionary[placeholder] as? String { - self.placeholder = placeholder - } - - switch dictionary.stringForkey(KeyType) { - case "password": - textField.isSecureTextEntry = true - - case "number": - textField.keyboardType = .numberPad - - case "email": - textField.keyboardType = .emailAddress - - default: - break - } - - let regex = dictionary.stringForkey("regex") - - if !regex.isEmpty { - validationBlock = { enteredValue in - guard let value = enteredValue else { return false } - return MVMCoreUIUtility.validate(value, withRegularExpression: regex) - } - } else { - defaultValidationBlock() - } - - - uiTextFieldDelegate = delegateObject.uiTextFieldDelegate - observingTextFieldDelegate = delegateObject.observingTextFieldDelegate - MVMCoreUICommonViewsUtility.addDismissToolbar(textField, delegate: uiTextFieldDelegate) - } -} - // MARK: - Accessibility extension TextEntryField { diff --git a/MVMCoreUI/Atoms/TextFields/TextEntryFieldModel.swift b/MVMCoreUI/Atomic/Atoms/TextFields/TextEntryFieldModel.swift similarity index 100% rename from MVMCoreUI/Atoms/TextFields/TextEntryFieldModel.swift rename to MVMCoreUI/Atomic/Atoms/TextFields/TextEntryFieldModel.swift diff --git a/MVMCoreUI/Atoms/Views/Arrow.swift b/MVMCoreUI/Atomic/Atoms/Views/Arrow.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Arrow.swift rename to MVMCoreUI/Atomic/Atoms/Views/Arrow.swift diff --git a/MVMCoreUI/Atoms/Views/ArrowModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ArrowModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/ArrowModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/ArrowModel.swift diff --git a/MVMCoreUI/Atoms/Views/CaretView.swift b/MVMCoreUI/Atomic/Atoms/Views/CaretView.swift similarity index 94% rename from MVMCoreUI/Atoms/Views/CaretView.swift rename to MVMCoreUI/Atomic/Atoms/Views/CaretView.swift index fff56f82..93874287 100644 --- a/MVMCoreUI/Atoms/Views/CaretView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CaretView.swift @@ -178,16 +178,12 @@ open class CaretView: View { //------------------------------------------------------ // Default values for view. - @objc open override func setAsMolecule() { + public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + super.init(frame: .zero) defaultState() - } - - 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 } set(with: model, delegateObject, additionalData) } - //MARK: - MVMCoreMoleculeViewProtocol override public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let caretModel = model as? CaretViewModel else { diff --git a/MVMCoreUI/Atoms/Views/CaretViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CaretViewModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/CaretViewModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/CaretViewModel.swift diff --git a/MVMCoreUI/Atoms/Views/Checkbox.swift b/MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift similarity index 99% rename from MVMCoreUI/Atoms/Views/Checkbox.swift rename to MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift index f288c4cd..c76383cb 100644 --- a/MVMCoreUI/Atoms/Views/Checkbox.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Checkbox.swift @@ -382,11 +382,7 @@ import MVMCore checkWidth = 2.0 checkAndBypassAnimations(selected: false) } - - open func setAsMolecule() { - setupView() - } - + public override func updateView(_ size: CGFloat) { super.updateView(size) diff --git a/MVMCoreUI/Atoms/Views/CheckboxLabel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift similarity index 84% rename from MVMCoreUI/Atoms/Views/CheckboxLabel.swift rename to MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift index 72429aa2..5d4f68be 100644 --- a/MVMCoreUI/Atoms/Views/CheckboxLabel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabel.swift @@ -65,6 +65,14 @@ alignCheckbox(.center) } + @objc override open func updateView(_ size: CGFloat) { + super.updateView(size) + + label.updateView(size) + checkbox.updateView(size) + layoutIfNeeded() + } + //-------------------------------------------------- // MARK: - Initializers //-------------------------------------------------- @@ -115,6 +123,9 @@ } } + //-------------------------------------------------- + // MARK: - Atomic + //-------------------------------------------------- open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let checkBoxWithLabelModel = model as? CheckboxLabelModel else { return } @@ -125,23 +136,11 @@ checkbox.set(with: checkBoxWithLabelModel.checkbox, delegateObject, additionalData) label.set(with: checkBoxWithLabelModel.label, delegateObject, additionalData) } -} - -// MARK: - Molecular -extension CheckboxLabel { - open class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 200 } - @objc override open func updateView(_ size: CGFloat) { - super.updateView(size) - - label.updateView(size) - checkbox.updateView(size) - layoutIfNeeded() - } - open override func reset() { super.reset() @@ -149,17 +148,4 @@ extension CheckboxLabel { checkbox.reset() alignCheckbox(.center) } - - override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let dictionary = json else { return } - - if let checkboxAlignment = dictionary["checkboxAlignment"] as? String, let position = CheckboxPosition(rawValue: checkboxAlignment) { - alignCheckbox(position) - } - - checkbox.setWithJSON(dictionary.dictionaryForKey("checkbox"), delegateObject: delegateObject, additionalData: additionalData) - label.setWithJSON(dictionary.dictionaryForKey("label"), delegateObject: delegateObject, additionalData: additionalData) - } } diff --git a/MVMCoreUI/Atoms/Views/CheckboxLabelModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/CheckboxLabelModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/CheckboxLabelModel.swift diff --git a/MVMCoreUI/Atoms/Views/CheckboxModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CheckboxModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/CheckboxModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/CheckboxModel.swift diff --git a/MVMCoreUI/Atoms/Views/CircleProgressModel.swift b/MVMCoreUI/Atomic/Atoms/Views/CircleProgressModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/CircleProgressModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/CircleProgressModel.swift diff --git a/MVMCoreUI/Atoms/Views/DashLine.swift b/MVMCoreUI/Atomic/Atoms/Views/DashLine.swift similarity index 89% rename from MVMCoreUI/Atoms/Views/DashLine.swift rename to MVMCoreUI/Atomic/Atoms/Views/DashLine.swift index 63b28dbd..86d2fd61 100644 --- a/MVMCoreUI/Atoms/Views/DashLine.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/DashLine.swift @@ -87,12 +87,6 @@ open class DashLine: View { isHidden = false } - 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 } - set(with: model, delegateObject, additionalData) - } - - //MARK: - MVMCoreMoleculeViewProtocol public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let dashLineModel = dashModel else { diff --git a/MVMCoreUI/Atoms/Views/DashLineModel.swift b/MVMCoreUI/Atomic/Atoms/Views/DashLineModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/DashLineModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/DashLineModel.swift diff --git a/MVMCoreUI/Atoms/Views/GraphView.swift b/MVMCoreUI/Atomic/Atoms/Views/GraphView.swift similarity index 95% rename from MVMCoreUI/Atoms/Views/GraphView.swift rename to MVMCoreUI/Atomic/Atoms/Views/GraphView.swift index 997c58d0..3cf22d79 100644 --- a/MVMCoreUI/Atoms/Views/GraphView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/GraphView.swift @@ -32,11 +32,6 @@ import UIKit createGraphCircle(model) rotationAnimation(model) } - - 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 } - set(with: model, delegateObject, additionalData) - } class func getAngle(_ piValue: Double) -> Double { return piValue / (2.0 * Double.pi) * 360.0 diff --git a/MVMCoreUI/Atoms/Views/GraphViewAnimationHandler.swift b/MVMCoreUI/Atomic/Atoms/Views/GraphViewAnimationHandler.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/GraphViewAnimationHandler.swift rename to MVMCoreUI/Atomic/Atoms/Views/GraphViewAnimationHandler.swift diff --git a/MVMCoreUI/Atoms/Views/ImageViewModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/ImageViewModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/ImageViewModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/Label.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift similarity index 98% rename from MVMCoreUI/Atoms/Views/Label/Label.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift index c7e72204..3cea5dd8 100644 --- a/MVMCoreUI/Atoms/Views/Label/Label.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Label/Label.swift @@ -12,7 +12,7 @@ import MVMCore public typealias ActionBlock = () -> () -@objcMembers open class Label: UILabel, MVMCoreViewProtocol, MVMCoreUIMoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol, MFButtonProtocol, ModelMoleculeViewProtocol { +@objcMembers open class Label: UILabel, MVMCoreViewProtocol, MoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol, MFButtonProtocol { //------------------------------------------------------ // MARK: - Properties @@ -128,6 +128,12 @@ public typealias ActionBlock = () -> () } } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(frame: .zero) + styleB2(true) + set(with: model, delegateObject, additionalData) + } + //------------------------------------------------------ // MARK: - Factory Functions //------------------------------------------------------ @@ -870,16 +876,6 @@ extension Label { accessibilityTraits = .staticText } - @objc public func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - clauses = [] - Label.setUILabel(self, withJSON: json, delegate: delegateObject, additionalData: additionalData) - hero = json?["hero"] as? Int - } - - public func setAsMolecule() { - styleB2(true) - } - public func needsToBeConstrained() -> Bool { return true } diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeActionModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelAttributeActionModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeActionModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeColorModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeColorModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelAttributeColorModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeColorModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeFontModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeFontModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelAttributeFontModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeFontModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeImageModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeImageModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelAttributeImageModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeImageModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelAttributeModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeStrikeThroughModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/LabelAttributeUnderlineModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeUnderlineModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelAttributeUnderlineModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelAttributeUnderlineModel.swift diff --git a/MVMCoreUI/Atoms/Views/Label/LabelModel.swift b/MVMCoreUI/Atomic/Atoms/Views/Label/LabelModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/Label/LabelModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/Label/LabelModel.swift diff --git a/MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/LeftRightLabelModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelModel.swift diff --git a/MVMCoreUI/Atoms/Views/LeftRightLabelView.swift b/MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelView.swift similarity index 85% rename from MVMCoreUI/Atoms/Views/LeftRightLabelView.swift rename to MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelView.swift index d8cebb51..a7c59cd3 100644 --- a/MVMCoreUI/Atoms/Views/LeftRightLabelView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/LeftRightLabelView.swift @@ -40,11 +40,6 @@ import Foundation super.init(coder: aDecoder) } - public convenience init(json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) { - self.init() - setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } - override open func setupView() { super.setupView() @@ -162,23 +157,6 @@ import Foundation // MARK: - Atomization //------------------------------------------------------ - open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: DelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) - - guard let dictionary = json else { return } - - leftTextLabel.setWithJSON(dictionary.optionalDictionaryForKey("leftText"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) - rightTextLabel.setWithJSON(dictionary.optionalDictionaryForKey("rightText"), delegateObject: delegateObject as? MVMCoreUIDelegateObject, additionalData: additionalData) - - if !leftTextLabel.hasText { - constrainRightLabel() - } else if !rightTextLabel.hasText { - constrainLeftLabel() - } - } - - //MARK: - MVMCoreMoleculeViewProtocol - open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let leftRightLabelModel = model as? LeftRightLabelModel else { diff --git a/MVMCoreUI/Atoms/Views/Line.swift b/MVMCoreUI/Atomic/Atoms/Views/Line.swift similarity index 73% rename from MVMCoreUI/Atoms/Views/Line.swift rename to MVMCoreUI/Atomic/Atoms/Views/Line.swift index 37bf5688..0429c1c6 100644 --- a/MVMCoreUI/Atoms/Views/Line.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Line.swift @@ -54,22 +54,10 @@ import UIKit setStyle(.standard) } - // MARK: - MVMCoreUIMoleculeViewProtocol - open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { - - // If no type, default to standard. - if let typeString = json?.optionalStringForKey(KeyType), let type = LineModel.Style.init(rawValue: typeString) { - setStyle(type) - } else { - setStyle(.standard) - } - - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } - + // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { if let lineModel = model as? LineModel { - setStyle(lineModel.type ?? .standard) + setStyle(lineModel.type) } super.set(with: model, delegateObject, additionalData) } @@ -78,13 +66,9 @@ import UIKit setStyle(.standard) } - open func copyBackgroundColor() -> Bool { - return false - } - - public static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - guard let type = json?.optionalStringForKey(KeyType), let style = LineModel.Style(rawValue: type) else { return 1 } - switch style { + public override static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + guard let type = (model as? LineModel)?.type else { return 1 } + switch type { case .none: return 0 case .medium: @@ -101,4 +85,8 @@ extension Line: MVMCoreUIViewConstrainingProtocol { open func needsToBeConstrained() -> Bool { return true } + + open func copyBackgroundColor() -> Bool { + return false + } } diff --git a/MVMCoreUI/Atoms/Views/LineModel.swift b/MVMCoreUI/Atomic/Atoms/Views/LineModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/LineModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/LineModel.swift diff --git a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift b/MVMCoreUI/Atomic/Atoms/Views/MFLoadImageView.swift similarity index 90% rename from MVMCoreUI/Atoms/Views/MFLoadImageView.swift rename to MVMCoreUI/Atomic/Atoms/Views/MFLoadImageView.swift index d8415d2d..b8b5321d 100644 --- a/MVMCoreUI/Atoms/Views/MFLoadImageView.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MFLoadImageView.swift @@ -8,7 +8,8 @@ import UIKit -@objcMembers open class MFLoadImageView: ViewConstrainingView, ModelMoleculeViewProtocol { +// TODO: Change to container instead of ViewConstraining without breaking legacy stack. +@objcMembers open class MFLoadImageView: ViewConstrainingView, MoleculeViewProtocol { public let loadingSpinner = MFLoadingSpinner(frame: .zero) public let imageView = MFTransparentGIFView(frame: .zero) public var addSizeConstraintsForAspectRatio = false @@ -46,6 +47,13 @@ import UIKit super.init(coder: aDecoder) } + required public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + super.init(frame: .zero) + addSizeConstraintsForAspectRatio = true + pinEdges(.all) + set(with: model, delegateObject, additionalData) + } + public func pinEdges(_ edge: UIRectEdge) { edges = edge if edge == UIRectEdge.all { @@ -211,11 +219,7 @@ import UIKit public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.delegateObject = delegateObject - // TODO: Temporary, should be moved to init once we have type erasure ready. - setAsMolecule() - guard let imageModel = model as? ImageViewModel else { - return - } + guard let imageModel = model as? ImageViewModel else { return } if let accessibilityString = imageModel.accessibilityText { imageView.accessibilityLabel = accessibilityString imageView.accessibilityTraits = .staticText @@ -241,40 +245,6 @@ import UIKit } } - // MARK: - MVMCoreUIMoleculeViewProtocol functions - open override func setAsMolecule() { - addSizeConstraintsForAspectRatio = true - pinEdges(.all) - } - - public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return json?.optionalCGFloatForKey("height") ?? 0 - } - - open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - self.delegateObject = delegateObject - if let accessibilityString = json?.optionalStringForKey("accessibilityText") { - imageView.accessibilityLabel = accessibilityString - imageView.accessibilityTraits = .staticText - imageView.isAccessibilityElement = true - } - let width = json?.optionalCGFloatForKey("width") ?? imageWidth - let height = json?.optionalCGFloatForKey("height") ?? imageHeight - // For smoother transitions, set constraints that we know immediately. - if let width = width, addSizeConstraintsForAspectRatio { - setWidth(width) - } - if let height = height, addSizeConstraintsForAspectRatio { - setHeight(height) - } - if let imageName = json?.optionalStringForKey("image"), shouldLoadImage(withName: imageName, width: width, height: height) { - imageView.image = nil - imageView.animatedImage = nil - loadImage(withName: imageName, format: json?.optionalStringForKey("imageFormat"), width: width as NSNumber?, height: height as NSNumber?, customFallbackImage: json?.optionalStringForKey("fallbackImage")) - } - } - // MARK: - load functions public func loadImage(withName imageName: String?, format: String? = nil, width: NSNumber? = nil, height: NSNumber? = nil, customFallbackImage: String? = nil, allowServerParameters: Bool = false, localBundle: Bundle? = nil, completionHandler: MVMCoreGetImageBlock? = nil) { diff --git a/MVMCoreUI/Atoms/Views/MFTransparentGIFView.swift b/MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/MFTransparentGIFView.swift rename to MVMCoreUI/Atomic/Atoms/Views/MFTransparentGIFView.swift diff --git a/MVMCoreUI/Atoms/Views/MultiProgress.swift b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift similarity index 88% rename from MVMCoreUI/Atoms/Views/MultiProgress.swift rename to MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift index 02be560c..72f84f5e 100644 --- a/MVMCoreUI/Atoms/Views/MultiProgress.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/MultiProgress.swift @@ -63,7 +63,7 @@ import UIKit } } - //MARK: - MVMCoreMoleculeViewProtocol + //MARK: - MoleculeViewProtocol public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let multiProgressModel = multiProgressModel else { @@ -81,8 +81,7 @@ import UIKit progressList = nil } - 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 } - set(with: model, delegateObject, additionalData) + public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { + return (model as? MultiProgressBarModel)?.thickness ?? 8 } } diff --git a/MVMCoreUI/Atoms/Views/MultiProgressModel.swift b/MVMCoreUI/Atomic/Atoms/Views/MultiProgressModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/MultiProgressModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/MultiProgressModel.swift diff --git a/MVMCoreUI/Atoms/Views/ProgressBar.swift b/MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift similarity index 76% rename from MVMCoreUI/Atoms/Views/ProgressBar.swift rename to MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift index 3f302135..1b9f1e74 100644 --- a/MVMCoreUI/Atoms/Views/ProgressBar.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ProgressBar.swift @@ -8,7 +8,7 @@ import Foundation -@objcMembers open class ProgressBar: UIProgressView, MVMCoreViewProtocol, ModelMoleculeViewProtocol, MVMCoreUIMoleculeViewProtocol { +@objcMembers open class ProgressBar: UIProgressView, MVMCoreViewProtocol, MoleculeViewProtocol { var progressBarModel: ProgressBarModel? var thickness: CGFloat = 8.0 { @@ -32,7 +32,7 @@ import Foundation setupView() } - init() { + public init() { super.init(frame: .zero) setupView() } @@ -50,7 +50,7 @@ import Foundation public func updateView(_ size: CGFloat) { } - //MARK: - MVMCoreMoleculeViewProtocol + //MARK: - MoleculeViewProtocol public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let progressBarModel = model as? ProgressBarModel else { return @@ -63,12 +63,6 @@ import Foundation } } - // MARK: - MVMCoreUIMoleculeViewProtocol - 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 } - set(with: model, delegateObject, additionalData) - } - public func reset() { thickness = 8 progress = 0 @@ -76,7 +70,7 @@ import Foundation trackTintColor = UIColor.mfLightSilver() } - public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { + public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 8 } } diff --git a/MVMCoreUI/Atoms/Views/ProgressBarModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift similarity index 100% rename from MVMCoreUI/Atoms/Views/ProgressBarModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/ProgressBarModel.swift diff --git a/MVMCoreUI/Atoms/Views/Toggle.swift b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift similarity index 89% rename from MVMCoreUI/Atoms/Views/Toggle.swift rename to MVMCoreUI/Atomic/Atoms/Views/Toggle.swift index 7e45c567..3d9a2f21 100644 --- a/MVMCoreUI/Atoms/Views/Toggle.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/Toggle.swift @@ -334,7 +334,7 @@ public typealias ActionBlockConfirmation = () -> (Bool) } } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let toggleModel = model as? ToggleModel else { return @@ -342,49 +342,32 @@ public typealias ActionBlockConfirmation = () -> (Bool) self.model = model self.delegateObject = delegateObject - let toggleModelJSON = toggleModel.toJSON() FormValidator.setupValidation(molecule: toggleModel, delegate: delegateObject?.formHolderDelegate) - setWithJSON(toggleModelJSON, delegateObject: delegateObject, additionalData: additionalData) - } - - //TODO: change to setWith Model - public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - guard let dictionary = json else { return } - - if let color = dictionary["onTintColor"] as? String { - containerTintColor?.on = UIColor.mfGet(forHex: color) + guard let model = model as? ToggleModel else { return } + if let color = model.onTintColor?.uiColor { + containerTintColor?.on = color } - if let color = dictionary["offTintColor"] as? String { - containerTintColor?.off = UIColor.mfGet(forHex: color) + if let color = model.offTintColor?.uiColor { + containerTintColor?.off = color } - if let color = dictionary["onKnobTintColor"] as? String { - knobTintColor?.on = UIColor.mfGet(forHex: color) + if let color = model.onKnobTintColor?.uiColor { + knobTintColor?.on = color } - if let color = dictionary["offKnobTintColor"] as? String { - knobTintColor?.off = UIColor.mfGet(forHex: color) + if let color = model.offKnobTintColor?.uiColor { + knobTintColor?.off = color } - if let state = dictionary["state"] as? Bool { - changeStateNoAnimation(state) - } + changeStateNoAnimation(model.state) + isAnimated = model.animated + isEnabled = model.enabled - if let actionMap = dictionary.optionalDictionaryForKey("action") { + if let actionMap = model.action?.toJSON() { didToggleAction = { MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) } } - - if let isAnimated = dictionary["isAnimated"] as? Bool { - self.isAnimated = isAnimated - } - - if let isEnabled = dictionary["isEnabled"] as? Bool{ - self.isEnabled = isEnabled - } } public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { @@ -392,13 +375,8 @@ public typealias ActionBlockConfirmation = () -> (Bool) } } -// MARK: - MVMCoreUIMoleculeViewProtocol +// MARK: - MVMCoreUIViewConstrainingProtocol extension Toggle { - - - public class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return Self.getContainerHeight() - } public func needsToBeConstrained() -> Bool { return true diff --git a/MVMCoreUI/Atoms/Views/ToggleModel.swift b/MVMCoreUI/Atomic/Atoms/Views/ToggleModel.swift similarity index 63% rename from MVMCoreUI/Atoms/Views/ToggleModel.swift rename to MVMCoreUI/Atomic/Atoms/Views/ToggleModel.swift index 5e67be8a..334ba00f 100644 --- a/MVMCoreUI/Atoms/Views/ToggleModel.swift +++ b/MVMCoreUI/Atomic/Atoms/Views/ToggleModel.swift @@ -8,25 +8,37 @@ import UIKit -public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol { +public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol, EnableableModelProtocol { public static var identifier: String = "toggle" public var backgroundColor: Color? public var state: Bool = true + public var animated: Bool = true + public var enabled: Bool = true public var action: ActionModelProtocol? public var alternateAction: ActionModelProtocol? public var fieldKey: String? public var groupName: String? = FormValidator.defaultGroupName public var baseValue: AnyHashable? + public var onTintColor: Color? + public var offTintColor: Color? + public var onKnobTintColor: Color? + public var offKnobTintColor: Color? private enum CodingKeys: String, CodingKey { case moleculeName case state + case animated + case enabled case action case backgroundColor case fieldKey case alternateAction case groupName + case onTintColor + case offTintColor + case onKnobTintColor + case offKnobTintColor } public func formFieldValue() -> AnyHashable? { @@ -42,6 +54,12 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol { if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) { self.state = state } + if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) { + self.enabled = enabled + } + if let animated = try typeContainer.decodeIfPresent(Bool.self, forKey: .animated) { + self.animated = animated + } action = try typeContainer.decodeModelIfPresent(codingKey: .action) alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) @@ -49,6 +67,10 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol { if let groupName = try typeContainer.decodeIfPresent(String.self, forKey: .groupName) { self.groupName = groupName } + onTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .onTintColor) + offTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .offTintColor) + onKnobTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .onKnobTintColor) + offKnobTintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .offKnobTintColor) } public func encode(to encoder: Encoder) throws { @@ -60,5 +82,9 @@ public class ToggleModel: MoleculeModelProtocol, FormFieldProtocol { try container.encode(state, forKey: .state) try container.encodeIfPresent(fieldKey, forKey: .fieldKey) try container.encodeIfPresent(groupName, forKey: .groupName) + try container.encodeIfPresent(onTintColor, forKey: .onTintColor) + try container.encodeIfPresent(onKnobTintColor, forKey: .onKnobTintColor) + try container.encodeIfPresent(onKnobTintColor, forKey: .onKnobTintColor) + try container.encodeIfPresent(offKnobTintColor, forKey: .offKnobTintColor) } } diff --git a/MVMCoreUI/Atomic/MoleculeObjectMapping.swift b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift new file mode 100644 index 00000000..e6806e0c --- /dev/null +++ b/MVMCoreUI/Atomic/MoleculeObjectMapping.swift @@ -0,0 +1,184 @@ +// +// MoleculeObjectMapping.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 10/28/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import Foundation + +@objcMembers public class MoleculeObjectMapping: NSObject { + + public var moleculeMapping: [String: MoleculeViewProtocol.Type] = [:] + + /// Returns the mapping object stored in the singleton + public static func shared() -> Self? { + return MVMCoreActionUtility.initializerClassCheck(CoreUIObject.sharedInstance()?.moleculeMap, classToVerify: self) as? Self + } + + /// Registers the model with the model registry and the view with the mapper. + func register(viewClass: V.Type, viewModelClass: M.Type) { + try? ModelRegistry.register(viewModelClass) + moleculeMapping.updateValue(viewClass, forKey: viewModelClass.identifier) + } + + /// Returns the type of molecule view for the given model + func getMoleculeClass(_ model: MoleculeModelProtocol) -> MoleculeViewProtocol.Type? { + return moleculeMapping[model.moleculeName] + } + + /// Creates a molecule with the given model. + func createMolecule(_ model: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject? = nil, additionalData: [AnyHashable: Any]? = nil) -> MoleculeViewProtocol? { + guard let type = moleculeMapping[model.moleculeName] else { return nil } + return type.init(model: model, delegateObject, additionalData) + } + + /// Call to register all of the CoreUI molecules. + public static func registerObjects() { + // Stacks + MoleculeObjectMapping.shared()?.register(viewClass: MoleculeStackView.self, viewModelClass: MoleculeStackModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Stack.self, viewModelClass: StackModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: UnOrderedList.self, viewModelClass: UnOrderedListModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: NumberedList.self, viewModelClass: NumberedListModel.self) + + // Label + MoleculeObjectMapping.shared()?.register(viewClass: Label.self, viewModelClass: LabelModel.self) + // need to move labelattributemodel to different method + try? ModelRegistry.register(LabelAttributeFontModel.self) + try? ModelRegistry.register(LabelAttributeColorModel.self) + try? ModelRegistry.register(LabelAttributeImageModel.self) // We need to separate the registry by types due to collisions... + try? ModelRegistry.register(LabelAttributeUnderlineModel.self) + try? ModelRegistry.register(LabelAttributeStrikeThroughModel.self) + try? ModelRegistry.register(LabelAttributeActionModel.self) + + // Buttons + MoleculeObjectMapping.shared()?.register(viewClass: PillButton.self, viewModelClass: ButtonModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: TwoButtonView.self, viewModelClass: TwoButtonViewModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ExternalLink.self, viewModelClass: ExternalLinkModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Link.self, viewModelClass: LinkModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: CaretLink.self, viewModelClass: CaretLinkModel.self) + + // Entry Field + MoleculeObjectMapping.shared()?.register(viewClass: TextEntryField.self, viewModelClass: TextEntryFieldModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: MdnEntryField.self, viewModelClass: MdnEntryFieldModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: DigitEntryField.self, viewModelClass: DigitEntryFieldModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ItemDropdownEntryField.self, viewModelClass: ItemDropdownEntryFieldModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: DateDropdownEntryField.self, viewModelClass: DateDropdownEntryFieldModel.self) + + // Other Atoms + MoleculeObjectMapping.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: MultiProgress.self, viewModelClass: MultiProgressBarModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: CaretView.self, viewModelClass: CaretViewModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: DashLine.self, viewModelClass: DashLineModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: MFLoadImageView.self, viewModelClass: ImageViewModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Line.self, viewModelClass: LineModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: GraphView.self, viewModelClass: CircleProgressModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Toggle.self, viewModelClass: ToggleModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: RadioButtonLabel.self, viewModelClass: RadioButtonLabelModel.self) + + // Horizontal Combination Molecules + MoleculeObjectMapping.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) + + // Vertical Combination Molecules + MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) + + // Left Right Molecules + MoleculeObjectMapping.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: LeftRightLabelView.self, viewModelClass: LeftRightLabelModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: LabelToggle.self, viewModelClass: LabelToggleModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) + + // List items + MoleculeObjectMapping.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: DropDownFilterTableViewCell.self, viewModelClass: DropDownListItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: AccordionMoleculeTableViewCell.self, viewModelClass: AccordionListItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: TabsTableViewCell.self, viewModelClass: TabsListItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListProgressBarData.self, viewModelClass: ListProgressBarDataModel.self) + + // Other Items + MoleculeObjectMapping.shared()?.register(viewClass: MoleculeStackItem.self, viewModelClass: MoleculeStackItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: CarouselItemModel.self) + + // Other Container Molecules + MoleculeObjectMapping.shared()?.register(viewClass: MoleculeHeaderView.self, viewModelClass: MoleculeHeaderModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: FooterView.self, viewModelClass: FooterModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: Scroller.self, viewModelClass: ScrollerModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ModuleMolecule.self, viewModelClass: ModuleMoleculeModel.self) + + // Other Molecules + MoleculeObjectMapping.shared()?.register(viewClass: DoughnutChartView.self, viewModelClass: DoughnutChartModel.self) + + // Other Organisms + MoleculeObjectMapping.shared()?.register(viewClass: Carousel.self, viewModelClass: CarouselModel.self) + + // Designed List Items + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) + + // Designed Section Dividers + MoleculeObjectMapping.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) + MoleculeObjectMapping.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) + + // Designed Headers + MoleculeObjectMapping.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) + + // TODO: Need View + try? ModelRegistry.register(TabsModel.self) + + // Helper models + try? ModelRegistry.register(RuleRequiredModel.self) + try? ModelRegistry.register(RuleAnyRequiredModel.self) + try? ModelRegistry.register(RuleAnyValueChangedModel.self) + try? ModelRegistry.register(RuleAllValueChangedModel.self) + try? ModelRegistry.register(RuleEqualsModel.self) + try? ModelRegistry.register(RuleRegexModel.self) + + // Actions + try? ModelRegistry.register(ActionTopAlertModel.self) + try? ModelRegistry.register(ActionCollapseNotificationModel.self) + try? ModelRegistry.register(ActionOpenPanelModel.self) + } + + /// Convenience function to get required modules for a give model + public static func getRequiredModules(for model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { + guard let model = model else { return nil } + return MoleculeObjectMapping.shared()?.getMoleculeClass(model)?.requiredModules(with: model, delegateObject, error: error) + } + + /// Convenience function to add require modules for the given model to the passed in array. + public static func addRequiredModules(for model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, moduleList: inout [String]?, errorList: inout [MVMCoreErrorObject]?) { + guard let model = model else { return } + let error: AutoreleasingUnsafeMutablePointer? = nil + if let modules = getRequiredModules(for: model, delegateObject, error: error) { + moduleList?.append(contentsOf: modules) + } + if let error = error?.pointee { + errorList?.append(error) + } + } +} diff --git a/MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyText.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyText.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyText.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyTextModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyTextModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/Headers/HeadersH2NoButtonsBodyTextModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift similarity index 97% rename from MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift index 8d7fb539..85558caa 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinks.swift @@ -32,7 +32,7 @@ import Foundation stack.restack() } - // MARK:- MVMCoreUIMoleculeViewProtocol + // MARK:- MoleculeViewProtocol 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} diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableCheckboxAllTextAndLinksModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaret.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableIconWithRightCaretModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethod.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/LeftVariable/ListLeftVariableRadioButtonAndPaymentMethodModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinks.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextAllTextAndLinksModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyText.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/OneColumn/ListOneColumnFullWidthTextBodyTextModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift similarity index 96% rename from MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift index 5ad5d182..8ca28609 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheel.swift @@ -39,7 +39,7 @@ import Foundation } //------------------------------------------------- - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //------------------------------------------------- open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) @@ -50,7 +50,7 @@ import Foundation } //------------------------------------------------- - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //------------------------------------------------- open override func reset() { super.reset() diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRVWheelModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePayments.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariablePaymentsModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalData.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/RightVariable/ListRightVariableTotalDataModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChanges.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnCompareChangesModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescription.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDescriptionModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift similarity index 97% rename from MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift index 610821b3..43836cf0 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetails.swift @@ -32,7 +32,7 @@ import UIKit rightLabel.updateView(size) } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListTwoColumnPriceDetailsModel else { return } diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/List/TwoColumn/ListTwoColumnPriceDetailsModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift similarity index 97% rename from MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift index 48f734ad..16b1e93e 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarData.swift @@ -44,7 +44,7 @@ import UIKit } //----------------------------------------------------- - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //----------------------------------------------------- open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) @@ -59,7 +59,7 @@ import UIKit } //----------------------------------------------------- - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //----------------------------------------------------- override open func reset() { super.reset() diff --git a/MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/LockUps/ListProgressBarDataModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift similarity index 96% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift index 8e37c16a..f857b167 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDivider.swift @@ -38,7 +38,7 @@ import Foundation stack.restack() } - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListFourColumnDataUsageDividerModel else { return } @@ -52,7 +52,7 @@ import Foundation return 121 } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() label1.styleBoldBodySmall(true) diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/FourColumn/ListFourColumnDataUsageDividerModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsection.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnFullWidthTextDividerSubsectionModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShort.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerShortModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTall.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/List/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/OneColumn/ListOneColumnTextWithWhitespaceDividerTallModel.swift diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift similarity index 98% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift index cc904a77..a641f60f 100644 --- a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift +++ b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDivider.swift @@ -35,7 +35,7 @@ import Foundation stack.restack() } - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? ListThreeColumnPlanDataDividerModel else { return } diff --git a/MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift b/MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift similarity index 100% rename from MVMCoreUI/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift rename to MVMCoreUI/Atomic/Molecules/DesignedComponents/SectionDividers/ThreeColumn/ListThreeColumnPlanDataDividerModel.swift diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift similarity index 98% rename from MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift rename to MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift index acaa0923..d84c7dc0 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChart.swift +++ b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChart.swift @@ -49,11 +49,6 @@ open class DoughnutChart: View { clearLayers() } - public override func setAsMolecule() { - titleLabel.setAsMolecule() - subTitleLabel.setAsMolecule() - } - open override func setupView() { super.setupView() guard labelContainer.superview == nil else { diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChartModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Doughnut/DoughnutChartModel.swift rename to MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChartModel.swift diff --git a/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChartView.swift similarity index 93% rename from MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift rename to MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChartView.swift index 7d279759..280385cb 100644 --- a/MVMCoreUI/Molecules/Doughnut/DoughnutChartView.swift +++ b/MVMCoreUI/Atomic/Molecules/Doughnut/DoughnutChartView.swift @@ -80,11 +80,6 @@ import Foundation stack.verticalAlignment = .fill colorLablesStack.set(with: stack, delegateObject, additionalData) } - - 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 } - set(with: model, delegateObject, additionalData) - } } extension DoughnutChartView: MVMCoreUIViewConstrainingProtocol { @@ -145,10 +140,6 @@ class ColorViewWithLabel: View { label.reset() } - override func setAsMolecule() { - label.setAsMolecule() - } - override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { super.set(with: model, delegateObject, additionalData) guard let chartItemModel = model as? DoughnutChartItemModel else { diff --git a/MVMCoreUI/Molecules/FooterModel.swift b/MVMCoreUI/Atomic/Molecules/FooterModel.swift similarity index 100% rename from MVMCoreUI/Molecules/FooterModel.swift rename to MVMCoreUI/Atomic/Molecules/FooterModel.swift diff --git a/MVMCoreUI/Atomic/Molecules/FooterView.swift b/MVMCoreUI/Atomic/Molecules/FooterView.swift new file mode 100644 index 00000000..f54a84e5 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/FooterView.swift @@ -0,0 +1,12 @@ +// +// FooterView.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 3/11/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import UIKit + +open class FooterView: MoleculeContainer { +} diff --git a/MVMCoreUI/Molecules/Header.swift b/MVMCoreUI/Atomic/Molecules/Header.swift similarity index 86% rename from MVMCoreUI/Molecules/Header.swift rename to MVMCoreUI/Atomic/Molecules/Header.swift index c878c5ff..63a13fbc 100644 --- a/MVMCoreUI/Molecules/Header.swift +++ b/MVMCoreUI/Atomic/Molecules/Header.swift @@ -12,14 +12,14 @@ open class HeaderView: Container { public let line = Line() /// Convenience for doing some default setting - open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)? + open var molecule: MoleculeViewProtocol? var headerModel: HeaderModel? { get { return model as? HeaderModel } } /// Convenience function to add a molecule to the view. - open func addMolecule(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) { + open func addMolecule(_ molecule: MoleculeViewProtocol) { addSubview(molecule) containerHelper.constrainView(molecule) self.molecule = molecule @@ -29,7 +29,7 @@ open class HeaderView: Container { open override func updateView(_ size: CGFloat) { super.updateView(size) line.updateView(size) - molecule?.updateView(size) + (molecule as? MVMCoreViewProtocol)?.updateView(size) } public override func setupView() { @@ -41,14 +41,14 @@ open class HeaderView: Container { NSLayoutConstraint.pinViewRight(toSuperview: line, useMargins: true, constant: 0).isActive = true } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() line.setStyle(.heavy) - molecule?.reset?() + molecule?.reset() } - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let headerModel = headerModel else { return } diff --git a/MVMCoreUI/Molecules/HeaderModel.swift b/MVMCoreUI/Atomic/Molecules/HeaderModel.swift similarity index 100% rename from MVMCoreUI/Molecules/HeaderModel.swift rename to MVMCoreUI/Atomic/Molecules/HeaderModel.swift diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift similarity index 96% rename from MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift rename to MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift index 469b1929..c73557e0 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBody.swift @@ -41,7 +41,7 @@ import UIKit imageView.updateView(size) } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() headlineBody.reset() @@ -50,7 +50,7 @@ import UIKit imageView.reset() } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 95 } diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift similarity index 100% rename from MVMCoreUI/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift rename to MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/ImageHeadlineBodyModel.swift diff --git a/MVMCoreUI/Molecules/RadioButtonLabel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/RadioButtonLabel.swift similarity index 100% rename from MVMCoreUI/Molecules/RadioButtonLabel.swift rename to MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/RadioButtonLabel.swift diff --git a/MVMCoreUI/Molecules/RadioButtonLabelModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/RadioButtonLabelModel.swift similarity index 100% rename from MVMCoreUI/Molecules/RadioButtonLabelModel.swift rename to MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/RadioButtonLabelModel.swift diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/TabsModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift similarity index 100% rename from MVMCoreUI/Molecules/HorizontalCombinationViews/TabsModel.swift rename to MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TabsModel.swift diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonView.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TwoButtonView.swift similarity index 97% rename from MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonView.swift rename to MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TwoButtonView.swift index 98160441..285c429c 100644 --- a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonView.swift +++ b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TwoButtonView.swift @@ -89,7 +89,7 @@ import UIKit equalWidthConstraint?.isActive = false } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() setDefault() @@ -100,7 +100,7 @@ import UIKit return .center } - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { guard let model = model as? TwoButtonViewModel, let buttonModel = model.primaryButton ?? model.secondaryButton else { return 0 } diff --git a/MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift b/MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift similarity index 100% rename from MVMCoreUI/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift rename to MVMCoreUI/Atomic/Molecules/HorizontalCombinationViews/TwoButtonViewModel.swift diff --git a/MVMCoreUI/Molecules/Items/AccordionListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/AccordionListItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/AccordionListItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/AccordionListItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/AccordionMoleculeTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/AccordionMoleculeTableViewCell.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/AccordionMoleculeTableViewCell.swift rename to MVMCoreUI/Atomic/Molecules/Items/AccordionMoleculeTableViewCell.swift diff --git a/MVMCoreUI/Molecules/Items/CarouselItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/CarouselItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/CarouselItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/DropDownFilterTableViewCell.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/DropDownFilterTableViewCell.swift rename to MVMCoreUI/Atomic/Molecules/Items/DropDownFilterTableViewCell.swift diff --git a/MVMCoreUI/Molecules/Items/DropDownListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/DropDownListItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/DropDownListItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/ListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/ListItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/ListItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/MoleculeCollectionViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/MoleculeCollectionViewCell.swift similarity index 85% rename from MVMCoreUI/Molecules/Items/MoleculeCollectionViewCell.swift rename to MVMCoreUI/Atomic/Molecules/Items/MoleculeCollectionViewCell.swift index cf1779be..219617ec 100644 --- a/MVMCoreUI/Molecules/Items/MoleculeCollectionViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/MoleculeCollectionViewCell.swift @@ -8,10 +8,9 @@ import UIKit -open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeViewProtocol, ModelMoleculeViewProtocol { +open class MoleculeCollectionViewCell: UICollectionViewCell, MoleculeViewProtocol { - open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)? - open var json: [AnyHashable: Any]? + open var molecule: MoleculeViewProtocol? public let containerHelper = ContainerHelper() // In updateView, will set padding to default. @@ -69,10 +68,7 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - guard let collectionModel = model as? CarouselItemModel else { - return - } - + guard let collectionModel = model as? CarouselItemModel else { return } if let useHorizontalMargins = collectionModel.useHorizontalMargins { updateViewHorizontalDefaults = useHorizontalMargins } @@ -92,23 +88,22 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi } if molecule == nil { - if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(collectionModel.molecule, delegateObject, false) { + if let moleculeView = MoleculeObjectMapping.shared()?.createMolecule(collectionModel.molecule, delegateObject: delegateObject, additionalData: additionalData) { contentView.insertSubview(moleculeView, at: 0) containerHelper.constrainView(moleculeView) molecule = moleculeView } } else { - (molecule as? ModelMoleculeViewProtocol)?.set(with: collectionModel.molecule, delegateObject, additionalData) + molecule?.set(with: collectionModel.molecule, delegateObject, additionalData) } - guard let molecule = molecule else { return } - containerHelper.set(with: json, for: molecule) - + guard let molecule = molecule as? (UIView & MVMCoreUIViewConstrainingProtocol) else { return } + containerHelper.set(with: collectionModel, for: molecule) accessibilityElements = molecule.subviews } public func reset() { - molecule?.reset?() + molecule?.reset() updateViewVerticalDefaults = true updateViewHorizontalDefaults = true backgroundColor = .white @@ -116,14 +111,14 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi public class func nameForReuse(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { guard let molecule = (model as? CarouselItemModel)?.molecule, - let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(molecule) as? ModelMoleculeViewProtocol.Type else { + let moleculeClass = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else { return nil } return moleculeClass.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName } public func updateView(_ size: CGFloat) { - molecule?.updateView(size) + (molecule as? MVMCoreViewProtocol)?.updateView(size) MFStyler.setDefaultMarginsFor(contentView, size: size, horizontal: updateViewHorizontalDefaults, vertical: updateViewVerticalDefaults) } diff --git a/MVMCoreUI/Molecules/Items/MoleculeListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/MoleculeListItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/MoleculeListItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/MoleculeListItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/MoleculeStackItem.swift b/MVMCoreUI/Atomic/Molecules/Items/MoleculeStackItem.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/MoleculeStackItem.swift rename to MVMCoreUI/Atomic/Molecules/Items/MoleculeStackItem.swift diff --git a/MVMCoreUI/Molecules/Items/MoleculeStackItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/MoleculeStackItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/MoleculeStackItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/MoleculeStackItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/MoleculeTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/MoleculeTableViewCell.swift similarity index 58% rename from MVMCoreUI/Molecules/Items/MoleculeTableViewCell.swift rename to MVMCoreUI/Atomic/Molecules/Items/MoleculeTableViewCell.swift index 33229092..4534a506 100644 --- a/MVMCoreUI/Molecules/Items/MoleculeTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/MoleculeTableViewCell.swift @@ -11,7 +11,7 @@ import UIKit @objcMembers open class MoleculeTableViewCell: TableViewCell { - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { @@ -21,8 +21,8 @@ import UIKit } if molecule != nil { - (molecule as? ModelMoleculeViewProtocol)?.set(with: castModel.molecule, delegateObject, additionalData) - } else if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(castModel.molecule, delegateObject, false) { + molecule?.set(with: castModel.molecule, delegateObject, additionalData) + } else if let moleculeView = MoleculeObjectMapping.shared()?.createMolecule(castModel.molecule, delegateObject: delegateObject, additionalData: additionalData) { addMolecule(moleculeView) } super.set(with: model, delegateObject, additionalData) @@ -31,23 +31,23 @@ import UIKit public override class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { guard let moleculeModel = (model as? MoleculeListItemModel)?.molecule else { return "\(self)<>" } - let className = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moleculeModel) as? ModelMoleculeViewProtocol.Type - let moleculeName = className?.nameForReuse(with: moleculeModel, delegateObject) ?? moleculeModel.moleculeName ?? "" + let className = MoleculeObjectMapping.shared()?.getMoleculeClass(moleculeModel) + let moleculeName = className?.nameForReuse(with: moleculeModel, delegateObject) ?? moleculeModel.moleculeName return "\(self)<\(moleculeName)>" } - public class func requiredModules(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { - guard let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), - let theClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON) + public static func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { + guard let moleculeModel = (model as? MoleculeListItemModel)?.molecule, + let theClass = MoleculeObjectMapping.shared()?.getMoleculeClass(moleculeModel) else { return nil } - return theClass.requiredModules?(moleculeJSON, delegateObject: delegateObject, error: error) + return theClass.requiredModules(with: moleculeModel, delegateObject, error: error) } public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { guard let moleculeModel = (model as? MoleculeContainerModel)?.molecule, - let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moleculeModel) as? ModelMoleculeViewProtocol.Type, + let classType = MoleculeObjectMapping.shared()?.getMoleculeClass(moleculeModel), let height = classType.estimatedHeight(with: moleculeModel, delegateObject) else { return 80 } diff --git a/MVMCoreUI/Molecules/Items/StackItem.swift b/MVMCoreUI/Atomic/Molecules/Items/StackItem.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/StackItem.swift rename to MVMCoreUI/Atomic/Molecules/Items/StackItem.swift diff --git a/MVMCoreUI/Molecules/Items/StackItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/StackItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/StackItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/StackItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/StackItemModelProtocol.swift b/MVMCoreUI/Atomic/Molecules/Items/StackItemModelProtocol.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/StackItemModelProtocol.swift rename to MVMCoreUI/Atomic/Molecules/Items/StackItemModelProtocol.swift diff --git a/MVMCoreUI/Molecules/Items/TabsListItemModel.swift b/MVMCoreUI/Atomic/Molecules/Items/TabsListItemModel.swift similarity index 100% rename from MVMCoreUI/Molecules/Items/TabsListItemModel.swift rename to MVMCoreUI/Atomic/Molecules/Items/TabsListItemModel.swift diff --git a/MVMCoreUI/Molecules/Items/TabsTableViewCell.swift b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift similarity index 97% rename from MVMCoreUI/Molecules/Items/TabsTableViewCell.swift rename to MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift index cb6ee755..16794eb1 100644 --- a/MVMCoreUI/Molecules/Items/TabsTableViewCell.swift +++ b/MVMCoreUI/Atomic/Molecules/Items/TabsTableViewCell.swift @@ -44,7 +44,8 @@ import UIKit public override func reset() { super.reset() - tabs.reset() + // TODO: Uncomment when finished with Ryan Tab pr. + //tabs.reset() } public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { diff --git a/MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImage.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ActionDetailWithImage.swift similarity index 94% rename from MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImage.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ActionDetailWithImage.swift index b550ad0d..d693f2b5 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImage.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ActionDetailWithImage.swift @@ -45,11 +45,6 @@ import UIKit super.init(coder: aDecoder) } - public convenience init(json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - self.init() - setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } - //------------------------------------------------------ // MARK: - View Lifecycle //------------------------------------------------------ @@ -113,7 +108,7 @@ import UIKit setDefaultState() } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 197 } diff --git a/MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImageModel.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ActionDetailWithImageModel.swift similarity index 100% rename from MVMCoreUI/Molecules/LeftRightViews/ActionDetailWithImageModel.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ActionDetailWithImageModel.swift diff --git a/MVMCoreUI/Molecules/LeftRightViews/CornerLabels.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabels.swift similarity index 95% rename from MVMCoreUI/Molecules/LeftRightViews/CornerLabels.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabels.swift index bbdda6af..c0018e9b 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/CornerLabels.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabels.swift @@ -140,19 +140,14 @@ import UIKit width.isActive = true } - // MARK: - MVMCoreUIMoleculeViewProtocol - public override func setAsMolecule() { - super.setAsMolecule() - styleDefault() - } - + // MARK: - MoleculeViewProtocol public override func reset() { super.reset() styleDefault() spaceAboveMolecule = 6.0 spaceBelowMolecule = 6.0 - (middleView as? MVMCoreUIMoleculeViewProtocol)?.reset?() + (middleView as? MoleculeViewProtocol)?.reset() } func styleDefault() { @@ -170,8 +165,8 @@ import UIKit super.set(with: model, delegateObject, additionalData) guard let model = model as? CornerLabelsModel else { return } if middleView != nil { - (middleView as? ModelMoleculeViewProtocol)?.set(with: model, delegateObject, additionalData) - } else if let moleculeModel = model.molecule, let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(moleculeModel, delegateObject) { + (middleView as? MoleculeViewProtocol)?.set(with: model, delegateObject, additionalData) + } else if let moleculeModel = model.molecule, let molecule = MoleculeObjectMapping.shared()?.createMolecule(moleculeModel, delegateObject: delegateObject, additionalData: additionalData) { addMiddleView(molecule) } diff --git a/MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabelsModel.swift similarity index 100% rename from MVMCoreUI/Molecules/LeftRightViews/CornerLabelsModel.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/CornerLabelsModel.swift diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggle.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggle.swift similarity index 97% rename from MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggle.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggle.swift index bfed52e4..0d1f0089 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggle.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggle.swift @@ -37,7 +37,7 @@ import UIKit toggle.reset() } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? HeadlineBodyLinkToggleModel else { return } diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift similarity index 100% rename from MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyLinkToggleModel.swift diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggle.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggle.swift similarity index 86% rename from MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggle.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggle.swift index bbfe0ffc..138d58ed 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggle.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggle.swift @@ -34,13 +34,12 @@ import UIKit NSLayoutConstraint.pinViews(leftView: headlineBody, rightView: toggle, alignTop: false) } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) - guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else { - return - } - setWithJSON(headlineBodyToggleModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData) + guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else { return } + headlineBody.set(with: headlineBodyToggleModel.headlineBody, delegateObject, additionalData) + toggle.set(with: headlineBodyToggleModel.toggle, delegateObject, additionalData) } open class override func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { @@ -50,7 +49,7 @@ import UIKit return max(toggleHeight, headlineBody) } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() headlineBody.reset() diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift similarity index 100% rename from MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/HeadlineBodyToggleModel.swift diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift similarity index 95% rename from MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift index ccbdf9c3..9ce24d3b 100644 --- a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift +++ b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggle.swift @@ -31,7 +31,7 @@ import UIKit NSLayoutConstraint.pinViews(leftView: label, rightView: toggle, alignTop: false) } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { guard let model = model as? LabelToggleModel, let toggleHeight = Toggle.estimatedHeight(with: model.toggle, delegateObject), @@ -47,7 +47,7 @@ import UIKit toggle.set(with: labelToggleModel.toggle, delegateObject, additionalData) } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() label.reset() diff --git a/MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift b/MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift similarity index 100% rename from MVMCoreUI/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift rename to MVMCoreUI/Atomic/Molecules/LeftRightViews/ToggleMolecules/LabelToggleModel.swift diff --git a/MVMCoreUI/Molecules/ModuleMolecule.swift b/MVMCoreUI/Atomic/Molecules/ModuleMolecule.swift similarity index 84% rename from MVMCoreUI/Molecules/ModuleMolecule.swift rename to MVMCoreUI/Atomic/Molecules/ModuleMolecule.swift index e92f41da..7374b067 100644 --- a/MVMCoreUI/Molecules/ModuleMolecule.swift +++ b/MVMCoreUI/Atomic/Molecules/ModuleMolecule.swift @@ -10,7 +10,7 @@ import UIKit open class ModuleMolecule: Container { - open var moduleMolecule: (UIView & MVMCoreUIMoleculeViewProtocol & ModelMoleculeViewProtocol)? + open var moduleMolecule: MoleculeViewProtocol? var moduleMoleculeModel: ModuleMoleculeModel? { get { return model as? ModuleMoleculeModel } } @@ -29,10 +29,10 @@ open class ModuleMolecule: Container { } if moduleMolecule == nil { - if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(moduleModel, delegateObject, false) { + if let moleculeView = MoleculeObjectMapping.shared()?.createMolecule(moduleModel, delegateObject: delegateObject, additionalData: additionalData) { addSubview(moleculeView) NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: moleculeView, useMargins: false).values)) - moduleMolecule = moleculeView as? (UIView & MVMCoreUIMoleculeViewProtocol & ModelMoleculeViewProtocol) + moduleMolecule = moleculeView isAccessibilityElement = false if moleculeView.accessibilityElements != nil { @@ -50,7 +50,7 @@ open class ModuleMolecule: Container { guard let moduleMolecule = model as? ModuleMoleculeModel, let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName), - let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type, + let classType = MoleculeObjectMapping.shared()?.getMoleculeClass(moduleModel), let height = classType.estimatedHeight(with: moduleModel, delegateObject) else { // Critical error return 0 @@ -61,7 +61,7 @@ open class ModuleMolecule: Container { public override class func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { guard let moduleMolecule = model as? ModuleMoleculeModel, let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName), - let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type, + let classType = MoleculeObjectMapping.shared()?.getMoleculeClass(moduleModel), let name = classType.nameForReuse(with: moduleModel, delegateObject) else { // Critical error return "moduleMolecule<>" diff --git a/MVMCoreUI/Molecules/ModuleMoleculeModel.swift b/MVMCoreUI/Atomic/Molecules/ModuleMoleculeModel.swift similarity index 100% rename from MVMCoreUI/Molecules/ModuleMoleculeModel.swift rename to MVMCoreUI/Atomic/Molecules/ModuleMoleculeModel.swift diff --git a/MVMCoreUI/Molecules/MoleculeHeaderModel.swift b/MVMCoreUI/Atomic/Molecules/MoleculeHeaderModel.swift similarity index 100% rename from MVMCoreUI/Molecules/MoleculeHeaderModel.swift rename to MVMCoreUI/Atomic/Molecules/MoleculeHeaderModel.swift diff --git a/MVMCoreUI/Molecules/MoleculeHeaderView.swift b/MVMCoreUI/Atomic/Molecules/MoleculeHeaderView.swift similarity index 71% rename from MVMCoreUI/Molecules/MoleculeHeaderView.swift rename to MVMCoreUI/Atomic/Molecules/MoleculeHeaderView.swift index 3404afc3..bff5a14f 100644 --- a/MVMCoreUI/Molecules/MoleculeHeaderView.swift +++ b/MVMCoreUI/Atomic/Molecules/MoleculeHeaderView.swift @@ -30,13 +30,13 @@ public class MoleculeHeaderView: MoleculeContainer { NSLayoutConstraint.pinViewRight(toSuperview: line, useMargins: true, constant: 0).isActive = true } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() line.setStyle(.heavy) } - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let headerModel = headerModel else { return } @@ -44,11 +44,4 @@ public class MoleculeHeaderView: MoleculeContainer { line.set(with: lineModel, delegateObject, additionalData) } } - - public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - if let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), let height = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON)?.estimatedHeight?(forRow: moleculeJSON, delegateObject: delegateObject) { - return height + PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing - } - return 121 - } } diff --git a/MVMCoreUI/Molecules/NavigationItemModelProtocol.swift b/MVMCoreUI/Atomic/Molecules/NavigationItemModelProtocol.swift similarity index 100% rename from MVMCoreUI/Molecules/NavigationItemModelProtocol.swift rename to MVMCoreUI/Atomic/Molecules/NavigationItemModelProtocol.swift diff --git a/MVMCoreUI/Molecules/Scroller.swift b/MVMCoreUI/Atomic/Molecules/Scroller.swift similarity index 85% rename from MVMCoreUI/Molecules/Scroller.swift rename to MVMCoreUI/Atomic/Molecules/Scroller.swift index 6184f3d0..56c33df7 100644 --- a/MVMCoreUI/Molecules/Scroller.swift +++ b/MVMCoreUI/Atomic/Molecules/Scroller.swift @@ -32,9 +32,9 @@ import UIKit public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { if let casteModel = model as? ScrollerModel { if view != nil { - (view as? ModelMoleculeViewProtocol)?.set(with: casteModel.molecule, delegateObject, additionalData) + (view as? MoleculeViewProtocol)?.set(with: casteModel.molecule, delegateObject, additionalData) } else { - if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(casteModel.molecule, delegateObject) { + if let molecule = MoleculeObjectMapping.shared()?.createMolecule(casteModel.molecule, delegateObject: delegateObject, additionalData: additionalData) { contentView.addSubview(molecule) molecule.translatesAutoresizingMaskIntoConstraints = false containerHelper.constrainView(molecule) diff --git a/MVMCoreUI/Molecules/ScrollerModel.swift b/MVMCoreUI/Atomic/Molecules/ScrollerModel.swift similarity index 100% rename from MVMCoreUI/Molecules/ScrollerModel.swift rename to MVMCoreUI/Atomic/Molecules/ScrollerModel.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift similarity index 96% rename from MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift index 49b08b44..ebe54017 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLink.swift @@ -41,7 +41,7 @@ import UIKit } //-------------------------------------------------- - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //-------------------------------------------------- open override func reset() { @@ -53,7 +53,7 @@ import UIKit } //-------------------------------------------------- - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //-------------------------------------------------- open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/EyebrowHeadlineBodyLinkModel.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift similarity index 97% rename from MVMCoreUI/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift index 00ccaeeb..8f36c0a3 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadLineBodyCaretLinkImage.swift @@ -65,14 +65,14 @@ import Foundation sendSubviewToBack(backgroundImageView) } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() headlineBody.reset() backgroundImageView.reset() } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 320 } diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBody.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBody.swift similarity index 82% rename from MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBody.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBody.swift index a120807d..904a3c65 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBody.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBody.swift @@ -121,7 +121,7 @@ open class HeadlineBody: View { } //-------------------------------------------------- - // MARK: - ModelMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //-------------------------------------------------- public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { @@ -139,28 +139,8 @@ open class HeadlineBody: View { messageLabel.setOptional(with: headlineBodyModel.body, delegateObject, additionalData) } - //-------------------------------------------------- - // MARK: - MVMCoreUIMoleculeViewProtocol - //-------------------------------------------------- - - open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - - style(with: json?.optionalStringForKey("style")) - - let headlineJSON = json?.optionalDictionaryForKey("headline") - headlineLabel.setWithJSON(headlineJSON, delegateObject: delegateObject, additionalData: additionalData) - - let bodyJSON = json?.optionalDictionaryForKey("body") - messageLabel.setWithJSON(bodyJSON, delegateObject: delegateObject, additionalData: additionalData) - } - open override func reset() { super.reset() stylePageHeader() } - - public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 58 - } } diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButton.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyButton.swift similarity index 90% rename from MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButton.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyButton.swift index 90183e6e..35522146 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButton.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyButton.swift @@ -15,7 +15,7 @@ import UIKit //------------------------------------------------------ let headlineBody = HeadlineBody(frame: .zero) - let button = PrimaryButton.primaryTinyButton(false)! + let button = PillButton(frame: .zero) //------------------------------------------------------ // MARK: - Properties @@ -45,11 +45,6 @@ import UIKit super.init(coder: aDecoder) } - public convenience init(json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - self.init() - setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } - //------------------------------------------------------ // MARK: - View Lifecycle //------------------------------------------------------ @@ -89,8 +84,7 @@ import UIKit headlineBody.headlineLabel.font = MFStyler.fontH3() headlineBody.messageLabel.font = MFStyler.fontB3() - button.setAsTiny(true) - button.setAsSecondaryCustom() + button.styleSecondary() button.isHidden = false buttonHeadlinePadding = PaddingTwo } @@ -107,7 +101,7 @@ import UIKit defaultState() } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return 320 } diff --git a/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift new file mode 100644 index 00000000..51d011e8 --- /dev/null +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift @@ -0,0 +1,63 @@ +// +// HeadlineBodyButtonModel.swift +// MVMCoreUI +// +// Created by Scott Pfeil on 1/22/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import Foundation + +public class HeadlineBodyButtonModel: MoleculeModelProtocol { + public static var identifier: String = "headlineBodyButton" + public var moleculeName: String = HeadlineBodyButtonModel.identifier + public var backgroundColor: Color? + + public var headlineBody: HeadlineBodyModel + public var button: ButtonModel + public var buttonHeadlinePadding: CGFloat + + //-------------------------------------------------- + // MARK: - Method + //-------------------------------------------------- + + /// Defaults to set + public func setDefaults() { + button.size = .tiny + button.style = .secondary + } + + //-------------------------------------------------- + // MARK: - Keys + //-------------------------------------------------- + + private enum CodingKeys: String, CodingKey { + case moleculeName + case backgroundColor + case headlineBody + case button + case buttonHeadlinePadding + } + + //-------------------------------------------------- + // 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) + headlineBody = try typeContainer.decode(HeadlineBodyModel.self, forKey: .headlineBody) + button = try typeContainer.decode(ButtonModel.self, forKey: .button) + buttonHeadlinePadding = try typeContainer.decode(CGFloat.self, forKey: .buttonHeadlinePadding) + setDefaults() + } + + 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(headlineBody, forKey: .headlineBody) + try container.encode(button, forKey: .button) + try container.encode(buttonHeadlinePadding, forKey: .buttonHeadlinePadding) + } +} diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyCaretLinkImageModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyCaretLinkImageModel.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyCaretLinkImageModel.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyCaretLinkImageModel.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLink.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyLink.swift similarity index 97% rename from MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLink.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyLink.swift index e9bfabaa..da5014a9 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLink.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyLink.swift @@ -58,7 +58,7 @@ import UIKit } } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol open override func reset() { super.reset() headlineBody.reset() @@ -66,7 +66,7 @@ import UIKit link.reset() } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let model = model as? HeadlineBodyLinkModel else { return } diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyLinkModel.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/HeadlineBodyModel.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedList.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/NumberedList.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedList.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/NumberedList.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/NumberedListModel.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeModel.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeStack.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeStack.swift similarity index 84% rename from MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeStack.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeStack.swift index 56cc0447..4ff045ce 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeStack.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeStack.swift @@ -14,7 +14,8 @@ open class StringAndMoleculeStack: MoleculeStackView { guard let model = stackModel else { return } for stackItemModel in model.molecules { guard let stringAndMoleculeModel = stackItemModel.molecule as? StringAndMoleculeModel, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forName: stringAndMoleculeModel.molecule.moleculeName) as? (UIView & ModelMoleculeViewProtocol) else { + let molecule = MoleculeObjectMapping.shared()?.createMolecule(stringAndMoleculeModel.molecule, delegateObject: delegateObject + , additionalData: additionalData) else { // Throw error return } diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift similarity index 94% rename from MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift index 09ed8a7b..6db91703 100644 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift +++ b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/StringAndMoleculeStack/StringAndMoleculeView.swift @@ -11,7 +11,7 @@ import Foundation open class StringAndMoleculeView: View { var label = Label.commonLabelB2(true) var string: String - var molecule: UIView & ModelMoleculeViewProtocol + var molecule: MoleculeViewProtocol var leftWidthConstraint: NSLayoutConstraint? @Percent var percentage: CGFloat = 5 @@ -27,7 +27,7 @@ open class StringAndMoleculeView: View { } // MARK: - Inits - public init(string: String, molecule: UIView & ModelMoleculeViewProtocol) { + public init(string: String, molecule: MoleculeViewProtocol) { self.string = string self.molecule = molecule super.init(frame: .zero) @@ -73,7 +73,7 @@ open class StringAndMoleculeView: View { override open func reset() { super.reset() label.reset() - (molecule as? MVMCoreUIMoleculeViewProtocol)?.reset?() + molecule.reset() } public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedList.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/UnOrderedList.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedList.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/UnOrderedList.swift diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift b/MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift similarity index 100% rename from MVMCoreUI/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift rename to MVMCoreUI/Atomic/Molecules/VerticalCombinationViews/Lists/UnOrderedListModel.swift diff --git a/MVMCoreUI/Organisms/Carousel.swift b/MVMCoreUI/Atomic/Organisms/Carousel.swift similarity index 95% rename from MVMCoreUI/Organisms/Carousel.swift rename to MVMCoreUI/Atomic/Organisms/Carousel.swift index b4fa5c24..d1d3af1b 100644 --- a/MVMCoreUI/Organisms/Carousel.swift +++ b/MVMCoreUI/Atomic/Organisms/Carousel.swift @@ -50,6 +50,8 @@ open class Carousel: View { // For adding pager public var bottomPin: NSLayoutConstraint? + public var delegateObject: MVMCoreUIDelegateObject? + // MARK: - MVMCoreViewProtocol open override func setupView() { super.setupView() @@ -82,8 +84,9 @@ open class Carousel: View { } } - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + self.delegateObject = delegateObject super.set(with: model, delegateObject, additionalData) guard let carouselModel = model as? CarouselModel else { return } collectionView.backgroundColor = backgroundColor @@ -141,7 +144,7 @@ open class Carousel: View { open func setupPagingMolecule(_ molecule: CarouselPagingModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) { var pagingView: (UIView & MVMCoreUIPagingProtocol)? = nil if let molecule = molecule { - pagingView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(molecule, delegateObject, false) as? (UIView & MVMCoreUIPagingProtocol) + pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & MVMCoreUIPagingProtocol) } addPaging(view: pagingView, position: (CGFloat(molecule?.position ?? 20))) } @@ -158,10 +161,10 @@ open class Carousel: View { // MARK: - Convenience /// Returns the (identifier, class) of the molecule for the given map. func getMoleculeInfo(with molecule: MoleculeModelProtocol, delegateObject: MVMCoreUIDelegateObject?) -> (identifier: String, class: AnyClass, molecule: MoleculeModelProtocol)? { - guard let className = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(molecule) else { + guard let className = MoleculeObjectMapping.shared()?.getMoleculeClass(molecule) else { return nil } - return ((className as? ModelMoleculeViewProtocol.Type)?.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName, className, molecule) + return (className.nameForReuse(with: molecule, delegateObject) ?? molecule.moleculeName, className, molecule) } /// Sets the alignment from the string. @@ -272,11 +275,11 @@ extension Carousel: UICollectionViewDataSource { return UICollectionViewCell() } let cell = collectionView.dequeueReusableCell(withReuseIdentifier: moleculeInfo.identifier, for: indexPath) - if let protocolCell = cell as? MVMCoreUIMoleculeViewProtocol & ModelMoleculeViewProtocol { - protocolCell.reset?() - protocolCell.set(with: moleculeInfo.molecule, nil, nil) - protocolCell.updateView(collectionView.bounds.width) + if let protocolCell = cell as? MoleculeViewProtocol { + protocolCell.reset() + protocolCell.set(with: moleculeInfo.molecule, delegateObject, nil) } + (cell as? MVMCoreViewProtocol)?.updateView(collectionView.bounds.width) setAccessiblity(cell, index: indexPath.row) return cell } diff --git a/MVMCoreUI/Organisms/CarouselModel.swift b/MVMCoreUI/Atomic/Organisms/CarouselModel.swift similarity index 100% rename from MVMCoreUI/Organisms/CarouselModel.swift rename to MVMCoreUI/Atomic/Organisms/CarouselModel.swift diff --git a/MVMCoreUI/Organisms/MoleculeStackModel.swift b/MVMCoreUI/Atomic/Organisms/MoleculeStackModel.swift similarity index 100% rename from MVMCoreUI/Organisms/MoleculeStackModel.swift rename to MVMCoreUI/Atomic/Organisms/MoleculeStackModel.swift diff --git a/MVMCoreUI/Organisms/MoleculeStackView.swift b/MVMCoreUI/Atomic/Organisms/MoleculeStackView.swift similarity index 89% rename from MVMCoreUI/Organisms/MoleculeStackView.swift rename to MVMCoreUI/Atomic/Organisms/MoleculeStackView.swift index 12d79dcd..0f13cde5 100644 --- a/MVMCoreUI/Organisms/MoleculeStackView.swift +++ b/MVMCoreUI/Atomic/Organisms/MoleculeStackView.swift @@ -36,7 +36,7 @@ open class MoleculeStackView: Stack { override open func createStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { guard let stackItemModels = stackModel?.molecules else { return } for model in stackItemModels { - if let stackItem = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(model, delegateObject) as? MoleculeStackItem { + if let stackItem = MoleculeObjectMapping.shared()?.createMolecule(model, delegateObject: delegateObject, additionalData: additionalData) as? MoleculeStackItem { stackItems.append(stackItem) } } diff --git a/MVMCoreUI/Organisms/Stack.swift b/MVMCoreUI/Atomic/Organisms/Stack.swift similarity index 95% rename from MVMCoreUI/Organisms/Stack.swift rename to MVMCoreUI/Atomic/Organisms/Stack.swift index 8e6df863..23797927 100644 --- a/MVMCoreUI/Organisms/Stack.swift +++ b/MVMCoreUI/Atomic/Organisms/Stack.swift @@ -128,14 +128,14 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto } //-------------------------------------------------- - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //-------------------------------------------------- open override func reset() { super.reset() backgroundColor = .clear for item in stackItems { - (item as? MVMCoreUIMoleculeViewProtocol)?.reset?() + (item as? MoleculeViewProtocol)?.reset() } } @@ -162,7 +162,7 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto } var name = "stack<" for case let item in model.molecules { - if let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping[item.moleculeName] as? ModelMoleculeViewProtocol.Type, + if let moleculeClass = MoleculeObjectMapping.shared()?.moleculeMapping[item.moleculeName], let nameForReuse = moleculeClass.nameForReuse(with: item, delegateObject) { name.append(nameForReuse + ",") } else { @@ -181,7 +181,7 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto for case let item in model.molecules { if item.gone { continue } - let height = (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(item) as? ModelMoleculeViewProtocol.Type)?.estimatedHeight(with: item, delegateObject) ?? 0 + let height = (MoleculeObjectMapping.shared()?.getMoleculeClass(item))?.estimatedHeight(with: item, delegateObject) ?? 0 if !horizontal { // Vertical stack aggregates the items let spacing = item.spacing ?? model.spacing @@ -198,7 +198,7 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto guard let model = model as? T else { return nil } var modules: [String] = [] for case let item in model.molecules { - if let modulesForMolecule = (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(item) as? ModelMoleculeViewProtocol.Type)?.requiredModules(with: item, delegateObject, error: error) { + if let modulesForMolecule = (MoleculeObjectMapping.shared()?.getMoleculeClass(item))?.requiredModules(with: item, delegateObject, error: error) { modules += modulesForMolecule } } @@ -216,7 +216,7 @@ open class Stack: Container where T: (StackModelProtocol & MoleculeModelProto open func setStackItemsFromModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { guard let models = stackModel?.molecules else { return } for (index, element) in models.enumerated() { - (stackItems[index] as? ModelMoleculeViewProtocol)?.set(with: element, delegateObject, additionalData) + (stackItems[index] as? MoleculeViewProtocol)?.set(with: element, delegateObject, additionalData) } } diff --git a/MVMCoreUI/Organisms/StackModel.swift b/MVMCoreUI/Atomic/Organisms/StackModel.swift similarity index 100% rename from MVMCoreUI/Organisms/StackModel.swift rename to MVMCoreUI/Atomic/Organisms/StackModel.swift diff --git a/MVMCoreUI/Organisms/StackModelProtocol.swift b/MVMCoreUI/Atomic/Organisms/StackModelProtocol.swift similarity index 100% rename from MVMCoreUI/Organisms/StackModelProtocol.swift rename to MVMCoreUI/Atomic/Organisms/StackModelProtocol.swift diff --git a/MVMCoreUI/OtherHandlers/ModelMoleculeDelegateProtocol.swift b/MVMCoreUI/Atomic/Protocols/MoleculeDelegateProtocol.swift similarity index 88% rename from MVMCoreUI/OtherHandlers/ModelMoleculeDelegateProtocol.swift rename to MVMCoreUI/Atomic/Protocols/MoleculeDelegateProtocol.swift index 435e5a24..e845f4f0 100644 --- a/MVMCoreUI/OtherHandlers/ModelMoleculeDelegateProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/MoleculeDelegateProtocol.swift @@ -15,7 +15,7 @@ public protocol MoleculeDelegateProtocol { func getModuleWithName(_ moleculeName: String) -> MoleculeModelProtocol? /// Notifies the delegate that the molecule layout update. Should be called when the layout may change due to an async method. - func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) //optional + func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) //optional /// Asks the delegate to add or remove molecules. func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath? @@ -25,7 +25,7 @@ public protocol MoleculeDelegateProtocol { extension MoleculeDelegateProtocol { - public func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {} + public func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) {} public func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath? { return nil } public func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], indexPath: IndexPath, animation: UITableView.RowAnimation) {} diff --git a/MVMCoreUI/Molecules/ModelMoleculeViewProtocol.swift b/MVMCoreUI/Atomic/Protocols/MoleculeViewProtocol.swift similarity index 55% rename from MVMCoreUI/Molecules/ModelMoleculeViewProtocol.swift rename to MVMCoreUI/Atomic/Protocols/MoleculeViewProtocol.swift index fbeadd96..1ee85184 100644 --- a/MVMCoreUI/Molecules/ModelMoleculeViewProtocol.swift +++ b/MVMCoreUI/Atomic/Protocols/MoleculeViewProtocol.swift @@ -1,5 +1,5 @@ // -// ModelMoleculeViewProtocol.swift +// MoleculeViewProtocol.swift // MVMCoreUI // // Created by Suresh, Kamlesh on 10/24/19. @@ -8,30 +8,54 @@ import Foundation -public protocol ModelMoleculeViewProtocol { +import UIKit +import MVMCore.MVMCoreViewProtocol + +public protocol MoleculeViewProtocol: UIView { + + /// Initializes the view with the model + init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) + + /// Sets the view with the model. func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) + + /// Resets to default state before set with json is called again. + func reset() + + /// Allows the molecule to set its name for reuse. Default could be moleculeName. static func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? + + /// For the molecule list to load more efficiently. static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? + + /// Can return the required modules static func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? } -extension ModelMoleculeViewProtocol { +extension MoleculeViewProtocol { + /// Calls set with model + public init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { + self.init(frame: .zero) + set(with: model, delegateObject, additionalData) + } + + /// Uses moleculeName public static func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { return model.moleculeName } + + // Do nothing, optionals. + public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {} + public func reset() {} + public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { return nil } public static func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { return nil } - // Temporary - public static func decodeJSONToModel(json: [AnyHashable: Any], type: T.Type) throws -> T where T : Decodable { - let data = try JSONSerialization.data(withJSONObject: json) - let decoder = JSONDecoder() - return try decoder.decode(type, from: data) - } + /// Temporary convenience function for helping bridge the gap for legacy code. public func setOptional(with model: T?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { if let model = model { set(with: model, delegateObject, additionalData) diff --git a/MVMCoreUI/Templates/TemplateProtocol.swift b/MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift similarity index 100% rename from MVMCoreUI/Templates/TemplateProtocol.swift rename to MVMCoreUI/Atomic/Protocols/TemplateProtocol.swift diff --git a/MVMCoreUI/Templates/ListPageTemplateModel.swift b/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift similarity index 65% rename from MVMCoreUI/Templates/ListPageTemplateModel.swift rename to MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift index 57d99f26..a2cb3473 100644 --- a/MVMCoreUI/Templates/ListPageTemplateModel.swift +++ b/MVMCoreUI/Atomic/Templates/ListPageTemplateModel.swift @@ -8,22 +8,14 @@ import Foundation -@objcMembers public class ListPageTemplateModel: MVMControllerModelProtocol { - - public var formRules: [FormGroupRule]? - public var formValidator: FormValidator? - +@objcMembers public class ListPageTemplateModel: TemplateModel { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - public static var identifier: String = "list" - - public var pageType: String - public var screenHeading: String? - public var isAtomicTabs: Bool? - public var navigationItem: NavigationItemModelProtocol? - + public override class var identifier: String { + return "list" + } public var header: MoleculeModelProtocol? public var molecules: [ListItemModelProtocol & MoleculeModelProtocol]? public var footer: MoleculeModelProtocol? @@ -34,7 +26,7 @@ import Foundation //-------------------------------------------------- public init(pageType: String, screenHeading: String?, molecules: [ListItemModelProtocol & MoleculeModelProtocol]) { - self.pageType = pageType + super.init(pageType: pageType) self.screenHeading = screenHeading self.molecules = molecules } @@ -61,27 +53,20 @@ import Foundation required public init(from decoder: Decoder) throws { let typeContainer = try decoder.container(keyedBy: CodingKeys.self) - pageType = try typeContainer.decode(String.self, forKey: .pageType) - screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) molecules = try typeContainer.decodeModelsIfPresent(codingKey: .molecules) - isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) header = try typeContainer.decodeModelIfPresent(codingKey: .header) footer = try typeContainer.decodeModelIfPresent(codingKey: .footer) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) - formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) + try super.init(from: decoder) } - public func encode(to encoder: Encoder) throws { + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) var container = encoder.container(keyedBy: CodingKeys.self) - try container.encode(pageType, forKey: .pageType) - try container.encode(template, forKey: .template) - try container.encodeIfPresent(screenHeading, forKey: .screenHeading) try container.encodeModelsIfPresent(molecules, forKey: .molecules) - try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs) try container.encodeModelIfPresent(header, forKey: .header) try container.encodeModelIfPresent(footer, forKey: .footer) try container.encode(line, forKey: .line) - try container.encodeIfPresent(formRules, forKey: .formRules) } } diff --git a/MVMCoreUI/Templates/ModalMoleculeListTemplate.swift b/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift similarity index 100% rename from MVMCoreUI/Templates/ModalMoleculeListTemplate.swift rename to MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift diff --git a/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift.orig b/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift.orig new file mode 100644 index 00000000..af43d0af --- /dev/null +++ b/MVMCoreUI/Atomic/Templates/ModalMoleculeListTemplate.swift.orig @@ -0,0 +1,30 @@ +// +// ModalMoleculeListTemplate.swift +// MVMCoreUI +// +// Created by Ryan on 3/6/20. +// Copyright © 2020 Verizon Wireless. All rights reserved. +// + +import UIKit + +open class ModalMoleculeListTemplate: MoleculeListTemplate { + +<<<<<<< HEAD + override open func handleNewData() { + MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: {[weak self] _ in + if let _ = self { + MVMCoreNavigationHandler.shared()?.removeCurrentViewController() + } +======= + public var closeButton: MFCustomButton? + + override open func newDataBuildScreen() { + super.newDataBuildScreen() + closeButton = MVMCoreUICommonViewsUtility.addCloseButton(to: view, action: { [weak self] _ in + self?.dismiss() +>>>>>>> develop + }, verticalCentered: false) + super.handleNewData() + } +} diff --git a/MVMCoreUI/Templates/ModalMoleculeStackTemplate.swift b/MVMCoreUI/Atomic/Templates/ModalMoleculeStackTemplate.swift similarity index 100% rename from MVMCoreUI/Templates/ModalMoleculeStackTemplate.swift rename to MVMCoreUI/Atomic/Templates/ModalMoleculeStackTemplate.swift diff --git a/MVMCoreUI/Templates/MoleculeListCellProtocol.swift b/MVMCoreUI/Atomic/Templates/MoleculeListCellProtocol.swift similarity index 100% rename from MVMCoreUI/Templates/MoleculeListCellProtocol.swift rename to MVMCoreUI/Atomic/Templates/MoleculeListCellProtocol.swift diff --git a/MVMCoreUI/Templates/MoleculeListTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift similarity index 81% rename from MVMCoreUI/Templates/MoleculeListTemplate.swift rename to MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift index 9503a4c6..f79211ea 100644 --- a/MVMCoreUI/Templates/MoleculeListTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/MoleculeListTemplate.swift @@ -46,7 +46,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol open override func viewForTop() -> UIView { guard let headerModel = templateModel?.header, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, false) + let molecule = MoleculeObjectMapping.shared()?.createMolecule(headerModel, delegateObject: delegateObjectIVar) else { return super.viewForTop() } // Temporary, Default the horizontal padding @@ -59,7 +59,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol override open func viewForBottom() -> UIView { guard let footerModel = templateModel?.footer, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, false) + let molecule = MoleculeObjectMapping.shared()?.createMolecule(footerModel, delegateObject: delegateObjectIVar) else { return super.viewForBottom() } return molecule @@ -101,7 +101,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol open func tableView(_ tableView: UITableView, estimatedHeightForRowAt indexPath: IndexPath) -> CGFloat { guard let moleculeInfo = moleculesInfo?[indexPath.row], - let estimatedHeight = (moleculeInfo.class as? ModelMoleculeViewProtocol.Type)?.estimatedHeight(with: moleculeInfo.molecule, delegateObject() as? MVMCoreUIDelegateObject) + let estimatedHeight = (moleculeInfo.class as? MoleculeViewProtocol.Type)?.estimatedHeight(with: moleculeInfo.molecule, delegateObject() as? MVMCoreUIDelegateObject) else { return 0 } return estimatedHeight @@ -117,29 +117,20 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol let cell = tableView.dequeueReusableCell(withIdentifier: moleculeInfo.identifier) else { return UITableViewCell() } - let moleculeCell = cell as? MVMCoreUIMoleculeViewProtocol - moleculeCell?.reset?() - - if let protocolCell = cell as? MoleculeListCellProtocol { - protocolCell.setLines(with: templateModel?.line, delegateObject: selfDelegateObject, additionalData: nil, indexPath: indexPath) - } - - (moleculeCell as? ModelMoleculeViewProtocol)?.set(with: moleculeInfo.molecule, selfDelegateObject, nil) - moleculeCell?.updateView(tableView.bounds.width) + (cell as? MoleculeViewProtocol)?.reset() + (cell as? MoleculeListCellProtocol)?.setLines(with: templateModel?.line, delegateObject: delegateObjectIVar, additionalData: nil, indexPath: indexPath) + (cell as? MoleculeViewProtocol)?.set(with: moleculeInfo.molecule, delegateObjectIVar, nil) + (cell as? MVMCoreViewProtocol)?.updateView(tableView.bounds.width) // Neded to fix an apple defect where the cell is not the correct size on certain devices for certain cells cell.layoutIfNeeded() return cell } open func tableView(_ tableView: UITableView, willDisplay cell: UITableViewCell, forRowAt indexPath: IndexPath) { - - if let protocolCell = cell as? MoleculeListCellProtocol { - protocolCell.willDisplay() - } + (cell as? MoleculeListCellProtocol)?.willDisplay() } open func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { - if let cell = tableView.cellForRow(at: indexPath) as? MoleculeListCellProtocol { cell.didSelectCell(at: indexPath, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, additionalData: nil) } @@ -149,7 +140,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol // MARK: - MoleculeDelegateProtocol //-------------------------------------------------- - open override func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) { + open override func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) { if let tableView = tableView { let point = molecule.convert(molecule.bounds.origin, to: tableView) @@ -215,8 +206,8 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol func getMoleculeInfo(with listItem: (ListItemModelProtocol & MoleculeModelProtocol)?) -> (identifier: String, class: AnyClass, molecule: ListItemModelProtocol & MoleculeModelProtocol)? { guard let listItem = listItem, - let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(listItem) else { return nil } - let moleculeName = (moleculeClass as? ModelMoleculeViewProtocol.Type)?.nameForReuse(with: listItem, delegateObject() as? MVMCoreUIDelegateObject) ?? listItem.moleculeName + let moleculeClass = MoleculeObjectMapping.shared()?.getMoleculeClass(listItem) else { return nil } + let moleculeName = moleculeClass.nameForReuse(with: listItem, delegateObject() as? MVMCoreUIDelegateObject) ?? listItem.moleculeName return (moleculeName, moleculeClass, listItem) } @@ -250,19 +241,17 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol /// Gets modules required by the loadObject.pageJSON. open func requiredModules() -> [Any]? { + var modules: [String]? = [] + var errors: [MVMCoreErrorObject]? = nil + MoleculeObjectMapping.addRequiredModules(for: templateModel?.header, delegateObjectIVar, moduleList: &modules, errorList: &errors) + MoleculeObjectMapping.addRequiredModules(for: templateModel?.footer, delegateObjectIVar, moduleList: &modules, errorList: &errors) - let modules: NSMutableArray = [] - let delegate = delegateObject() as? MVMCoreUIDelegateObject - - MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: loadObject?.pageJSON?.optionalDictionaryForKey("header"), delegateObject: delegate, moduleList: modules, errorList: nil) - MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: loadObject?.pageJSON?.optionalDictionaryForKey("footer"), delegateObject: delegate, moduleList: modules, errorList: nil) - - if let molecules = loadObject?.pageJSON?.optionalArrayForKey(KeyMolecules) as? [[AnyHashable: Any]] { + if let molecules = templateModel?.molecules { for molecule in molecules { - MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: molecule, delegateObject: delegate, moduleList: modules, errorList: nil) + MoleculeObjectMapping.addRequiredModules(for: molecule, delegateObjectIVar, moduleList: &modules, errorList: &errors) } } - return modules as? [Any] + return modules } } diff --git a/MVMCoreUI/Templates/MoleculeStackCenteredTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeStackCenteredTemplate.swift similarity index 100% rename from MVMCoreUI/Templates/MoleculeStackCenteredTemplate.swift rename to MVMCoreUI/Atomic/Templates/MoleculeStackCenteredTemplate.swift diff --git a/MVMCoreUI/Templates/MoleculeStackTemplate.swift b/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift similarity index 70% rename from MVMCoreUI/Templates/MoleculeStackTemplate.swift rename to MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift index c8d807cc..b26bbc8a 100644 --- a/MVMCoreUI/Templates/MoleculeStackTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/MoleculeStackTemplate.swift @@ -37,7 +37,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { open override func viewForTop() -> UIView? { guard let headerModel = templateModel?.header, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, false) else { + let molecule = MoleculeObjectMapping.shared()?.createMolecule(headerModel, delegateObject: delegateObjectIVar) else { return nil } return molecule @@ -58,7 +58,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { override open func viewForBottom() -> UIView? { guard let footerModel = templateModel?.footer, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, false) else { + let molecule = MoleculeObjectMapping.shared()?.createMolecule(footerModel, delegateObject: delegateObjectIVar) else { return nil } return molecule @@ -75,11 +75,11 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol { /// Gets modules required by the loadObject.pageJSON. open func requiredModules() -> [Any]? { - let modules: NSMutableArray = [] - let delegate = delegateObject() as? MVMCoreUIDelegateObject - MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: loadObject?.pageJSON?.optionalDictionaryForKey("header"), delegateObject: delegate, moduleList: modules, errorList: nil) - MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: loadObject?.pageJSON?.optionalDictionaryForKey("footer"), delegateObject: delegate, moduleList: modules, errorList: nil) - MVMCoreUIMoleculeMappingObject.addRequiredModules(forJSON: loadObject?.pageJSON?.optionalDictionaryForKey("stack"), delegateObject: delegate, moduleList: modules, errorList: nil) - return modules as? [Any] + var modules: [String]? = [] + var errors: [MVMCoreErrorObject]? = nil + MoleculeObjectMapping.addRequiredModules(for: templateModel?.header, delegateObjectIVar, moduleList: &modules, errorList: &errors) + MoleculeObjectMapping.addRequiredModules(for: templateModel?.footer, delegateObjectIVar, moduleList: &modules, errorList: &errors) + MoleculeObjectMapping.addRequiredModules(for: templateModel?.moleculeStack, delegateObjectIVar, moduleList: &modules, errorList: &errors) + return modules } } diff --git a/MVMCoreUI/Templates/StackCenteredPageTemplateModel.swift b/MVMCoreUI/Atomic/Templates/StackCenteredPageTemplateModel.swift similarity index 100% rename from MVMCoreUI/Templates/StackCenteredPageTemplateModel.swift rename to MVMCoreUI/Atomic/Templates/StackCenteredPageTemplateModel.swift diff --git a/MVMCoreUI/Templates/StackPageTemplateModel.swift b/MVMCoreUI/Atomic/Templates/StackPageTemplateModel.swift similarity index 100% rename from MVMCoreUI/Templates/StackPageTemplateModel.swift rename to MVMCoreUI/Atomic/Templates/StackPageTemplateModel.swift diff --git a/MVMCoreUI/Atomic/Templates/StackPageTemplateModel.swift.orig b/MVMCoreUI/Atomic/Templates/StackPageTemplateModel.swift.orig new file mode 100644 index 00000000..504378cd --- /dev/null +++ b/MVMCoreUI/Atomic/Templates/StackPageTemplateModel.swift.orig @@ -0,0 +1,58 @@ +// +// StackPageTemplate.swift +// MVMCoreUI +// +// Created by Suresh, Kamlesh on 11/22/19. +// Copyright © 2019 Verizon Wireless. All rights reserved. +// + +import Foundation + + +@objcMembers public class StackPageTemplateModel: TemplateModel { + public override class var identifier: String { + return "stack" + } + + public var header: MoleculeModelProtocol? + public var moleculeStack: MoleculeStackModel + public var footer: MoleculeModelProtocol? + + public init(pageType: String, moleculeStack: MoleculeStackModel) { + self.moleculeStack = moleculeStack + super.init(pageType: pageType) + } + + private enum CodingKeys: String, CodingKey { +<<<<<<< HEAD +======= + case pageType + case template + case screenHeading +>>>>>>> develop + case header + case footer + case stack + } + + required public init(from decoder: Decoder) throws { + let typeContainer = try decoder.container(keyedBy: CodingKeys.self) + moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .stack) + header = try typeContainer.decodeModelIfPresent(codingKey: .header) + footer = try typeContainer.decodeModelIfPresent(codingKey: .footer) + try super.init(from: decoder) + } + + public override func encode(to encoder: Encoder) throws { + try super.encode(to: encoder) + var container = encoder.container(keyedBy: CodingKeys.self) +<<<<<<< HEAD +======= + try container.encode(pageType, forKey: .pageType) + try container.encode(template, forKey: .template) +>>>>>>> develop + try container.encode(moleculeStack, forKey: .stack) + try container.encodeModelIfPresent(header, forKey: .header) + try container.encodeModelIfPresent(footer, forKey: .footer) + } +} diff --git a/MVMCoreUI/Templates/TemplateModel.swift b/MVMCoreUI/Atomic/Templates/TemplateModel.swift similarity index 77% rename from MVMCoreUI/Templates/TemplateModel.swift rename to MVMCoreUI/Atomic/Templates/TemplateModel.swift index 053d45fc..224b902f 100644 --- a/MVMCoreUI/Templates/TemplateModel.swift +++ b/MVMCoreUI/Atomic/Templates/TemplateModel.swift @@ -13,8 +13,11 @@ import Foundation return "" } public var pageType: String + public var template: String { + // Although this is done in the extension, it is needed for the encoding. + return Self.identifier + } public var screenHeading: String? - public var isAtomicTabs: Bool? public var navigationItem: NavigationItemModelProtocol? public var formRules: [FormGroupRule]? @@ -24,8 +27,8 @@ import Foundation private enum CodingKeys: String, CodingKey { case pageType + case template case screenHeading - case isAtomicTabs case formRules case navigationItem } @@ -34,17 +37,16 @@ import Foundation let typeContainer = try decoder.container(keyedBy: CodingKeys.self) pageType = try typeContainer.decode(String.self, forKey: .pageType) screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading) - isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs) formRules = try typeContainer.decodeIfPresent([FormGroupRule].self, forKey: .formRules) - navigationItem = try typeContainer.decodeModelIfPresent(codingKey: .navigationItem) + // navigationItem = try typeContainer.decodeModelIfPresent(codingKey: .navigationItem) } public func encode(to encoder: Encoder) throws { var container = encoder.container(keyedBy: CodingKeys.self) try container.encode(pageType, forKey: .pageType) + try container.encode(template, forKey: .template) try container.encodeIfPresent(screenHeading, forKey: .screenHeading) - try container.encodeIfPresent(isAtomicTabs, forKey: .isAtomicTabs) try container.encodeIfPresent(formRules, forKey: .formRules) - try container.encodeModelIfPresent(navigationItem, forKey: .navigationItem) + //try container.encodeModelIfPresent(navigationItem, forKey: .navigationItem) } } diff --git a/MVMCoreUI/Templates/ThreeLayerPageTemplateModel.swift b/MVMCoreUI/Atomic/Templates/ThreeLayerPageTemplateModel.swift similarity index 100% rename from MVMCoreUI/Templates/ThreeLayerPageTemplateModel.swift rename to MVMCoreUI/Atomic/Templates/ThreeLayerPageTemplateModel.swift diff --git a/MVMCoreUI/Templates/ThreeLayerTemplate.swift b/MVMCoreUI/Atomic/Templates/ThreeLayerTemplate.swift similarity index 76% rename from MVMCoreUI/Templates/ThreeLayerTemplate.swift rename to MVMCoreUI/Atomic/Templates/ThreeLayerTemplate.swift index ba35c971..8f963f5d 100644 --- a/MVMCoreUI/Templates/ThreeLayerTemplate.swift +++ b/MVMCoreUI/Atomic/Templates/ThreeLayerTemplate.swift @@ -29,7 +29,7 @@ import UIKit open override func viewForTop() -> UIView? { guard let headerModel = templateModel?.header, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, false) else { + let molecule = MoleculeObjectMapping.shared()?.createMolecule(headerModel, delegateObject: delegateObjectIVar) else { return nil } return molecule @@ -37,7 +37,7 @@ import UIKit open override func viewForMiddle() -> UIView? { guard let middleModel = templateModel?.middle, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(middleModel, delegateObject() as? MVMCoreUIDelegateObject, false) else { + let molecule = MoleculeObjectMapping.shared()?.createMolecule(middleModel, delegateObject: delegateObjectIVar) else { return nil } return molecule @@ -45,7 +45,7 @@ import UIKit override open func viewForBottom() -> UIView? { guard let footerModel = templateModel?.footer, - let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, false) else { + let molecule = MoleculeObjectMapping.shared()?.createMolecule(footerModel, delegateObject: delegateObjectIVar) else { return nil } return molecule diff --git a/MVMCoreUI/Atoms/Buttons/MFCustomButton+ActionModel.swift b/MVMCoreUI/Atoms/Buttons/MFCustomButton+ActionModel.swift deleted file mode 100644 index 84f4be33..00000000 --- a/MVMCoreUI/Atoms/Buttons/MFCustomButton+ActionModel.swift +++ /dev/null @@ -1,25 +0,0 @@ -// -// MFCustomButton+ActionModel.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 1/9/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public extension MFCustomButton { - - func set(with action: ActionModelProtocol, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - - buttonDelegate = delegateObject?.buttonDelegate - add({ [weak self] sender in - guard let self = self else { return } - if let data = try? action.encode(using: JSONEncoder()), - let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any], - delegateObject?.buttonDelegate?.button?(self, shouldPerformActionWithMap: actionMap, additionalData: additionalData) ?? true { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) - } - }, for: .touchUpInside) - } -} diff --git a/MVMCoreUI/Atoms/Buttons/PrimaryButton+MoleculeProtocolExtension.swift b/MVMCoreUI/Atoms/Buttons/PrimaryButton+MoleculeProtocolExtension.swift deleted file mode 100644 index 6cf0df21..00000000 --- a/MVMCoreUI/Atoms/Buttons/PrimaryButton+MoleculeProtocolExtension.swift +++ /dev/null @@ -1,38 +0,0 @@ -// -// PrimaryButton+MoleculeProtocolExtension.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 1/13/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -// temporary until link is finished -extension PrimaryButton: ModelMoleculeViewProtocol { - public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - guard let model = model as? ButtonModel else { return } - - setTitle(model.title, for: .normal) - backgroundColor = model.backgroundColor?.uiColor - - if let style = model.style { - switch style { - case .primary: - setAsStandardCustom() - case .secondary: - setAsSecondaryCustom() - } - } - - if let size = model.size { - switch size { - case .standard: - setAsTiny(false) - case .tiny: - setAsTiny(true) - } - } - set(with: model.action, delegateObject: delegateObject, additionalData: additionalData) - } -} diff --git a/MVMCoreUI/Atoms/TextFields/TextFieldModel.swift b/MVMCoreUI/Atoms/TextFields/TextFieldModel.swift deleted file mode 100644 index 4d6f1fd0..00000000 --- a/MVMCoreUI/Atoms/TextFields/TextFieldModel.swift +++ /dev/null @@ -1,27 +0,0 @@ -// -// TextFieldModel.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 10/24/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import UIKit - -@objcMembers public class TextFieldModel: MoleculeModelProtocol { - - public static var identifier: String = "textField" - public var backgroundColor: Color? - public var moleculeName: String = TextFieldModel.identifier - public var editable: Bool? - public var disabled: Bool? - public var errorMsg: String? - public var label: String? - public var type: String? - public var value: String? - public var regex: String? - - public var required: Bool? - public var fieldKey: String? - public var groupName: String? -} diff --git a/MVMCoreUI/Atoms/Views/MFView+ModelExtension.swift b/MVMCoreUI/Atoms/Views/MFView+ModelExtension.swift deleted file mode 100644 index 840a5d18..00000000 --- a/MVMCoreUI/Atoms/Views/MFView+ModelExtension.swift +++ /dev/null @@ -1,24 +0,0 @@ -// -// MFView+ModelExtension.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 11/20/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -extension MFView { - public func setUpDefaultWithModel(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - self.model = model - if let backgroundColor = model.backgroundColor { - self.backgroundColor = backgroundColor.uiColor - } - } -} - -extension ModelMoleculeViewProtocol where Self: MFView { - public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { - setUpDefaultWithModel(model, delegateObject, additionalData) - } -} diff --git a/MVMCoreUI/Atoms/Views/MVMCoreUISwitch+Model.swift b/MVMCoreUI/Atoms/Views/MVMCoreUISwitch+Model.swift deleted file mode 100644 index 1b7ad307..00000000 --- a/MVMCoreUI/Atoms/Views/MVMCoreUISwitch+Model.swift +++ /dev/null @@ -1,28 +0,0 @@ -// -// MVMCoreUISwitch+Model.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 1/14/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -// temporary until link is finished -extension MVMCoreUISwitch: ModelMoleculeViewProtocol { - public func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { - guard let model = model as? ToggleModel else { return } - - FormValidator.setupValidation(molecule: model, delegate: delegateObject?.formHolderDelegate) - setState(model.state, animated: false) - - guard let action = model.action else { return } - actionBlock = { - if let data = try? action.encode(using: JSONEncoder()), - let actionMap = try? JSONSerialization.jsonObject(with: data, options: JSONSerialization.ReadingOptions.init()) as? [AnyHashable: Any] { - MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject) - - } - } - } -} diff --git a/MVMCoreUI/BaseClasses/Button.swift b/MVMCoreUI/BaseClasses/Button.swift index 8722b800..f4ab51c6 100644 --- a/MVMCoreUI/BaseClasses/Button.swift +++ b/MVMCoreUI/BaseClasses/Button.swift @@ -8,7 +8,7 @@ public typealias ButtonAction = (Button) -> () -@objcMembers open class Button: UIButton, MFButtonProtocol, ModelMoleculeViewProtocol { +@objcMembers open class Button: UIButton, MFButtonProtocol, MoleculeViewProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -86,7 +86,7 @@ public typealias ButtonAction = (Button) -> () } } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.model = model @@ -111,6 +111,10 @@ public typealias ButtonAction = (Button) -> () open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { return nil } + + open func reset() { + backgroundColor = .clear + } } // MARK: - MVMCoreViewProtocol @@ -127,14 +131,6 @@ extension Button: MVMCoreViewProtocol { } } -// MARK: - MVMCoreUIMoleculeViewProtocol -extension Button: MVMCoreUIMoleculeViewProtocol { - - open func reset() { - backgroundColor = .clear - } -} - // MARK: AppleGuidelinesProtocol extension Button: AppleGuidelinesProtocol { diff --git a/MVMCoreUI/BaseClasses/ButtonModelProtocol.swift b/MVMCoreUI/BaseClasses/ButtonModelProtocol.swift index d16c2464..1288f4e3 100644 --- a/MVMCoreUI/BaseClasses/ButtonModelProtocol.swift +++ b/MVMCoreUI/BaseClasses/ButtonModelProtocol.swift @@ -9,6 +9,5 @@ import Foundation public protocol ButtonModelProtocol: EnableableModelProtocol { - var enabled: Bool { get set } var action: ActionModelProtocol { get set } } diff --git a/MVMCoreUI/BaseClasses/Control.swift b/MVMCoreUI/BaseClasses/Control.swift index 265e56b3..29c7bad4 100644 --- a/MVMCoreUI/BaseClasses/Control.swift +++ b/MVMCoreUI/BaseClasses/Control.swift @@ -8,7 +8,7 @@ import UIKit -@objcMembers open class Control: UIControl, ModelMoleculeViewProtocol { +@objcMembers open class Control: UIControl, MoleculeViewProtocol { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- @@ -47,7 +47,7 @@ import UIKit } } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.model = model if let backgroundColor = model.backgroundColor { @@ -66,6 +66,10 @@ import UIKit open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { return nil } + + open func reset() { + backgroundColor = .clear + } } // MARK: - AppleGuidelinesProtocol @@ -86,18 +90,3 @@ extension Control: MVMCoreViewProtocol { insetsLayoutMarginsFromSafeArea = false } } - -// MARK: - MVMCoreUIMoleculeViewProtocol -extension Control: MVMCoreUIMoleculeViewProtocol { - open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - self.json = json - - if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) { - backgroundColor = UIColor.mfGet(forHex: backgroundColorString) - } - } - - open func reset() { - backgroundColor = .clear - } -} diff --git a/MVMCoreUI/BaseClasses/TableViewCell.swift b/MVMCoreUI/BaseClasses/TableViewCell.swift index ebf25a3c..36aade11 100644 --- a/MVMCoreUI/BaseClasses/TableViewCell.swift +++ b/MVMCoreUI/BaseClasses/TableViewCell.swift @@ -8,9 +8,9 @@ import UIKit -@objcMembers open class TableViewCell: UITableViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol, ModelMoleculeViewProtocol { +@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol { - open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)? + open var molecule: MoleculeViewProtocol? open var listItemModel: ListItemModelProtocol? public let containerHelper = ContainerHelper() @@ -86,7 +86,7 @@ import UIKit } /// Adds the molecule to the view. - open func addMolecule(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) { + open func addMolecule(_ molecule: MoleculeViewProtocol) { contentView.addSubview(molecule) containerHelper.constrainView(molecule) self.molecule = molecule @@ -139,7 +139,7 @@ import UIKit topSeparatorView?.updateView(size) bottomSeparatorView?.updateView(size) - molecule?.updateView(size) + (molecule as? MVMCoreViewProtocol)?.updateView(size) } open func setupView() { @@ -182,7 +182,7 @@ import UIKit } open func reset() { - molecule?.reset?() + molecule?.reset() backgroundColor = .white } diff --git a/MVMCoreUI/BaseClasses/TextField.swift b/MVMCoreUI/BaseClasses/TextField.swift index b1a13854..c571d52d 100644 --- a/MVMCoreUI/BaseClasses/TextField.swift +++ b/MVMCoreUI/BaseClasses/TextField.swift @@ -17,9 +17,6 @@ public protocol TextFieldDidDeleteProtocol: class { //-------------------------------------------------- // MARK: - Properties //-------------------------------------------------- - - open var json: [AnyHashable: Any]? - private var initialSetupPerformed = false /// Set to true to hide the blinking textField cursor. @@ -87,23 +84,14 @@ extension TextField: MVMCoreViewProtocol { } } -/// MARK:- MVMCoreUIMoleculeViewProtocol -extension TextField: MVMCoreUIMoleculeViewProtocol { - - open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - self.json = json - - guard let dictionary = json else { return } - - if let backgroundColorString = dictionary.optionalStringForKey(KeyBackgroundColor) { - backgroundColor = UIColor.mfGet(forHex: backgroundColorString) - } - - if let text = dictionary[KeyText] as? String { - self.text = text +/// MARK:- MoleculeViewProtocol +extension TextField: MoleculeViewProtocol { + open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) { + if let color = model.backgroundColor?.uiColor { + backgroundColor = color } } - + open func reset() { backgroundColor = .clear } diff --git a/MVMCoreUI/BaseClasses/View.swift b/MVMCoreUI/BaseClasses/View.swift index 860ce442..f68e942b 100644 --- a/MVMCoreUI/BaseClasses/View.swift +++ b/MVMCoreUI/BaseClasses/View.swift @@ -8,7 +8,7 @@ import UIKit -@objcMembers open class View: UIView, ModelMoleculeViewProtocol { +@objcMembers open class View: UIView, MoleculeViewProtocol { open var json: [AnyHashable: Any]? open var model: MoleculeModelProtocol? @@ -39,7 +39,7 @@ import UIKit } } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { self.model = model if let backgroundColor = model.backgroundColor { @@ -58,6 +58,10 @@ import UIKit open class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { return nil } + + open func reset() { + backgroundColor = .clear + } } // MARK:- MVMCoreViewProtocol @@ -72,23 +76,3 @@ extension View: MVMCoreViewProtocol { MVMCoreUIUtility.setMarginsFor(self, leading: 0, top: 0, trailing: 0, bottom: 0) } } - -// MARK:- MVMCoreUIMoleculeViewProtocol -extension View: MVMCoreUIMoleculeViewProtocol { - - open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - self.json = json - - if let backgroundColorString = json?.optionalStringForKey(KeyBackgroundColor) { - backgroundColor = UIColor.mfGet(forHex: backgroundColorString) - } - } - - open func reset() { - backgroundColor = .clear - } - - open func setAsMolecule() { - - } -} diff --git a/MVMCoreUI/BaseControllers/ViewController.swift b/MVMCoreUI/BaseControllers/ViewController.swift index 333df798..3735f62d 100644 --- a/MVMCoreUI/BaseControllers/ViewController.swift +++ b/MVMCoreUI/BaseControllers/ViewController.swift @@ -16,12 +16,10 @@ import UIKit /// Set if this page is containted in a manager. public var manager: (UIViewController & MVMCoreViewManagerProtocol)? - public var selfDelegateObject: MVMCoreUIDelegateObject? + /// A temporary iVar backer for delegateObject() until we change the protocol + public var delegateObjectIVar: MVMCoreUIDelegateObject? public func delegateObject() -> DelegateObject? { - if selfDelegateObject == nil { - selfDelegateObject = MVMCoreUIDelegateObject.create(withDelegateForAll: self) - } - return selfDelegateObject + return delegateObjectIVar } public var formValidator: FormValidator? @@ -276,6 +274,9 @@ import UIKit // Presents from the bottom. modalPresentationStyle = MVMCoreGetterUtility.isOnIPad() ? UIModalPresentationStyle.formSheet : UIModalPresentationStyle.overCurrentContext + // Create the default delegate object. + delegateObjectIVar = MVMCoreUIDelegateObject.create(withDelegateForAll: self) + // Do some initial loading. if !initialLoadFinished { initialLoadFinished = true @@ -355,7 +356,7 @@ import UIKit open func handleOpenPage(for requestParameters: MVMCoreRequestParameters, actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) { formValidator?.addFormParams(requestParameters: requestParameters) requestParameters.parentPageType = loadObject?.pageJSON?.optionalStringForKey("parentPageType") - MVMCoreActionHandler.defaultHandleOpenPage(for: requestParameters, additionalData: additionalData, delegateObject: selfDelegateObject) + MVMCoreActionHandler.defaultHandleOpenPage(for: requestParameters, additionalData: additionalData, delegateObject: delegateObject()) } open func logAction(withActionInformation actionInformation: [AnyHashable : Any]?, additionalData: [AnyHashable : Any]?) { @@ -383,7 +384,7 @@ import UIKit } // Needed otherwise when subclassed, the extension gets called. - open func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {} + open func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) {} open func getIndexPath(for molecule: ListItemModelProtocol & MoleculeModelProtocol) -> IndexPath? { return nil } open func addMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], indexPath: IndexPath, animation: UITableView.RowAnimation) {} open func removeMolecules(_ molecules: [ListItemModelProtocol & MoleculeModelProtocol], animation: UITableView.RowAnimation) {} diff --git a/MVMCoreUI/Categories/UIStackView+Extension.swift b/MVMCoreUI/Categories/UIStackView+Extension.swift index e968fd7c..a793635a 100644 --- a/MVMCoreUI/Categories/UIStackView+Extension.swift +++ b/MVMCoreUI/Categories/UIStackView+Extension.swift @@ -8,7 +8,7 @@ import Foundation -extension UIStackView: MVMCoreUIMoleculeViewProtocol { +extension UIStackView: MoleculeViewProtocol { public func updateView(_ size: CGFloat) { for view in arrangedSubviews { (view as? MVMCoreViewProtocol)?.updateView(size) @@ -17,7 +17,7 @@ extension UIStackView: MVMCoreUIMoleculeViewProtocol { public func reset() { for view in arrangedSubviews { - (view as? MVMCoreUIMoleculeViewProtocol)?.reset?() + (view as? MoleculeViewProtocol)?.reset() } } } diff --git a/MVMCoreUI/Containers/Views/Container/Container.swift b/MVMCoreUI/Containers/Views/Container/Container.swift index a08cd651..eb05cd21 100644 --- a/MVMCoreUI/Containers/Views/Container/Container.swift +++ b/MVMCoreUI/Containers/Views/Container/Container.swift @@ -15,13 +15,18 @@ open class Container: View, ContainerProtocol { get { return model as? ContainerModelProtocol } } - // MARK:- ModelMoleculeViewProtocol + // MARK:- MoleculeViewProtocol override open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { super.set(with: model, delegateObject, additionalData) guard let containerModel = model as? ContainerModelProtocol else { return } containerHelper.set(with: containerModel, for: view as? MVMCoreUIViewConstrainingProtocol) } + override open func reset() { + super.reset() + (view as? MoleculeViewProtocol)?.reset() + } + // MARK:- ContainerProtocol open func alignHorizontal(_ alignment: UIStackView.Alignment) { containerHelper.alignHorizontal(alignment) @@ -62,21 +67,3 @@ public extension Container { addAndContain(view) } } - -// MARK: - MVMCoreUIMoleculeViewProtocol -public extension Container { - override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - guard let view = view else { return } - containerHelper.set(with: json, for: view) - } - - override func reset() { - super.reset() - (view as? MVMCoreUIMoleculeViewProtocol)?.reset?() - } - - override func setAsMolecule() { - (view as? MVMCoreUIMoleculeViewProtocol)?.setAsMolecule?() - } -} diff --git a/MVMCoreUI/Containers/Views/EntryFieldContainer.swift b/MVMCoreUI/Containers/Views/EntryFieldContainer.swift index 773721f7..eae81741 100644 --- a/MVMCoreUI/Containers/Views/EntryFieldContainer.swift +++ b/MVMCoreUI/Containers/Views/EntryFieldContainer.swift @@ -273,7 +273,7 @@ import UIKit } //-------------------------------------------------- - // MARK: - MVMCoreUIMoleculeViewProtocol + // MARK: - MoleculeViewProtocol //-------------------------------------------------- open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { @@ -281,13 +281,3 @@ import UIKit self.delegateObject = delegateObject } } - -extension EntryFieldContainer { - - override open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - self.delegateObject = delegateObject - - guard let dictionary = json, !dictionary.isEmpty else { return } - } -} diff --git a/MVMCoreUI/Containers/Views/MoleculeContainer.swift b/MVMCoreUI/Containers/Views/MoleculeContainer.swift index f98451dd..98ecfa28 100644 --- a/MVMCoreUI/Containers/Views/MoleculeContainer.swift +++ b/MVMCoreUI/Containers/Views/MoleculeContainer.swift @@ -14,28 +14,13 @@ open class MoleculeContainer: Container { public func addMolecule(_ molecule: UIView) { addAndContain(molecule) } - - override public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) { - guard let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule) else { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - return - } - if view == nil { - if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: false) { - addAndContain(molecule) - } - } else { - (view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON?(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData) - } - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } public override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { if let casteModel = model as? MoleculeContainerModelProtocol { if view != nil { - (view as? ModelMoleculeViewProtocol)?.set(with: casteModel.molecule, delegateObject, additionalData) + (view as? MoleculeViewProtocol)?.set(with: casteModel.molecule, delegateObject, additionalData) } else { - if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(casteModel.molecule, delegateObject) { + if let molecule = MoleculeObjectMapping.shared()?.createMolecule(casteModel.molecule, delegateObject: delegateObject, additionalData: additionalData) { addMolecule(molecule) } } @@ -45,16 +30,16 @@ open class MoleculeContainer: Container { public override static func nameForReuse(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> String? { guard let containerModel = model as? MoleculeContainerModelProtocol, - let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type, + let moleculeClass = MoleculeObjectMapping.shared()?.getMoleculeClass(containerModel.molecule), let moleculeName = moleculeClass.nameForReuse(with: containerModel.molecule, delegateObject) else { - return "\(model.moleculeName ?? "moleculeContainer")<>" + return "\(model.moleculeName)<>" } - return "\(model.moleculeName ?? "moleculeContainer")<\(moleculeName)>" + return "\(model.moleculeName)<\(moleculeName)>" } public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { guard let containerModel = model as? MoleculeContainerModelProtocol else { return 0 } - guard let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type, + guard let moleculeClass = MoleculeObjectMapping.shared()?.getMoleculeClass(containerModel.molecule), let moleculeHeight = moleculeClass.estimatedHeight(with: containerModel.molecule, delegateObject) else { return (containerModel.topMarginPadding ?? 0) + (containerModel.bottomMarginPadding ?? 0) } @@ -63,7 +48,7 @@ open class MoleculeContainer: Container { public override class func requiredModules(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? { guard let containerModel = model as? MoleculeContainerModelProtocol, - let moleculeClass = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(containerModel.molecule) as? ModelMoleculeViewProtocol.Type else { return nil } + let moleculeClass = MoleculeObjectMapping.shared()?.getMoleculeClass(containerModel.molecule) else { return nil } return moleculeClass.requiredModules(with: containerModel.molecule, delegateObject, error: error) } } diff --git a/MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift b/MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift index 05e506eb..30abf59d 100644 --- a/MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift +++ b/MVMCoreUI/Legacy/Controllers/MFViewController+Model.swift @@ -32,7 +32,7 @@ extension MFViewController: MoleculeDelegateProtocol { } // These are required because swift will call the extension function otherwise. - @objc public func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {} + public func moleculeLayoutUpdated(_ molecule: MoleculeViewProtocol) {} @objc public func addMolecules(_ molecules: [[AnyHashable: Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {} @objc public func addMolecules(_ molecules: [[AnyHashable : Any]], indexPath: IndexPath, animation: UITableView.RowAnimation) {} diff --git a/MVMCoreUI/Legacy/Views/ButtonView.swift b/MVMCoreUI/Legacy/Views/ButtonView.swift index 088c4a00..4c489ae5 100644 --- a/MVMCoreUI/Legacy/Views/ButtonView.swift +++ b/MVMCoreUI/Legacy/Views/ButtonView.swift @@ -30,16 +30,7 @@ import UIKit primaryButton?.isEnabled = enabled } - public init(withJSON json: [AnyHashable: Any]?, additionalData: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) { - super.init(frame: .zero) - setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } - // MARK: - MVMCoreViewProtocol - open override func reset() { - primaryButton?.reset() - } - open override func updateView(_ size: CGFloat) { super.updateView(size) MVMCoreDispatchUtility.performBlock(onMainThread: { @@ -53,26 +44,11 @@ import UIKit alignCenterHorizontal() } - // MARK: - MVMCoreUIMoleculeViewProtocol - open override func setAsMolecule() { - super.setAsMolecule() - primaryButton?.setAsMolecule() - } - - open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - primaryButton?.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData) - } - - public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - return 42 - } - + // MARK: - Constraining open override func copyBackgroundColor() -> Bool { return true } - // MARK: - Constraining func setupButton() { if let primaryButton = primaryButton, !subviews.contains(primaryButton) { addSubview(primaryButton) diff --git a/MVMCoreUI/Legacy/Views/LabelView.m b/MVMCoreUI/Legacy/Views/LabelView.m index d13ff39a..0bb98bd6 100644 --- a/MVMCoreUI/Legacy/Views/LabelView.m +++ b/MVMCoreUI/Legacy/Views/LabelView.m @@ -9,6 +9,7 @@ #import #import "MFStyler.h" #import + @interface LabelView () // Sets up the view. @@ -36,11 +37,6 @@ } } -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - [super setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; - [self.label setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; -} - - (void)alignLeft { [super alignLeft]; self.label.textAlignment = NSTextAlignmentLeft; diff --git a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift b/MVMCoreUI/Legacy/Views/LabelWithInternalButton.swift similarity index 92% rename from MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift rename to MVMCoreUI/Legacy/Views/LabelWithInternalButton.swift index 251f5b45..13a16a33 100644 --- a/MVMCoreUI/Atoms/Views/LabelWithInternalButton.swift +++ b/MVMCoreUI/Legacy/Views/LabelWithInternalButton.swift @@ -15,7 +15,7 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt @available(*, deprecated, message: "Use Label instead.") -@objcMembers open class LabelWithInternalButton: UIControl, MVMCoreViewProtocol, MFButtonProtocol, MVMCoreUIMoleculeViewProtocol { +@objcMembers open class LabelWithInternalButton: UIControl, MVMCoreViewProtocol, MFButtonProtocol, MoleculeViewProtocol { //------------------------------------------------------ // MARK: - Properties //------------------------------------------------------ @@ -585,59 +585,4 @@ public typealias CoreObjectActionLoadPresentDelegate = MVMCoreActionDelegateProt } setLabelAttributes() } - - //------------------------------------------------------ - // MARK: - Atomization - //------------------------------------------------------ - - // Default values for view. - @objc open func setAsMolecule() { - - } - - @objc open func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { - // Configure class properties with JSON values - guard let dictionary = json else { return } - - if let backgroundColorHex = dictionary[KeyBackgroundColor] as? String { - self.backgroundColor = UIColor.mfGet(forHex: backgroundColorHex) - } - - if let normalTextFont = dictionary["normalTextFont"] as? String, let normalSize = dictionary["normalSize"] as? CGFloat { - self.normalTextFont = UIFont(name: normalTextFont, size: normalSize) - } - - if let actionTextFont = dictionary["actionTextFont"] as? String, let actionSize = dictionary["actionSize"] as? CGFloat { - self.actionTextFont = UIFont(name: actionTextFont, size: actionSize) - } - - if let normalTextColorHex = dictionary["normalTextColor"] as? String { - self.normalTextColor = UIColor.mfGet(forHex: normalTextColorHex) - } - - if let actionTextColorHex = dictionary["actionTextColor"] as? String { - self.actionTextColor = UIColor.mfGet(forHex: actionTextColorHex) - } - - if let makeWholeViewClickable = dictionary["makeWholeViewClickable"] as? Bool { - self.makeWholeViewClickable = makeWholeViewClickable - } - - if let frontText = dictionary["frontText"] as? String { - self.frontText = frontText - } - - if let backText = dictionary["backText"] as? String { - self.backText = backText - } - - if let actionText = dictionary["actionText"] as? String { - self.actionText = actionText - } - - // Want this to be last because it has a willSet feature. - if let text = dictionary["text"] as? String { - self.text = text - } - } } diff --git a/MVMCoreUI/Legacy/Views/MFCustomButton.h b/MVMCoreUI/Legacy/Views/MFCustomButton.h index 9d08883d..c43f87bc 100644 --- a/MVMCoreUI/Legacy/Views/MFCustomButton.h +++ b/MVMCoreUI/Legacy/Views/MFCustomButton.h @@ -10,7 +10,6 @@ @import MVMCore.MVMCoreActionDelegateProtocol; #import #import -#import @class DelegateObject; typedef void (^ButtonTapBlock)(id _Nonnull sender); diff --git a/MVMCoreUI/Legacy/Views/MFDigitTextField.m b/MVMCoreUI/Legacy/Views/MFDigitTextField.m index 5f76e88b..931707f3 100644 --- a/MVMCoreUI/Legacy/Views/MFDigitTextField.m +++ b/MVMCoreUI/Legacy/Views/MFDigitTextField.m @@ -19,6 +19,7 @@ #import "MVMCoreUIUtility.h" #import "MVMCoreUIConstants.h" #import + @import MVMCore.MVMCoreDispatchUtility; @interface MFDigitTextField () @@ -145,22 +146,6 @@ [self alignCenterHorizontal]; } -#pragma mark - Molecule - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - NSNumber *digitsNumber = [json optionalNumberForKey:@"digits"]; - NSUInteger digits = digitsNumber ? digitsNumber.integerValue : 4; - if (digits != self.numberOfDigits) { - self.numberOfDigits = digits; - [self buildTextFieldsViewForSize:[MVMCoreUIUtility getWidth]]; - } - [super setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; -} - -+ (CGFloat)estimatedHeightForRow:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject { - return 44; -} - #pragma mark - Getters - (NSString *)placeholder { diff --git a/MVMCoreUI/Legacy/Views/MFTextButton.h b/MVMCoreUI/Legacy/Views/MFTextButton.h index 1e81e1f0..6240adb4 100644 --- a/MVMCoreUI/Legacy/Views/MFTextButton.h +++ b/MVMCoreUI/Legacy/Views/MFTextButton.h @@ -10,7 +10,7 @@ #import @class MFSizeObject; -@interface MFTextButton : MFCustomButton +@interface MFTextButton : MFCustomButton @property (nonnull, strong, nonatomic) MFSizeObject *sizeObject; diff --git a/MVMCoreUI/Legacy/Views/MFTextButton.m b/MVMCoreUI/Legacy/Views/MFTextButton.m index a0ee6ca7..31b3a4ee 100644 --- a/MVMCoreUI/Legacy/Views/MFTextButton.m +++ b/MVMCoreUI/Legacy/Views/MFTextButton.m @@ -127,29 +127,6 @@ return theButton; } -#pragma mark - MVMCoreUIMoleculeViewProtocol - -- (void)reset { - [self setTitleColor:[UIColor mfTextButtonColor] forState:UIControlStateNormal]; -} - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - NSString *color = [json string:KeyTextColor]; - if (color) { - [self setTitleColor:[UIColor mfGetColorForHex:color] forState:UIControlStateNormal]; - } - [self setWithActionMap:json delegateObject:delegateObject additionalData:additionalData]; - if ([self titleForState:UIControlStateNormal].length == 0) { - self.heightConstraint.constant = 0; - } else { - self.heightConstraint.constant = self.sizeObject.standardSize; - } -} - -+ (CGFloat)estimatedHeightForRow:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject { - return 31; -} - #pragma mark - MVMCoreUIViewConstrainingProtocol - (BOOL)needsToBeConstrained { diff --git a/MVMCoreUI/Legacy/Views/MFTextField.h b/MVMCoreUI/Legacy/Views/MFTextField.h index aa3ab573..323c59fd 100644 --- a/MVMCoreUI/Legacy/Views/MFTextField.h +++ b/MVMCoreUI/Legacy/Views/MFTextField.h @@ -28,7 +28,7 @@ @end -@interface MFTextField : ViewConstrainingView +@interface MFTextField : ViewConstrainingView @property (nullable, weak, nonatomic) UIView *view; diff --git a/MVMCoreUI/Legacy/Views/MFTextField.m b/MVMCoreUI/Legacy/Views/MFTextField.m index 081f9fe8..da6dcaa3 100644 --- a/MVMCoreUI/Legacy/Views/MFTextField.m +++ b/MVMCoreUI/Legacy/Views/MFTextField.m @@ -555,19 +555,4 @@ } } -#pragma mark - MVMCoreUIMoleculeViewProtocol - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - [super setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; - if ([delegateObject isKindOfClass:[MVMCoreUIDelegateObject class]]) { - [self setWithMap:json]; - self.uiTextFieldDelegate = delegateObject.uiTextFieldDelegate; - [MVMCoreUICommonViewsUtility addDismissToolbar:self.textField delegate:self.uiTextFieldDelegate]; - } -} - - -+ (CGFloat)estimatedHeightForRow:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject { - return 76; -} @end diff --git a/MVMCoreUI/Legacy/Views/MFView.h b/MVMCoreUI/Legacy/Views/MFView.h index dd8e01a8..ab179d57 100644 --- a/MVMCoreUI/Legacy/Views/MFView.h +++ b/MVMCoreUI/Legacy/Views/MFView.h @@ -7,14 +7,10 @@ // #import -#import #import @import MVMCore.MVMCoreViewProtocol; -@interface MFView : UIView - -@property (nullable, nonatomic, strong) NSDictionary *json; -@property (nullable, nonatomic, strong) id model; +@interface MFView : UIView // Called in the initialization functions. Can setup ui here. - (void)setupView; diff --git a/MVMCoreUI/Legacy/Views/MFView.m b/MVMCoreUI/Legacy/Views/MFView.m index 6d939fc8..a01d1ca7 100644 --- a/MVMCoreUI/Legacy/Views/MFView.m +++ b/MVMCoreUI/Legacy/Views/MFView.m @@ -44,24 +44,4 @@ - (void)updateView:(CGFloat)size { } -#pragma mark - MVMCoreUIMoleculeViewProtocol - -- (void)setAsMolecule { - self.translatesAutoresizingMaskIntoConstraints = NO; - self.insetsLayoutMarginsFromSafeArea = NO; -} - -- (void)reset { - self.backgroundColor = [UIColor clearColor]; -} - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - self.json = json; - - NSString *colorString = [json string:KeyBackgroundColor]; - if (colorString) { - self.backgroundColor = [UIColor mfGetColorForHex:colorString]; - } -} - @end diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.h b/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.h index f1638f6a..ba7bf4cc 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.h +++ b/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.h @@ -12,7 +12,7 @@ @class Label; @class MFSizeObject; -@interface MVMCoreUICheckBox : UIControl +@interface MVMCoreUICheckBox : UIControl @property (nullable, weak, nonatomic) MVMCoreUICheckMarkView *checkMark; @property (readonly, nonatomic) BOOL isSelected; diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.m b/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.m index 4c6bf8a5..8e0afcd0 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.m +++ b/MVMCoreUI/Legacy/Views/MVMCoreUICheckBox.m @@ -21,7 +21,7 @@ static const CGFloat FaultTolerance = 20.f; static const CGFloat CheckBoxHeightWidth = 18.0; -@interface MVMCoreUICheckBox () +@interface MVMCoreUICheckBox () @property (nonatomic, readwrite) BOOL isSelected; @property (weak, nonatomic) UIView *checkedSquare; @@ -42,13 +42,12 @@ static const CGFloat CheckBoxHeightWidth = 18.0; @property (nonatomic) BOOL isRequired; @property (nullable, strong, nonatomic) NSString *fieldKey; -@property (nullable, strong, nonatomic) MVMCoreUIDelegateObject *delegateObject; @end @implementation MVMCoreUICheckBox -#pragma mark - MVMCoreUIMoleculeViewProtocol +#pragma mark - Constraining protocol - (BOOL)needsToBeConstrained { return YES; @@ -58,29 +57,6 @@ static const CGFloat CheckBoxHeightWidth = 18.0; return UIStackViewAlignmentLeading; } -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - - self.delegateObject = delegateObject; - self.fieldKey = [json stringForKey:KeyFieldKey]; - self.isRequired = [json boolForKey:KeyRequired]; - - NSString *checkedColorHex = [json string:@"checkedColor"]; - NSString *unCheckedColorHex = [json string:@"unCheckedColor"]; - - UIColor *checkedColor = checkedColorHex ? [UIColor mfGetColorForHex:checkedColorHex]: [UIColor clearColor]; - UIColor *unCheckedColor = unCheckedColorHex ? [UIColor mfGetColorForHex:unCheckedColorHex]: [UIColor clearColor]; - - [self setupWithCheckedColor:checkedColor - unCheckColor:unCheckedColor - label:[json dict:KeyLabel] - delegateObject:delegateObject - additionalData: additionalData]; -} - -+ (CGFloat)estimatedHeightForRow:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject { - return CheckBoxHeightWidth; -} - #pragma mark - convenient class methods + (instancetype)mfCheckBox { @@ -269,11 +245,6 @@ static const CGFloat CheckBoxHeightWidth = 18.0; [self setDescriptionText:text]; } -- (void)setupWithCheckedColor:(UIColor *)checkedColor unCheckColor:(UIColor *)unCheckedColor label:(NSDictionary *)labelJson delegateObject:(DelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - [self setupWithCheckedColor:checkedColor unCheckColor:unCheckedColor]; - [self.descriptionLabel setWithJSON:labelJson delegateObject:delegateObject additionalData:additionalData]; -} - - (void)updateView:(CGFloat)size { [MVMCoreDispatchUtility performBlockOnMainThread:^{ [self.descriptionLabel updateView:size]; @@ -330,8 +301,6 @@ static const CGFloat CheckBoxHeightWidth = 18.0; } completion:nil]; [self.checkMark updateCheckSelected:NO animated:animated]; } - -// [FormValidator enableByValidationWithDelegate:self.delegateObject.formValidationProtocol]; } - (void)setColor:(nullable UIColor *)color forState:(UIControlState)state { diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUIMoleculeViewProtocol.h b/MVMCoreUI/Legacy/Views/MVMCoreUIMoleculeViewProtocol.h deleted file mode 100644 index f11a5002..00000000 --- a/MVMCoreUI/Legacy/Views/MVMCoreUIMoleculeViewProtocol.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// MVMCoreUIMoleculeViewProtocol.h -// MVMCoreUI -// -// Created by Scott Pfeil on 2/11/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -#import -@import MVMCore.MVMCoreViewProtocol; -@class MVMCoreUIDelegateObject; -@class MVMCoreErrorObject; -@class MoleculeModelProtocol; - -@protocol MVMCoreUIMoleculeViewProtocol - -@optional - -/// Sets up the ui based on the json -- (void)setWithJSON:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject additionalData:(nullable NSDictionary *)additionalData; - -/// Called after init to provide an early setter for any molecule specific logic -- (void)setAsMolecule; - -/// Resets to default state before set with json is called again. -- (void)reset; - -/// For the molecule list to load more efficiently. -+ (CGFloat)estimatedHeightForRow:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject; - -/// Allows the molecule to set its name for reuse. Default could be moleculeName. -+ (nullable NSString *)nameForReuse:(nullable NSDictionary *)molecule delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject; - -/// Can return the required modules -+ (nullable NSArray *)requiredModules:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject error:(MVMCoreErrorObject *_Nullable *_Nullable)error; - -@end - - diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h index e86d3f9e..ba71bd70 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h +++ b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.h @@ -8,10 +8,9 @@ #import #import -#import #import -@interface MVMCoreUIPageControl : UIControl +@interface MVMCoreUIPageControl : UIControl // These properties effectively do what their corresponding namesakes do in UIPageControl @property (nonatomic) NSInteger currentPage; diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m index f2b9976e..feef75ab 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m +++ b/MVMCoreUI/Legacy/Views/MVMCoreUIPageControl.m @@ -311,25 +311,6 @@ static CGFloat const IndicatorRectangleHeight = 4; self.currentPage = page; } -#pragma mark - MVMCoreUIMoleculeViewProtocol - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - NSString *colorString = [json string:KeyBackgroundColor]; - if (colorString) { - self.backgroundColor = [UIColor mfGetColorForHex:colorString]; - } - colorString = [json string:@"barsColor"]; - if (colorString) { - UIColor *color = [UIColor mfGetColorForHex:colorString]; - self.pageIndicatorTintColor = color; - self.currentPageIndicatorTintColor = color; - } - colorString = [json string:@"currentBarColor"]; - if (colorString) { - self.currentPageIndicatorTintColor = [UIColor mfGetColorForHex:colorString]; - } -} - #pragma mark - Accessibility - (UIAccessibilityTraits)accessibilityTraits { return UIAccessibilityTraitAdjustable; diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.h b/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.h index 256aabfa..91444466 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.h +++ b/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.h @@ -8,12 +8,11 @@ #import -#import #import @import MVMCore.MVMCoreViewProtocol; typedef void(^ValueChangeBlock)(void); -@interface MVMCoreUISwitch : UIControl +@interface MVMCoreUISwitch : UIControl @property (assign, nonatomic, getter=isOn) BOOL on; @property (nullable, strong, nonatomic) UIColor *onTintColor; diff --git a/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.m b/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.m index 8cbb434d..4a7125fe 100644 --- a/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.m +++ b/MVMCoreUI/Legacy/Views/MVMCoreUISwitch.m @@ -38,9 +38,6 @@ const CGFloat SwitchShakeIntensity = 2; @property (nonatomic) BOOL canChangeValue; -@property (strong, nonatomic, nullable) NSDictionary *json; -@property (nullable, strong, nonatomic) DelegateObject *delegate; - @end @implementation MVMCoreUISwitch @@ -141,51 +138,13 @@ const CGFloat SwitchShakeIntensity = 2; } } -#pragma mark - MVMCoreUIMoleculeViewProtocol - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - self.json = json; - self.delegate = delegateObject; - - NSString *color = [json string:@"onTintColor"]; - if (color) { - self.onTintColor = [UIColor mfGetColorForHex:color]; - } - - color = [json string:@"offTintColor"]; - if (color) { - self.offTintColor = [UIColor mfGetColorForHex:color]; - } - - color = [json string:@"onKnobTintColor"]; - if (color) { - self.onKnobTintColor = [UIColor mfGetColorForHex:color]; - } - - color = [json string:@"offKnobTintColor"]; - if (color) { - self.offKnobTintColor = [UIColor mfGetColorForHex:color]; - } - - [self setState:[json boolForKey:@"state"] animated:false]; - - NSDictionary *actionMap = [json dict:@"action"]; - if (actionMap) { - [self addTarget:self action:@selector(addCustomAction) forControlEvents:UIControlEventTouchUpInside]; - } -} - - (void)addCustomAction { if (self.actionBlock) { self.actionBlock(); } } -+ (CGFloat)estimatedHeightForRow:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject { - return [self getSwitchHeight]; -} - -#pragma mark - MVMCoreUIMoleculeViewProtocol +#pragma mark - Constraining Protocol - (BOOL)needsToBeConstrained { return YES; @@ -338,10 +297,6 @@ const CGFloat SwitchShakeIntensity = 2; if (self.valueChangedBlock) { self.valueChangedBlock(); } -// if (self.delegate && [self.delegate respondsToSelector:@selector(formValidationProtocol)] && [[self.delegate performSelector:@selector(formValidationProtocol)] respondsToSelector:@selector(formValidatorModel)]) { -// FormValidator *formValidator = [[self.delegate performSelector:@selector(formValidationProtocol)] performSelector:@selector(formValidatorModel)]; -// [formValidator enableByValidation]; -// } } - (void)setState:(BOOL)state withoutBlockAnimated:(BOOL)animated { diff --git a/MVMCoreUI/Legacy/Views/PrimaryButton.h b/MVMCoreUI/Legacy/Views/PrimaryButton.h index e83484a0..511519be 100644 --- a/MVMCoreUI/Legacy/Views/PrimaryButton.h +++ b/MVMCoreUI/Legacy/Views/PrimaryButton.h @@ -10,7 +10,6 @@ #import #import #import -#import typedef enum : NSUInteger { PrimaryButtonTypeRed, @@ -26,7 +25,7 @@ typedef enum : NSUInteger { static CGFloat const PrimaryButtonHeight = 42.0; static CGFloat const PrimaryButtonSmallHeight = 30.0; -@interface PrimaryButton : MFCustomButton +@interface PrimaryButton : MFCustomButton @property (nonatomic, readonly, assign) PrimaryButtonType primaryButtonType; //use reset function to set diff --git a/MVMCoreUI/Legacy/Views/PrimaryButton.m b/MVMCoreUI/Legacy/Views/PrimaryButton.m index 0e16ce8e..7a235fce 100644 --- a/MVMCoreUI/Legacy/Views/PrimaryButton.m +++ b/MVMCoreUI/Legacy/Views/PrimaryButton.m @@ -499,6 +499,25 @@ [self setTitleColor:[self titleColorForState:UIControlStateNormal] forState:UIControlStateHighlighted]; } +- (void)setAsStandardCustom { + // Default to standard look. + self.primaryButtonType = PrimaryButtonTypeCustom; + self.fillColor = [UIColor blackColor]; + self.textColor = [UIColor whiteColor]; + self.disabledTextColor = self.textColor; + self.borderColor = nil; + _bordered = false; +} + +- (void)setAsSecondaryCustom { + // Default to standard look. + self.primaryButtonType = PrimaryButtonTypeCustom; + self.fillColor = nil; + self.textColor = nil; + self.borderColor = [UIColor blackColor]; + _bordered = true; +} + - (void)setBordered:(BOOL)bordered { if (bordered != _bordered) { if (self.primaryButtonType == PrimaryButtonTypeCustom) { @@ -636,81 +655,7 @@ return button; } -#pragma mark - Molecule protocol - -- (void)reset { - [self setAsStandardCustom]; -} - -- (void)setAsStandardCustom { - // Default to standard look. - self.primaryButtonType = PrimaryButtonTypeCustom; - self.fillColor = [UIColor blackColor]; - self.textColor = [UIColor whiteColor]; - self.disabledTextColor = self.textColor; - self.borderColor = nil; - _bordered = false; -} - -- (void)setAsSecondaryCustom { - // Default to standard look. - self.primaryButtonType = PrimaryButtonTypeCustom; - self.fillColor = nil; - self.textColor = nil; - self.borderColor = [UIColor blackColor]; - _bordered = true; -} - -- (void)setAsMolecule { - self.translatesAutoresizingMaskIntoConstraints = false; - [self pinHeight]; - [self setAsStandardCustom]; -} - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - - self.validationRequired = [json boolForKey:@"required"]; - self.requiredGroupsList = [json array:@"requiredGroups"]; - - self.primaryButtonType = PrimaryButtonTypeCustom; - NSString *style = [json string:@"style"]; - if ([style isEqualToString:@"primary"]) { - [self setAsStandardCustom]; - } else if ([style isEqualToString:@"secondary"]) { - [self setAsSecondaryCustom]; - } - - NSString *color = [json string:@"fillColor"]; - if (color) { - self.fillColor = [UIColor mfGetColorForHex:color]; - } - if ((color = [json string:KeyTextColor])) { - self.textColor = [UIColor mfGetColorForHex:color]; - } - if ((color = [json string:@"borderColor"])) { - self.borderColor = [UIColor mfGetColorForHex:color]; - } - _bordered = self.borderColor != nil; - if ((color = [json string:@"disabledFillColor"])) { - self.disabledFillColor = [UIColor mfGetColorForHex:color]; - } - if ((color = [json string:@"disabledTextColor"])) { - self.disabledTextColor = [UIColor mfGetColorForHex:color]; - } - if ((color = [json string:@"disabledBorderColor"])) { - self.disabledBorderColor = [UIColor mfGetColorForHex:color]; - } - - NSString *size = [json string:@"size"]; - if ([size isEqualToString:@"small"]) { - [self setAsSmallButton:YES]; - } else if ([size isEqualToString:@"tiny"]) { - [self setAsTiny:YES]; - } else { - [self setAsSmallButton:NO]; - } - [self setWithActionMap:json delegateObject:delegateObject additionalData:additionalData]; -} +#pragma mark - Constraining Protocol - (UIStackViewAlignment)horizontalAlignment { return UIStackViewAlignmentCenter; diff --git a/MVMCoreUI/Legacy/Views/PrimaryButtonView.m b/MVMCoreUI/Legacy/Views/PrimaryButtonView.m index 8c76353c..2855359a 100644 --- a/MVMCoreUI/Legacy/Views/PrimaryButtonView.m +++ b/MVMCoreUI/Legacy/Views/PrimaryButtonView.m @@ -19,9 +19,6 @@ @interface PrimaryButtonView () @property (weak, nonatomic) UIView *twoButtonView; -@property (weak, nonatomic) NSLayoutConstraint *alignCenterPin; -@property (weak, nonatomic) NSLayoutConstraint *alignCenterLeftPin; -@property (weak, nonatomic) NSLayoutConstraint *alignCenterRightPin; @property (weak, nonatomic) NSLayoutConstraint *height; @property (nonatomic, strong) NSArray *horizontalConstraints; @@ -38,21 +35,6 @@ }]; } -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - [super setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; - NSString *backgroundColorString = [json string:@"backgroundColor"]; - if (backgroundColorString) { - self.backgroundColor = [UIColor mfGetColorForHex:backgroundColorString]; - } - NSDictionary *primaryButtonMap = [json dict:@"primaryButton"]; - NSDictionary *secondaryButtonMap = [json dict:@"secondaryButton"]; - [self setupUIWithPrimaryButtonMap:primaryButtonMap secondaryButtonMap:secondaryButtonMap]; - [self.primaryButton setAsStandardCustom]; - [self.secondaryButton setAsSecondaryCustom]; - [self.primaryButton setWithJSON:primaryButtonMap delegateObject:delegateObject additionalData:additionalData]; - [self.secondaryButton setWithJSON:secondaryButtonMap delegateObject:delegateObject additionalData:additionalData]; -} - #pragma mark - Inits - (instancetype)init { diff --git a/MVMCoreUI/Legacy/Views/SeparatorView.m b/MVMCoreUI/Legacy/Views/SeparatorView.m index 9f85c311..0a86559d 100644 --- a/MVMCoreUI/Legacy/Views/SeparatorView.m +++ b/MVMCoreUI/Legacy/Views/SeparatorView.m @@ -95,32 +95,6 @@ } } -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - [super setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; - if (json) { - NSString *type = [json string:KeyType]; - if ([type isEqualToString:@"none"]) { - self.hidden = YES; - } else { - self.hidden = NO; - if ([type isEqualToString:@"medium"]) { - [self setAsMedium]; - } else if ([type isEqualToString:@"heavy"]) { - [self setAsHeavy]; - } else if ([type isEqualToString:@"standard"]) { - [self setAsLight]; - } - } - } else { - self.hidden = YES; - } - - NSString *colorString = [json string:KeyBackgroundColor]; - if (colorString) { - self.backgroundColor = [UIColor mfGetColorForHex:colorString]; - } -} - #pragma mark - helper - (void)hide { @@ -162,17 +136,9 @@ [self setNeedsLayout]; [self layoutIfNeeded]; } - -- (BOOL)shouldBeVisible { - return ![[self.json string:KeyType] isEqualToString:@"none"]; -} -#pragma mark - Molecule +#pragma mark - Constraining Protocol -- (void)reset { - [self setAsLight]; -} - - (BOOL)needsToBeConstrained { return YES; } @@ -181,19 +147,4 @@ return NO; } -+ (CGFloat)estimatedHeightForRow:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject { - NSString *type = [json string:KeyType]; - if ([type isEqualToString:@"none"]) { - return 0; - } else { - if ([type isEqualToString:@"medium"]) { - return 2; - } else if ([type isEqualToString:@"heavy"]) { - return 4; - } else { - return 1; - } - } -} - @end diff --git a/MVMCoreUI/Legacy/Views/ViewConstrainingView.h b/MVMCoreUI/Legacy/Views/ViewConstrainingView.h index 30f5a552..7ba4fd21 100644 --- a/MVMCoreUI/Legacy/Views/ViewConstrainingView.h +++ b/MVMCoreUI/Legacy/Views/ViewConstrainingView.h @@ -39,9 +39,6 @@ @property (nonatomic) CGFloat topMarginPadding; @property (nonatomic) CGFloat bottomMarginPadding; -/// A molecule if we constrain one. -@property (weak, nullable, nonatomic) UIView *molecule; - /// A flag for if we should add a molecule from json. @property (nonatomic) BOOL shouldSetupMoleculeFromJSON; @@ -51,9 +48,6 @@ // Returns a view with the provided view as a subview, pinned. + (nonnull ViewConstrainingView *)viewConstrainingView:(nonnull UIView *)view; -// Can be initialized with a molecule to constrain -- (nonnull instancetype)initWithMolecule:(nonnull UIView *)molecule alignment:(UIStackViewAlignment)alignment; - #pragma mark - Constraining // Use these to sets the constants, because subclasses may align differently. @@ -78,9 +72,6 @@ // Add a view to be constrained in this view. - (void)addConstrainedView:(nonnull UIView *)view; -/// Can override to change how the molecule is added when shouldSetupMoleculeFromJSON = true. Inserts the molecule at 0 and calls pinToSuperView. -- (void)addMolecule:(nonnull UIView *)molecule; - // Change the alignment of the label - (void)alignLeft; - (void)alignCenterHorizontal; @@ -97,7 +88,4 @@ /// Convenience function for getting the alignment from a map. + (UIStackViewAlignment)getAlignmentForString:(nullable NSString *)alignmentString defaultAlignment:(UIStackViewAlignment)defaultAlignment; -/// Makes the view isAccessibilityElement false and adds molecule elements to accessbilityElements. -- (void)setMoleculeAccessibility; - @end diff --git a/MVMCoreUI/Legacy/Views/ViewConstrainingView.m b/MVMCoreUI/Legacy/Views/ViewConstrainingView.m index b98e72a5..8d36f351 100644 --- a/MVMCoreUI/Legacy/Views/ViewConstrainingView.m +++ b/MVMCoreUI/Legacy/Views/ViewConstrainingView.m @@ -13,7 +13,6 @@ #import "NSLayoutConstraint+MFConvenience.h" #import "MFStyler.h" #import "MVMCoreUIConstants.h" -#import "MVMCoreUIMoleculeMappingObject.h" #import "MVMCoreUIUtility.h" #import "MVMCoreUIViewConstrainingProtocol.h" @@ -22,18 +21,6 @@ @implementation ViewConstrainingView -- (nonnull instancetype)initWithMolecule:(nonnull UIView *)molecule alignment:(UIStackViewAlignment)alignment { - if (self = [super init]) { - if (!molecule.superview) { - [self addConstrainedView:molecule alignment:alignment]; - [self setAsMolecule]; - } - self.molecule = molecule; - [self setMoleculeAccessibility]; - } - return self; -} - + (nonnull ViewConstrainingView *)emptyView { ViewConstrainingView *view = [[ViewConstrainingView alloc] initWithFrame:CGRectZero]; view.translatesAutoresizingMaskIntoConstraints = NO; @@ -240,11 +227,6 @@ } } -- (void)addMolecule:(nonnull UIView *)molecule { - [self insertSubview:molecule atIndex:0]; - [self pinViewToSuperView:molecule]; -} - #pragma mark - MVMCoreUIViewConstrainingProtocol - (void)alignHorizontal:(UIStackViewAlignment)alignment { @@ -285,114 +267,27 @@ } } -- (void)shouldSetHorizontalMargins:(BOOL)shouldSet { - if (![self.json optionalNumberForKey:@"useHorizontalMargins"]) { - self.updateViewHorizontalDefaults = shouldSet; - } -} - -- (void)shouldSetVerticalMargins:(BOOL)shouldSet { - if (![self.json optionalNumberForKey:@"useVerticalMargins"]) { - self.updateViewVerticalDefaults = shouldSet; - } -} - #pragma mark - MVMCoreViewProtocol - (void)setupView { [super setupView]; self.translatesAutoresizingMaskIntoConstraints = NO; self.backgroundColor = [UIColor clearColor]; - self.topMarginPadding = PaddingDefaultVerticalSpacing3; - self.bottomMarginPadding = PaddingDefaultVerticalSpacing3; - [MVMCoreUIUtility setMarginsForView:self leading:0 top:0 trailing:0 bottom:0]; } - (void)updateView:(CGFloat)size { [super updateView:size]; - [self.molecule updateView:size]; - [MFStyler setMarginsForView:self size:size defaultHorizontal:self.updateViewHorizontalDefaults top:(self.updateViewVerticalDefaults ? self.topMarginPadding : 0) bottom:(self.updateViewVerticalDefaults ? self.bottomMarginPadding : 0)]; - UIEdgeInsets margins = [MVMCoreUIUtility getMarginsForView:self]; + if ([self.constrainedView respondsToSelector:@selector(updateView:)]) { + [((id)self.constrainedView) updateView:size]; + } if (self.updateViewHorizontalDefaults) { - [self setLeftPinConstant:margins.left]; - [self setRightPinConstant:margins.right]; + CGFloat padding = [MFStyler defaultHorizontalPaddingForSize:size]; + [self setLeftPinConstant:padding]; + [self setRightPinConstant:padding]; } if (self.updateViewVerticalDefaults) { - [self setTopPinConstant:margins.top]; - [self setBottomPinConstant:margins.bottom]; - } -} - -#pragma mark - MVMCoreUIMoleculeViewProtocol - -- (void)setMoleculeAccessibility { - if (self.molecule) { - self.isAccessibilityElement = NO; - if (self.molecule.accessibilityElements) { - self.accessibilityElements = self.molecule.accessibilityElements; - } else { - self.accessibilityElements = @[self.molecule]; - } - } -} - -- (void)reset { - [super reset]; - self.updateViewHorizontalDefaults = NO; - self.updateViewVerticalDefaults = NO; - self.topMarginPadding = PaddingDefaultVerticalSpacing3; - self.bottomMarginPadding = PaddingDefaultVerticalSpacing3; - if ([self.molecule respondsToSelector:@selector(horizontalAlignment)]) { - [self alignHorizontal:[(UIView *)self.molecule horizontalAlignment]]; - } - [self alignVertical:UIStackViewAlignmentFill]; - if ([self.molecule respondsToSelector:@selector(reset)]) { - [self.molecule performSelector:@selector(reset)]; - } -} - -- (void)setWithJSON:(NSDictionary *)json delegateObject:(MVMCoreUIDelegateObject *)delegateObject additionalData:(NSDictionary *)additionalData { - // Only treated as a container if we are constraining a molecule. - if (!self.constrainedView) { - [super setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; - } - if (self.shouldSetupMoleculeFromJSON) { - NSDictionary *moleculeJSON = [json dict:KeyMolecule]; - if (self.molecule) { - [self.molecule setWithJSON:moleculeJSON delegateObject:delegateObject additionalData:additionalData]; - } else if (moleculeJSON) { - UIView *molecule = [[MVMCoreUIMoleculeMappingObject sharedMappingObject] createMoleculeForJSON:moleculeJSON delegateObject:delegateObject constrainIfNeeded:true]; - if (molecule) { - [self addMolecule:molecule]; - } - self.molecule = molecule; - [self setMoleculeAccessibility]; - } - } else { - [self.molecule setWithJSON:json delegateObject:delegateObject additionalData:additionalData]; - } - - NSNumber *useHorizontalMargins = [json optionalNumberForKey:@"useHorizontalMargins"]; - if (useHorizontalMargins) { - self.updateViewHorizontalDefaults = [useHorizontalMargins boolValue]; - } - NSNumber *useVerticalMargins = [json optionalNumberForKey:@"useVerticalMargins"]; - if (useVerticalMargins) { - self.updateViewVerticalDefaults = [useVerticalMargins boolValue]; - } - - // Set the alignment for the stack in the containing view. The json driven value is for the axis direction alignment. - NSString *alignment = [json string:@"horizontalAlignment"]; - if (alignment) { - [self alignHorizontal:[ViewConstrainingView getAlignmentForString:alignment defaultAlignment:UIStackViewAlignmentFill]]; - } - alignment = [json string:@"verticalAlignment"]; - if (alignment) { - [self alignVertical:[ViewConstrainingView getAlignmentForString:alignment defaultAlignment:UIStackViewAlignmentFill]]; - } - - if ([self.molecule respondsToSelector:@selector(copyBackgroundColor)] && [self.molecule performSelector:@selector(copyBackgroundColor)]) { - self.backgroundColor = self.molecule.backgroundColor; + [self setTopPinConstant:self.topMarginPadding]; + [self setBottomPinConstant:self.bottomMarginPadding]; } } diff --git a/MVMCoreUI/MVMCoreUI.h b/MVMCoreUI/MVMCoreUI.h index 22707550..4075a110 100644 --- a/MVMCoreUI/MVMCoreUI.h +++ b/MVMCoreUI/MVMCoreUI.h @@ -20,7 +20,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[]; #import #import #import -#import #pragma mark - TopAlert #import @@ -106,7 +105,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[]; #pragma mark - Molecules #import -#import #import #import diff --git a/MVMCoreUI/Models/ModelProtocols/PageModelProtocol.swift b/MVMCoreUI/Models/ModelProtocols/PageModelProtocol.swift index 7f50873e..c201104a 100644 --- a/MVMCoreUI/Models/ModelProtocols/PageModelProtocol.swift +++ b/MVMCoreUI/Models/ModelProtocols/PageModelProtocol.swift @@ -8,10 +8,8 @@ import Foundation - public protocol PageModelProtocol { var pageType: String { get set } var screenHeading: String? { get set } - var isAtomicTabs: Bool? { get set } var navigationItem: NavigationItemModelProtocol? { get set } } diff --git a/MVMCoreUI/Molecules/FooterView.swift b/MVMCoreUI/Molecules/FooterView.swift deleted file mode 100644 index b9113d1d..00000000 --- a/MVMCoreUI/Molecules/FooterView.swift +++ /dev/null @@ -1,18 +0,0 @@ -// -// FooterView.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 3/11/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import UIKit - -open class FooterView: MoleculeContainer { - public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { - if let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), let height = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON)?.estimatedHeight?(forRow: moleculeJSON, delegateObject: delegateObject) { - return height + PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing - } - return 42 - } -} diff --git a/MVMCoreUI/Molecules/MoleculeViewProtocol.swift b/MVMCoreUI/Molecules/MoleculeViewProtocol.swift deleted file mode 100644 index 63fff68c..00000000 --- a/MVMCoreUI/Molecules/MoleculeViewProtocol.swift +++ /dev/null @@ -1,37 +0,0 @@ -// -// MVMCoreUIMoleculeViewProtocol1.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 10/24/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -import UIKit -import MVMCore.MVMCoreViewProtocol - -@objc public protocol MoleculeViewProtocol: MVMCoreViewProtocol { - - /// Sets up the ui based on the json - @objc func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) - - /// Called after init to provide an early setter for any molecule specific logic - @objc optional func setAsMolecule() - - - /// Resets to default state before set with json is called again. - @objc optional func reset() - - - /// For the molecule list to load more efficiently. - @objc optional static func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat - - - /// Allows the molecule to set its name for reuse. Default could be moleculeName. - @objc optional static func name(forReuse molecule: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> String? - - - /// Can return the required modules - @objc optional static func requiredModules(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer?) -> [String]? -} diff --git a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift b/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift deleted file mode 100644 index 439e3aec..00000000 --- a/MVMCoreUI/Molecules/VerticalCombinationViews/HeadlineBodyButtonModel.swift +++ /dev/null @@ -1,19 +0,0 @@ -// -// HeadlineBodyButtonModel.swift -// MVMCoreUI -// -// Created by Scott Pfeil on 1/22/20. -// Copyright © 2020 Verizon Wireless. All rights reserved. -// - -import Foundation - -public struct HeadlineBodyButtonModel: MoleculeModelProtocol { - public static var identifier: String = "headlineBodyButton" - public var moleculeName: String = HeadlineBodyButtonModel.identifier - public var backgroundColor: Color? - - public var headlineBody: HeadlineBodyModel - public var button: ButtonModel - public var buttonHeadlinePadding: CGFloat -} diff --git a/MVMCoreUI/OtherHandlers/CoreUIObject.swift b/MVMCoreUI/OtherHandlers/CoreUIObject.swift index d60cdd6a..3553b54b 100644 --- a/MVMCoreUI/OtherHandlers/CoreUIObject.swift +++ b/MVMCoreUI/OtherHandlers/CoreUIObject.swift @@ -9,7 +9,7 @@ import UIKit @objcMembers open class CoreUIObject: MVMCoreObject { - public var moleculeMap: MVMCoreUIMoleculeMappingObject? + public var moleculeMap: MoleculeObjectMapping? open override func defaultInitialSetup() { cache = MVMCoreCache() @@ -18,7 +18,7 @@ import UIKit session = MVMCoreUISession() viewControllerMapping = MVMCoreUIViewControllerMappingObject() loggingDelegate = MVMCoreUILoggingHandler() - moleculeMap = MVMCoreUIMoleculeMappingObject() + moleculeMap = MoleculeObjectMapping() MoleculeObjectMapping.registerObjects() } } diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift deleted file mode 100644 index a7054d4e..00000000 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject+ModelExtension.swift +++ /dev/null @@ -1,49 +0,0 @@ -// -// MVMCoreUIMoleculeMappingObject+ModelExtension.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 10/24/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -public extension MVMCoreUIMoleculeMappingObject { - - func register(viewClass: V.Type, viewModelClass: M.Type) { - try? ModelRegistry.register(viewModelClass) - MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(viewClass, forKey: viewModelClass.identifier as NSString) - } - - func getMoleculeClass(_ model: MoleculeModelProtocol) -> AnyClass? { - return moleculeMapping.object(forKey: model.moleculeName) as? AnyClass - } - - func createMolecule(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> (UIView & MVMCoreUIMoleculeViewProtocol)? { - return createMolecule(model, delegateObject, false) - } - - func createMolecule(_ model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ constrainIfNeeded: Bool) -> (UIView & MVMCoreUIMoleculeViewProtocol)? { - guard let molecule = createMolecule(forName: model.moleculeName) else { - return nil - } - - let setData = {() in - if let molecule = molecule as? ModelMoleculeViewProtocol { - molecule.set(with: model, delegateObject, nil) - } else { - molecule.setWithJSON?(model.toJSON(), delegateObject: delegateObject, additionalData: nil) - } - } - - if constrainIfNeeded, let castMolecule = molecule as? MVMCoreUIViewConstrainingProtocol, - castMolecule.needsToBeConstrained?() ?? false { - let view = ViewConstrainingView(molecule: molecule, alignment: castMolecule.horizontalAlignment?() ?? .fill) - setData() - return view - } else { - setData() - return molecule - } - } -} diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.h b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.h deleted file mode 100644 index 776566c8..00000000 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// MVMCoreUIMoleculeMappingObject.h -// MVMCoreUI -// -// Created by Scott Pfeil on 2/11/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -#import -#import -@class MVMCoreUIDelegateObject; -@class MVMCoreLoadObject; -@class MVMCoreErrorObject; - -@interface MVMCoreUIMoleculeMappingObject : NSObject - -/// Maps molecule name to class. -@property (nonnull, strong, nonatomic) NSMutableDictionary *moleculeMapping; - -/// Returns the shared instance -+ (nullable instancetype)sharedMappingObject; - -/// Returns the molecule class. -- (nullable Class)getMoleculeClassWithJSON:(nonnull NSDictionary *)json; - -#pragma mark - Molecule Creation - -/// Creates the molecule for the molecule name. -- (nullable UIView *)createMoleculeForName:(nonnull NSString *)name; - -/// Creates the molecule for the molecule json. -- (nullable UIView *)createMoleculeForJSON:(nonnull NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject; - -/// Creates the molecule for the molecule json. Also checks if the molecule needs to be constrained for a stack/list style situation. -- (nullable UIView *)createMoleculeForJSON:(nonnull NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject constrainIfNeeded:(BOOL)constrainIfNeeded; - -#pragma mark - Convenience - -+ (nullable NSArray *)getRequiredModulesForJSON:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject error:(MVMCoreErrorObject *_Nullable *_Nullable)error; -+ (void)addRequiredModulesForJSON:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject moduleList:(nullable NSMutableArray *)moduleList errorList:(nullable NSMutableArray *)errorList; - -@end diff --git a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m b/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m deleted file mode 100644 index ccaa9115..00000000 --- a/MVMCoreUI/OtherHandlers/MVMCoreUIMoleculeMappingObject.m +++ /dev/null @@ -1,101 +0,0 @@ -// -// MVMCoreUIMoleculeMappingObject.m -// MVMCoreUI -// -// Created by Scott Pfeil on 2/11/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -#import "MVMCoreUIMoleculeMappingObject.h" -@import MVMCore.MVMCoreActionUtility; -@import MVMCore.NSDictionary_MFConvenience; -@import MVMCore.MVMCoreLoadObject; -@import MVMCore.MVMCoreErrorObject; -#import -#import "MFTextField.h" -#import "MVMCoreUIPageControl.h" -#import "MVMCoreUIViewConstrainingProtocol.h" - - -@implementation MVMCoreUIMoleculeMappingObject - -- (NSMutableDictionary *)moleculeMapping { - - // Keeps a mapping of the given page type - static dispatch_once_t onceToken; - static NSMutableDictionary *mapping; - dispatch_once(&onceToken, ^{ - mapping = [@{} mutableCopy]; - }); - return mapping; -} - -+ (nullable instancetype)sharedMappingObject { - return [MVMCoreActionUtility initializerClassCheck:[CoreUIObject sharedInstance].moleculeMap classToVerify:self]; -} - -- (nullable Class)getMoleculeClassWithJSON:(nonnull NSDictionary *)json { - NSString *moleculeName = [json string:KeyMoleculeName]; - if (moleculeName) { - return [self.moleculeMapping objectForKey:moleculeName]; - } - return nil; -} - -#pragma mark - Molecule Creation - -- (nullable UIView *)createMoleculeForName:(nonnull NSString *)name { - Class class = [self.moleculeMapping objectForKey:name]; - if (!class) { - return nil; - } - UIView *molecule = [[class alloc] init]; - if ([molecule respondsToSelector:@selector(setAsMolecule)]) { - [molecule setAsMolecule]; - } - return molecule; -} - -- (nullable UIView *)createMoleculeForJSON:(nonnull NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject { - return [self createMoleculeForJSON:json delegateObject:delegateObject constrainIfNeeded:NO]; -} - -- (nullable UIView *)createMoleculeForJSON:(nonnull NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject constrainIfNeeded:(BOOL)constrainIfNeeded { - NSString *moleculeName = [json string:KeyMoleculeName]; - if (!moleculeName) { - return nil; - } - UIView *molecule = [self createMoleculeForName:moleculeName]; - - // Check if we need to constrain this view. - UIView *castMolecule = [molecule conformsToProtocol:@protocol(MVMCoreUIViewConstrainingProtocol)] ? (UIView *)molecule : nil; - if (constrainIfNeeded && [castMolecule respondsToSelector:@selector(needsToBeConstrained)] && [castMolecule needsToBeConstrained]) { - molecule = [[ViewConstrainingView alloc] initWithMolecule:molecule alignment:[castMolecule respondsToSelector:@selector(horizontalAlignment)] ? [castMolecule horizontalAlignment] : UIStackViewAlignmentFill]; - } - [molecule setWithJSON:json delegateObject:delegateObject additionalData:nil]; - return molecule; -} - -#pragma mark - Convenience - -+ (nullable NSArray *)getRequiredModulesForJSON:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject error:(MVMCoreErrorObject *_Nullable *_Nullable)error { - Class theClass = [[MVMCoreUIMoleculeMappingObject sharedMappingObject] getMoleculeClassWithJSON:json]; - if ([theClass respondsToSelector:@selector(requiredModules:delegateObject:error:)]) { - return [theClass requiredModules:json delegateObject:delegateObject error:error]; - } else { - return nil; - } -} - -+ (void)addRequiredModulesForJSON:(nullable NSDictionary *)json delegateObject:(nullable MVMCoreUIDelegateObject *)delegateObject moduleList:(nullable NSMutableArray *)moduleList errorList:(nullable NSMutableArray *)errorList { - MVMCoreErrorObject *error = nil; - NSArray *modules = [self getRequiredModulesForJSON:json delegateObject:delegateObject error:&error]; - if (modules) { - [moduleList addObjectsFromArray:modules]; - } - if (error) { - [errorList addObject:error]; - } -} - -@end diff --git a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift b/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift deleted file mode 100644 index f2bf9e78..00000000 --- a/MVMCoreUI/OtherHandlers/MoleculeObjectMapping.swift +++ /dev/null @@ -1,143 +0,0 @@ -// -// MVMCoreUIMoleculeMappingObject+ModelMapping.swift -// MVMCoreUI -// -// Created by Suresh, Kamlesh on 10/28/19. -// Copyright © 2019 Verizon Wireless. All rights reserved. -// - -import Foundation - -@objcMembers public class MoleculeObjectMapping: NSObject { - public static func registerObjects() { - // Stacks - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackView.self, viewModelClass: MoleculeStackModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Stack.self, viewModelClass: StackModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: UnOrderedList.self, viewModelClass: UnOrderedListModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: NumberedList.self, viewModelClass: NumberedListModel.self) - - // Label - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Label.self, viewModelClass: LabelModel.self) - // need to move labelattributemodel to different method - try? ModelRegistry.register(LabelAttributeFontModel.self) - try? ModelRegistry.register(LabelAttributeColorModel.self) - try? ModelRegistry.register(LabelAttributeImageModel.self) // We need to separate the registry by types due to collisions... - try? ModelRegistry.register(LabelAttributeUnderlineModel.self) - try? ModelRegistry.register(LabelAttributeStrikeThroughModel.self) - try? ModelRegistry.register(LabelAttributeActionModel.self) - - // Buttons - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: PillButton.self, viewModelClass: ButtonModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TwoButtonView.self, viewModelClass: TwoButtonViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ExternalLink.self, viewModelClass: ExternalLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Link.self, viewModelClass: LinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CaretLink.self, viewModelClass: CaretLinkModel.self) - - // Entry Field - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TextEntryField.self, viewModelClass: TextEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MdnEntryField.self, viewModelClass: MdnEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DigitEntryField.self, viewModelClass: DigitEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ItemDropdownEntryField.self, viewModelClass: ItemDropdownEntryFieldModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DateDropdownEntryField.self, viewModelClass: DateDropdownEntryFieldModel.self) - - // Other Atoms - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MultiProgress.self, viewModelClass: MultiProgressBarModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CaretView.self, viewModelClass: CaretViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DashLine.self, viewModelClass: DashLineModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MFLoadImageView.self, viewModelClass: ImageViewModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Line.self, viewModelClass: LineModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: GraphView.self, viewModelClass: CircleProgressModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Toggle.self, viewModelClass: ToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CheckboxLabel.self, viewModelClass: CheckboxLabelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Arrow.self, viewModelClass: ArrowModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButton.self, viewModelClass: RadioButtonModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: RadioButtonLabel.self, viewModelClass: RadioButtonLabelModel.self) - - // Horizontal Combination Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self) - - // Vertical Combination Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLink.self, viewModelClass: HeadlineBodyLinkModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self) - - // Left Right Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LeftRightLabelView.self, viewModelClass: LeftRightLabelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LabelToggle.self, viewModelClass: LabelToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyToggle.self, viewModelClass: HeadlineBodyToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyLinkToggle.self, viewModelClass: HeadlineBodyLinkToggleModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self) - - // List items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: MoleculeListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DropDownFilterTableViewCell.self, viewModelClass: DropDownListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: AccordionMoleculeTableViewCell.self, viewModelClass: AccordionListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: TabsTableViewCell.self, viewModelClass: TabsListItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListProgressBarData.self, viewModelClass: ListProgressBarDataModel.self) - - // Other Items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeStackItem.self, viewModelClass: MoleculeStackItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StackItem.self, viewModelClass: StackItemModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeCollectionViewCell.self, viewModelClass: CarouselItemModel.self) - - // Other Container Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeHeaderView.self, viewModelClass: MoleculeHeaderModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: FooterView.self, viewModelClass: FooterModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Scroller.self, viewModelClass: ScrollerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ModuleMolecule.self, viewModelClass: ModuleMoleculeModel.self) - - // Other Molecules - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: DoughnutChartView.self, viewModelClass: DoughnutChartModel.self) - - // Other Organisms - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: Carousel.self, viewModelClass: CarouselModel.self) - - // Designed List Items - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableIconWithRightCaret.self, viewModelClass: ListLeftVariableIconWithRightCaretModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableCheckboxAllTextAndLinks.self, viewModelClass: ListLeftVariableCheckboxAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListLeftVariableRadioButtonAndPaymentMethod.self, viewModelClass: ListLeftVariableRadioButtonAndPaymentMethodModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRVWheel.self, viewModelClass: ListRVWheelModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariablePayments.self, viewModelClass: ListRightVariablePaymentsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListRightVariableTotalData.self, viewModelClass: ListRightVariableTotalDataModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextAllTextAndLinks.self, viewModelClass: ListOneColumnFullWidthTextAllTextAndLinksModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextBodyText.self, viewModelClass: ListOneColumnFullWidthTextBodyTextModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnCompareChanges.self, viewModelClass: ListTwoColumnCompareChangesModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDetails.self, viewModelClass: ListTwoColumnPriceDetailsModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListTwoColumnPriceDescription.self, viewModelClass: ListTwoColumnPriceDescriptionModel.self) - - // Designed Section Dividers - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListFourColumnDataUsageDivider.self, viewModelClass: ListFourColumnDataUsageDividerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListThreeColumnPlanDataDivider.self, viewModelClass: ListThreeColumnPlanDataDividerModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerShort.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerShortModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnTextWithWhitespaceDividerTall.self, viewModelClass: ListOneColumnTextWithWhitespaceDividerTallModel.self) - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ListOneColumnFullWidthTextDividerSubsection.self, viewModelClass: ListOneColumnFullWidthTextDividerSubsectionModel.self) - - // Designed Headers - MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadersH2NoButtonsBodyText.self, viewModelClass: HeadersH2NoButtonsBodyTextModel.self) - - // TODO: Need model - MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString) - - // TODO: Need View - try? ModelRegistry.register(TabsModel.self) - - // Helper models - try? ModelRegistry.register(RuleRequiredModel.self) - try? ModelRegistry.register(RuleAnyRequiredModel.self) - try? ModelRegistry.register(RuleAnyValueChangedModel.self) - try? ModelRegistry.register(RuleAllValueChangedModel.self) - try? ModelRegistry.register(RuleEqualsModel.self) - try? ModelRegistry.register(RuleRegexModel.self) - - // Actions - try? ModelRegistry.register(ActionTopAlertModel.self) - try? ModelRegistry.register(ActionCollapseNotificationModel.self) - try? ModelRegistry.register(ActionOpenPanelModel.self) - } -}