This commit is contained in:
Kevin G Christiano 2020-06-08 14:58:50 -04:00
commit f449b8aafd
84 changed files with 773 additions and 509 deletions

View File

@ -215,12 +215,16 @@
AAB9C10824346F4B00151545 /* RadioSwatches.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C10724346F4B00151545 /* RadioSwatches.swift */; }; AAB9C10824346F4B00151545 /* RadioSwatches.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C10724346F4B00151545 /* RadioSwatches.swift */; };
AAB9C10A243496DD00151545 /* RadioSwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C109243496DD00151545 /* RadioSwatch.swift */; }; AAB9C10A243496DD00151545 /* RadioSwatch.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAB9C109243496DD00151545 /* RadioSwatch.swift */; };
AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */; }; AAC6F167243332E400F295C1 /* RadioSwatchesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */; };
BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */; };
BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; }; BB1D17E0244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */; };
BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; }; BB1D17E2244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */; };
BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */; }; BB2BF0EA2452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */; };
BB2BF0EC2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */; }; BB2BF0EC2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */; };
BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; }; BB2C968F24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */; };
BB2C969224330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */; }; BB2C969224330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */; };
BB2FB3BB247E7EBC00DF73CD /* TagCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */; };
BB2FB3BD247E7EF200DF73CD /* Tags.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BC247E7EF200DF73CD /* Tags.swift */; };
BB2FB3BF247E7F0900DF73CD /* TagsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB2FB3BE247E7F0900DF73CD /* TagsModel.swift */; };
BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; }; BB47A586241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */; };
BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; }; BB47A588241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */; };
BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */; }; BB54C5202434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift in Sources */ = {isa = PBXBuildFile; fileRef = BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */; };
@ -236,6 +240,8 @@
BBAA4F05243D8E3B005AAD5F /* RadioBoxesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */; }; BBAA4F05243D8E3B005AAD5F /* RadioBoxesModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */; };
BBBBC87C24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBBC87A24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift */; }; BBBBC87C24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBBC87A24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift */; };
BBBBC87D24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBBC87B24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift */; }; BBBBC87D24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBBBC87B24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift */; };
BBC0C4FD24811DBC0087C44F /* Tag.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC0C4FC24811DBC0087C44F /* Tag.swift */; };
BBC0C4FF24811DCA0087C44F /* TagModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBC0C4FE24811DCA0087C44F /* TagModel.swift */; };
C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; }; C003506123AA94CD00B6AC29 /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = C003506023AA94CD00B6AC29 /* Button.swift */; };
C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; }; C07065C42395677300FBF997 /* Link.swift in Sources */ = {isa = PBXBuildFile; fileRef = C07065C32395677300FBF997 /* Link.swift */; };
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; }; C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */; };
@ -654,12 +660,16 @@
AAB9C10724346F4B00151545 /* RadioSwatches.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatches.swift; sourceTree = "<group>"; }; AAB9C10724346F4B00151545 /* RadioSwatches.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatches.swift; sourceTree = "<group>"; };
AAB9C109243496DD00151545 /* RadioSwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatch.swift; sourceTree = "<group>"; }; AAB9C109243496DD00151545 /* RadioSwatch.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatch.swift; sourceTree = "<group>"; };
AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchesModel.swift; sourceTree = "<group>"; }; AAC6F166243332E400F295C1 /* RadioSwatchesModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioSwatchesModel.swift; sourceTree = "<group>"; };
BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UICollectionViewLeftAlignedLayout.swift; sourceTree = "<group>"; };
BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = "<group>"; }; BB1D17DF244EAA30001D2002 /* ListDeviceComplexButtonMediumModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMediumModel.swift; sourceTree = "<group>"; };
BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = "<group>"; }; BB1D17E1244EAA46001D2002 /* ListDeviceComplexButtonMedium.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonMedium.swift; sourceTree = "<group>"; };
BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmall.swift; sourceTree = "<group>"; }; BB2BF0E92452A9BB001D0FC2 /* ListDeviceComplexButtonSmall.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmall.swift; sourceTree = "<group>"; };
BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmallModel.swift; sourceTree = "<group>"; }; BB2BF0EB2452A9D5001D0FC2 /* ListDeviceComplexButtonSmallModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListDeviceComplexButtonSmallModel.swift; sourceTree = "<group>"; };
BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = "<group>"; }; BB2C968D24330EA7006FF80C /* ListRightVariableTextLinkAllTextAndLinksModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinksModel.swift; sourceTree = "<group>"; };
BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = "<group>"; }; BB2C969124330F73006FF80C /* ListRightVariableTextLinkAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableTextLinkAllTextAndLinks.swift; sourceTree = "<group>"; };
BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagCollectionViewCell.swift; sourceTree = "<group>"; };
BB2FB3BC247E7EF200DF73CD /* Tags.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tags.swift; sourceTree = "<group>"; };
BB2FB3BE247E7F0900DF73CD /* TagsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagsModel.swift; sourceTree = "<group>"; };
BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = "<group>"; }; BB47A585241615EF002BB23C /* ListOneColumnFullWidthTextDividerSubsectionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsectionModel.swift; sourceTree = "<group>"; };
BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = "<group>"; }; BB47A587241615FA002BB23C /* ListOneColumnFullWidthTextDividerSubsection.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListOneColumnFullWidthTextDividerSubsection.swift; sourceTree = "<group>"; };
BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = "<group>"; }; BB54C51E2434D92F0038326C /* ListRightVariableButtonAllTextAndLinks.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListRightVariableButtonAllTextAndLinks.swift; sourceTree = "<group>"; };
@ -675,6 +685,8 @@
BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioBoxesModel.swift; sourceTree = "<group>"; }; BBAA4F01243D8E3B005AAD5F /* RadioBoxesModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RadioBoxesModel.swift; sourceTree = "<group>"; };
BBBBC87A24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChangesDivider.swift; sourceTree = "<group>"; }; BBBBC87A24374A4900B0F079 /* ListThreeColumnBillChangesDivider.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChangesDivider.swift; sourceTree = "<group>"; };
BBBBC87B24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChangesDividerModel.swift; sourceTree = "<group>"; }; BBBBC87B24374A4900B0F079 /* ListThreeColumnBillChangesDividerModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ListThreeColumnBillChangesDividerModel.swift; sourceTree = "<group>"; };
BBC0C4FC24811DBC0087C44F /* Tag.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tag.swift; sourceTree = "<group>"; };
BBC0C4FE24811DCA0087C44F /* TagModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TagModel.swift; sourceTree = "<group>"; };
C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; }; C003506023AA94CD00B6AC29 /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = "<group>"; }; C07065C32395677300FBF997 /* Link.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Link.swift; sourceTree = "<group>"; };
C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = "<group>"; }; C695A67E23C9830600BFB94E /* UnOrderedListModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = UnOrderedListModel.swift; sourceTree = "<group>"; };
@ -1549,8 +1561,8 @@
D29DF10D21E67A70003B2FB9 /* Atoms */ = { D29DF10D21E67A70003B2FB9 /* Atoms */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
D2BEFEF5248A954C00FAB3A9 /* FormFields */,
D264FAA8243FE17A00D98315 /* Selectors */, D264FAA8243FE17A00D98315 /* Selectors */,
D29DF22B21E6A0FA003B2FB9 /* TextFields */,
D29DF17D21E69E26003B2FB9 /* Views */, D29DF17D21E69E26003B2FB9 /* Views */,
D29DF16821E69E1F003B2FB9 /* Buttons */, D29DF16821E69E1F003B2FB9 /* Buttons */,
); );
@ -1862,6 +1874,7 @@
0AE14F63238315D2005417F8 /* TextField.swift */, 0AE14F63238315D2005417F8 /* TextField.swift */,
D20923582450ECE00044AD09 /* TableView.swift */, D20923582450ECE00044AD09 /* TableView.swift */,
D2755D7A23689C7500485468 /* TableViewCell.swift */, D2755D7A23689C7500485468 /* TableViewCell.swift */,
BB105858248DEFF60069D008 /* UICollectionViewLeftAlignedLayout.swift */,
D21B7F70243BAC1600051ABF /* CollectionViewCell.swift */, D21B7F70243BAC1600051ABF /* CollectionViewCell.swift */,
D264FAA92440F97600D98315 /* CollectionView.swift */, D264FAA92440F97600D98315 /* CollectionView.swift */,
0A5D59C323AD488600EFD9E9 /* Protocols */, 0A5D59C323AD488600EFD9E9 /* Protocols */,
@ -1871,6 +1884,27 @@
path = BaseClasses; path = BaseClasses;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
D2BEFEF5248A954C00FAB3A9 /* FormFields */ = {
isa = PBXGroup;
children = (
D2BEFEF6248A957A00FAB3A9 /* Tags */,
D29DF22B21E6A0FA003B2FB9 /* TextFields */,
);
path = FormFields;
sourceTree = "<group>";
};
D2BEFEF6248A957A00FAB3A9 /* Tags */ = {
isa = PBXGroup;
children = (
BBC0C4FE24811DCA0087C44F /* TagModel.swift */,
BBC0C4FC24811DBC0087C44F /* Tag.swift */,
BB2FB3BE247E7F0900DF73CD /* TagsModel.swift */,
BB2FB3BC247E7EF200DF73CD /* Tags.swift */,
BB2FB3BA247E7EBC00DF73CD /* TagCollectionViewCell.swift */,
);
path = Tags;
sourceTree = "<group>";
};
D2C78CD324252F4E00B69FDE /* Atomic */ = { D2C78CD324252F4E00B69FDE /* Atomic */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
@ -2040,6 +2074,7 @@
94C2D9A923872E5E0006CF46 /* LabelAttributeImageModel.swift in Sources */, 94C2D9A923872E5E0006CF46 /* LabelAttributeImageModel.swift in Sources */,
DBC4391922442197001AB423 /* DashLine.swift in Sources */, DBC4391922442197001AB423 /* DashLine.swift in Sources */,
D264FAAA2440F97600D98315 /* CollectionView.swift in Sources */, D264FAAA2440F97600D98315 /* CollectionView.swift in Sources */,
BBC0C4FF24811DCA0087C44F /* TagModel.swift in Sources */,
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */, 0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */,
D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */, D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */,
D28BA7452481652D00B75CB8 /* TabBarProtocol.swift in Sources */, D28BA7452481652D00B75CB8 /* TabBarProtocol.swift in Sources */,
@ -2142,6 +2177,7 @@
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */, D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
0A25209624645AFD000FA9F6 /* TextViewEntryField.swift in Sources */, 0A25209624645AFD000FA9F6 /* TextViewEntryField.swift in Sources */,
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */, 014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
BB2FB3BF247E7F0900DF73CD /* TagsModel.swift in Sources */,
AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */, AA11A42123F15D7000D7962F /* ListRightVariablePaymentsModel.swift in Sources */,
011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */, 011D9626240EBB16000E3791 /* RadioButtonLabelModel.swift in Sources */,
8DDD6C1D244D90B8006A2232 /* ListThreeColumnDataUsage.swift in Sources */, 8DDD6C1D244D90B8006A2232 /* ListThreeColumnDataUsage.swift in Sources */,
@ -2240,6 +2276,7 @@
011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */, 011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */,
D2509ED12472ED9B001BFB9D /* NavigationItemModelProtocol.swift in Sources */, D2509ED12472ED9B001BFB9D /* NavigationItemModelProtocol.swift in Sources */,
8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */, 8D448E5524050A46006211BB /* ListOneColumnFullWidthTextAllTextAndLinksModel.swift in Sources */,
BBC0C4FD24811DBC0087C44F /* Tag.swift in Sources */,
94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */, 94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */,
944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */, 944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */,
D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */, D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */,
@ -2279,6 +2316,7 @@
D253BB9E2458751F002DE544 /* BGImageMoleculeModel.swift in Sources */, D253BB9E2458751F002DE544 /* BGImageMoleculeModel.swift in Sources */,
0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */, 0ABD1371237DB0450081388D /* ItemDropdownEntryField.swift in Sources */,
8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */, 8D24041123E7FB9E009E23BE /* ListLeftVariableIconWithRightCaret.swift in Sources */,
BB2FB3BD247E7EF200DF73CD /* Tags.swift in Sources */,
BBAA4F03243D8E3B005AAD5F /* RadioBoxes.swift in Sources */, BBAA4F03243D8E3B005AAD5F /* RadioBoxes.swift in Sources */,
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */, D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */,
525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */, 525019E72406853600EED91C /* ListFourColumnDataUsageDivider.swift in Sources */,
@ -2299,6 +2337,7 @@
D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */, D2092355244FA0FD0044AD09 /* ThreeLayerTemplateModelProtocol.swift in Sources */,
0AE14F64238315D2005417F8 /* TextField.swift in Sources */, 0AE14F64238315D2005417F8 /* TextField.swift in Sources */,
0AB764D124460F6300E7FE72 /* UIDatePicker+Extension.swift in Sources */, 0AB764D124460F6300E7FE72 /* UIDatePicker+Extension.swift in Sources */,
BB105859248DEFF70069D008 /* UICollectionViewLeftAlignedLayout.swift in Sources */,
D253BB9C245874F8002DE544 /* BGImageMolecule.swift in Sources */, D253BB9C245874F8002DE544 /* BGImageMolecule.swift in Sources */,
D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */, D2C78CD224228BBD00B69FDE /* ActionOpenPanelModel.swift in Sources */,
AA617AB02453010A00910B8F /* ListDeviceComplexLinkSmall.swift in Sources */, AA617AB02453010A00910B8F /* ListDeviceComplexLinkSmall.swift in Sources */,
@ -2324,6 +2363,7 @@
0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */, 0A21DB83235DFBC500C160A2 /* MdnEntryField.swift in Sources */,
0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */, 0AE98BB723FF18E9004C5109 /* ArrowModel.swift in Sources */,
D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */, D28A837D23CCA86A00DFE4FC /* TabsListItemModel.swift in Sources */,
BB2FB3BB247E7EBC00DF73CD /* TagCollectionViewCell.swift in Sources */,
012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */, 012A88C6238DA34000FE3DA1 /* ModuleMoleculeModel.swift in Sources */,
94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */, 94C2D9A123872BCC0006CF46 /* LabelAttributeUnderlineModel.swift in Sources */,
D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */, D20A9A5E2243D3E300ADE781 /* TwoButtonView.swift in Sources */,

View File

@ -0,0 +1,41 @@
//
// Tag.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 29/05/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers open class Tag: View {
public let label = Label.createLabelRegularBodySmall(true)
// MARK: - MVMCoreViewProtocol
open override func setupView() {
super.setupView()
layer.borderColor = UIColor.mvmCoolGray6.cgColor
layer.borderWidth = 1
label.numberOfLines = 1
addSubview(label)
NSLayoutConstraint.constraintPinSubview(label, pinTop: true, topConstant: 13, pinBottom: true, bottomConstant: 13, pinLeft: true, leftConstant: 15, pinRight: true, rightConstant: 15)
}
// MARK: - MoleculeViewProtocol
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
guard let model = model as? TagModel else { return }
label.set(with: model.label, delegateObject, additionalData)
}
@objc override open func updateView(_ size: CGFloat) {
super.updateView(size)
label.updateView(size)
}
open override func reset() {
super.reset()
label.reset()
label.styleRegularBodySmall(true)
}
}

View File

@ -0,0 +1,29 @@
//
// TagCollectionViewCell.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 27/05/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
open class TagCollectionViewCell: CollectionViewCell {
public let tagLabel = Tag()
open override func reset() {
super.reset()
backgroundColor = .clear
}
open override func setupView() {
super.setupView()
addMolecule(tagLabel)
MVMCoreUIUtility.setMarginsFor(contentView, leading: 0, top: 0, trailing: 0, bottom: 0)
}
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
guard let model = model as? TagModel else { return }
tagLabel.set(with: model, delegateObject, additionalData)
}
}

View File

@ -0,0 +1,37 @@
//
// TagModel.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 29/05/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers public class TagModel: MoleculeModelProtocol {
public static var identifier: String = "tag"
public var label: LabelModel
public var action: ActionModelProtocol?
public var backgroundColor: Color?
private enum CodingKeys: String, CodingKey {
case moleculeName
case label
case action
case backgroundColor
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
label = try typeContainer.decode(LabelModel.self, forKey: .label)
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(label, forKey: .label)
try container.encodeModelIfPresent(action, forKey: .action)
}
}

View File

@ -0,0 +1,105 @@
//
// Tags.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 27/05/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
open class Tags: View, MFButtonProtocol {
public var collectionView: CollectionView!
public var collectionViewHeight: NSLayoutConstraint!
private var tagsListModel: TagsModel? {
return model as? TagsModel
}
private var delegateObject: MVMCoreUIDelegateObject?
/// The models for the molecules.
public var tags: [TagModel]?
open override func layoutSubviews() {
super.layoutSubviews()
// Accounts for any collection size changes
DispatchQueue.main.async {
self.collectionView.collectionViewLayout.invalidateLayout()
self.collectionViewHeight.constant = self.collectionView.contentSize.height
self.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self)
}
}
// MARK: - MVMCoreViewProtocol
open override func setupView() {
super.setupView()
collectionView = createCollectionView()
addSubview(collectionView)
NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView)
collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 300)
collectionViewHeight?.isActive = true
}
// MARK: - MoleculeViewProtocol
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
super.set(with: model, delegateObject, additionalData)
self.delegateObject = delegateObject
guard let tagsListModel = model as? TagsModel else { return }
tags = tagsListModel.tags
registerCells()
collectionView.reloadData()
}
@objc override open func updateView(_ size: CGFloat) {
super.updateView(size)
collectionView.updateView(size)
}
// MARK: - Creation
/// Creates the layout for the collection.
open func createCollectionViewLayout() -> UICollectionViewLayout {
let layout = UICollectionViewLeftAlignedLayout()
layout.estimatedItemSize = CGSize(width: 140, height: 40)
layout.minimumLineSpacing = 24.0
layout.minimumInteritemSpacing = 12.0
return layout
}
/// Creates the collection view.
open func createCollectionView() -> CollectionView {
let collection = CollectionView(frame: .zero, collectionViewLayout: createCollectionViewLayout())
collection.dataSource = self
collection.delegate = self
return collection
}
/// Registers the cells with the collection view
open func registerCells() {
collectionView.register(TagCollectionViewCell.self, forCellWithReuseIdentifier: "TagCollectionViewCell")
}
}
extension Tags: UICollectionViewDataSource {
open func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return tags?.count ?? 0
}
open func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
guard let molecule = tags?[indexPath.row],
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "TagCollectionViewCell", for: indexPath) as? TagCollectionViewCell else {
fatalError()
}
cell.reset()
cell.set(with: molecule, delegateObject, nil)
cell.layoutIfNeeded()
return cell
}
}
extension Tags: UICollectionViewDelegate {
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
guard let tagModel = tags?[indexPath.row],
let tagAction = tagModel.action else { return }
Button.performButtonAction(with: tagAction, button: self, delegateObject: delegateObject, additionalData: nil)
}
}

View File

@ -0,0 +1,34 @@
//
// TagsModel.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 27/05/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers public class TagsModel: MoleculeModelProtocol {
public static var identifier: String = "tags"
public var backgroundColor: Color?
public var tags: [TagModel]
private enum CodingKeys: String, CodingKey {
case moleculeName
case backgroundColor
case tags
}
required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
tags = try typeContainer.decode([TagModel].self, forKey: .tags)
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encode(tags, forKey: .tags)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
}
}

View File

@ -9,8 +9,8 @@
import Foundation import Foundation
open class RadioBox: Control { open class RadioBox: Control {
public let label = Label.createLabelRegularBodySmall(true) public let label = Label(fontStyle: .RegularBodySmall)
public let subTextLabel = Label.createLabelRegularMicro(true) public let subTextLabel = Label(fontStyle: .RegularMicro)
public var isOutOfStock = false public var isOutOfStock = false
public var accentColor = UIColor.mvmRed public var accentColor = UIColor.mvmRed

View File

@ -13,7 +13,7 @@ open class RadioSwatch: Control {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public let bottomText = Label.createLabelRegularMicro(true) public let bottomText = Label(fontStyle: .RegularMicro)
private var circleLayer: CAShapeLayer? private var circleLayer: CAShapeLayer?
private var selectedLayer: CALayer? private var selectedLayer: CALayer?

View File

@ -206,6 +206,7 @@ open class CarouselIndicator: Control, CarouselPageControlProtocol {
isEnabled = model.enabled isEnabled = model.enabled
formatAccessibilityValue(index: currentIndex + 1, total: numberOfPages) formatAccessibilityValue(index: currentIndex + 1, total: numberOfPages)
isHidden = model.hidesForSinglePage && numberOfPages <= 1
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -33,7 +33,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
public var disabledIndicatorColor: Color = Color(uiColor: .mvmCoolGray3) public var disabledIndicatorColor: Color = Color(uiColor: .mvmCoolGray3)
public var indicatorColor: Color = Color(uiColor: .mvmBlack) public var indicatorColor: Color = Color(uiColor: .mvmBlack)
public var indicatorColor_inverted: Color = Color(uiColor: .mvmWhite) public var indicatorColor_inverted: Color = Color(uiColor: .mvmWhite)
public var position: Float? public var position: CGFloat?
/// Allows sendActions() to trigger even if index is already at min/max index. /// Allows sendActions() to trigger even if index is already at min/max index.
public var alwaysSendAction = false public var alwaysSendAction = false
@ -79,7 +79,7 @@ open class CarouselIndicatorModel: CarouselPagingModelProtocol, MoleculeModelPro
self.inverted = inverted self.inverted = inverted
} }
if let position = try typeContainer.decodeIfPresent(Float.self, forKey: .position) { if let position = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .position) {
self.position = position self.position = position
} }

View File

@ -16,7 +16,7 @@ open class NumericIndicatorView: CarouselIndicator {
/// Text to display the current count of total pages for viewing. /// Text to display the current count of total pages for viewing.
open var pageCount: Label = { open var pageCount: Label = {
let label = Label.createLabelRegularBodySmall(true) let label = Label(fontStyle: .RegularBodySmall)
label.isAccessibilityElement = false label.isAccessibilityElement = false
label.setContentCompressionResistancePriority(.required, for: .vertical) label.setContentCompressionResistancePriority(.required, for: .vertical)
label.textAlignment = .center label.textAlignment = .center

View File

@ -13,7 +13,7 @@
//-------------------------------------------------- //--------------------------------------------------
public let checkbox = Checkbox() public let checkbox = Checkbox()
public let label = Label.createLabelRegularBodySmall(true) public let label = Label(fontStyle: .RegularBodySmall)
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties

View File

@ -13,7 +13,6 @@ public typealias ActionBlock = () -> ()
@objcMembers open class Label: UILabel, MVMCoreViewProtocol, MoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol, MFButtonProtocol { @objcMembers open class Label: UILabel, MVMCoreViewProtocol, MoleculeViewProtocol, MVMCoreUIViewConstrainingProtocol, MFButtonProtocol {
//------------------------------------------------------ //------------------------------------------------------
// MARK: - Properties // MARK: - Properties
//------------------------------------------------------ //------------------------------------------------------
@ -97,7 +96,7 @@ public typealias ActionBlock = () -> ()
accessibilityCustomActions = [] accessibilityCustomActions = []
accessibilityTraits = .staticText accessibilityTraits = .staticText
let tapGesture = UITapGestureRecognizer(target: self, action: #selector(textLinkTapped(_:))) let tapGesture = UITapGestureRecognizer(target: self, action: #selector(textLinkTapped))
tapGesture.numberOfTapsRequired = 1 tapGesture.numberOfTapsRequired = 1
addGestureRecognizer(tapGesture) addGestureRecognizer(tapGesture)
} }
@ -117,6 +116,15 @@ public typealias ActionBlock = () -> ()
setupView() setupView()
} }
public init(fontStyle: Styler.Font, _ scale: Bool = true) {
super.init(frame: .zero)
setupView()
font = fontStyle.getFont(false)
textColor = fontStyle.color()
setScale(scale)
}
@objc convenience public init(standardFontSize size: CGFloat) { @objc convenience public init(standardFontSize size: CGFloat) {
self.init() self.init()
standardFontSize = size standardFontSize = size
@ -139,91 +147,9 @@ public typealias ActionBlock = () -> ()
} }
//------------------------------------------------------ //------------------------------------------------------
// MARK: - Factory Functions // MARK: - 2.0 Factory Functions
//------------------------------------------------------ //------------------------------------------------------
/// Title 2XLarge
@objc public static func createLabelTitle2XLarge(_ scale: Bool) -> Label {
let label = Label.label()
label.styleTitle2XLarge(scale)
return label
}
/// TitleXLarge
@objc public static func createLabelTitleXLarge(_ scale: Bool) -> Label {
let label = Label.label()
label.styleTitleXLarge(scale)
return label
}
/// BoldTitleLarge
@objc public static func createLabelBoldTitleLarge(_ scale: Bool) -> Label {
let label = Label.label()
label.styleBoldTitleLarge(scale)
return label
}
/// RegularTitleLarge
@objc public static func createLabelRegularTitleLarge(_ scale: Bool) -> Label {
let label = Label.label()
label.styleRegularTitleLarge(scale)
return label
}
/// BoldTitleMedium
@objc public static func createLabelBoldTitleMedium(_ scale: Bool) -> Label {
let label = Label.label()
label.styleBoldTitleMedium(scale)
return label
}
/// RegularTitleMedium
@objc public static func createLabelRegularTitleMedium(_ scale: Bool) -> Label {
let label = Label.label()
label.styleRegularTitleMedium(scale)
return label
}
/// BoldBodyLarge
@objc public static func createLabelBoldBodyLarge(_ scale: Bool) -> Label {
let label = Label.label()
label.styleBoldBodyLarge(scale)
return label
}
/// RegularBodyLarge
@objc public static func createLabelRegularBodyLarge(_ scale: Bool) -> Label {
let label = Label.label()
label.styleRegularBodyLarge(scale)
return label
}
/// BoldBodySmall
@objc public static func createLabelBoldBodySmall(_ scale: Bool) -> Label {
let label = Label.label()
label.styleBoldBodySmall(scale)
return label
}
/// RegularBodySmall
@objc public static func createLabelRegularBodySmall(_ scale: Bool) -> Label {
let label = Label.label()
label.styleRegularBodySmall(scale)
return label
}
/// BoldMicro
@objc public static func createLabelBoldMicro(_ scale: Bool) -> Label {
let label = Label.label()
label.styleBoldMicro(scale)
return label
}
/// RegularMicro
@objc public static func createLabelRegularMicro(_ scale: Bool) -> Label {
let label = Label.label()
label.styleRegularMicro(scale)
return label
}
//2.0 fonts init methods //2.0 fonts init methods
/// H1 -> HeadlineLarge /// H1 -> HeadlineLarge
@objc public static func commonLabelH1(_ scale: Bool) -> Label { @objc public static func commonLabelH1(_ scale: Bool) -> Label {
@ -569,71 +495,19 @@ public typealias ActionBlock = () -> ()
} }
//------------------------------------------------------ //------------------------------------------------------
// MARK: - Methods // MARK: - 3.0 Styling Method
//------------------------------------------------------ //------------------------------------------------------
//mva 3.0 font public func setFontStyle(_ fontStyle: Styler.Font, _ scale: Bool = true) {
@objc public func styleTitle2XLarge(_ scale: Bool) { font = fontStyle.getFont(false)
MFStyler.styleLabelTitle2XLarge(self, genericScaling: false) textColor = .mvmBlack
setScale(scale) setScale(scale)
} }
@objc public func styleTitleXLarge(_ scale: Bool) { //------------------------------------------------------
MFStyler.styleLabelTitleXLarge(self, genericScaling: false) // MARK: - 2.0 Styling Methods
setScale(scale) //------------------------------------------------------
}
@objc public func styleBoldTitleLarge(_ scale: Bool) {
MFStyler.styleLabelBoldTitleLarge(self, genericScaling: false)
setScale(scale)
}
@objc public func styleRegularTitleLarge(_ scale: Bool) {
MFStyler.styleLabelRegularTitleLarge(self, genericScaling: false)
setScale(scale)
}
@objc public func styleBoldTitleMedium(_ scale: Bool) {
MFStyler.styleLabelBoldTitleMedium(self, genericScaling: false)
setScale(scale)
}
@objc public func styleRegularTitleMedium(_ scale: Bool) {
MFStyler.styleLabelRegularTitleMedium(self, genericScaling: false)
setScale(scale)
}
@objc public func styleBoldBodyLarge(_ scale: Bool) {
MFStyler.styleLabelBoldBodyLarge(self, genericScaling: false)
setScale(scale)
}
@objc public func styleRegularBodyLarge(_ scale: Bool) {
MFStyler.styleLabelRegularBodyLarge(self, genericScaling: false)
setScale(scale)
}
@objc public func styleBoldBodySmall(_ scale: Bool) {
MFStyler.styleLabelBoldBodySmall(self, genericScaling: false)
setScale(scale)
}
@objc public func styleRegularBodySmall(_ scale: Bool) {
MFStyler.styleLabelRegularBodySmall(self, genericScaling: false)
setScale(scale)
}
@objc public func styleBoldMicro(_ scale: Bool) {
MFStyler.styleLabelBoldMicro(self, genericScaling: false)
setScale(scale)
}
@objc public func styleRegularMicro(_ scale: Bool) {
MFStyler.styleLabelRegularMicro(self, genericScaling: false)
setScale(scale)
}
//2.0 fonts
@objc public func styleH1(_ scale: Bool) { @objc public func styleH1(_ scale: Bool) {
MFStyler.styleLabelH1(self, genericScaling: false) MFStyler.styleLabelH1(self, genericScaling: false)
setScale(scale) setScale(scale)

View File

@ -14,8 +14,8 @@ import Foundation
// MARK: - Outlets // MARK: - Outlets
//------------------------------------------------------ //------------------------------------------------------
let leftTextLabel = Label.createLabelBoldBodySmall(true) let leftTextLabel = Label(fontStyle: .BoldBodySmall)
let rightTextLabel = Label.createLabelBoldBodySmall(true) let rightTextLabel = Label(fontStyle: .BoldBodySmall)
//------------------------------------------------------ //------------------------------------------------------
// MARK: - Constraints // MARK: - Constraints

View File

@ -34,6 +34,18 @@ import Foundation
return type.init(model: model, delegateObject, additionalData) return type.init(model: model, delegateObject, additionalData)
} }
/// Convenience function for legacy classes
public func getMoleculeModelForJSON(_ json: [String: Any]) throws -> MoleculeModelProtocol? {
guard let moleculeName = json.optionalStringForKey(KeyMoleculeName),
let type = ModelRegistry.getType(for: moleculeName, with: MoleculeModelProtocol.self) else {
throw ModelRegistry.Error.decoderErrorModelNotMapped
}
guard let model = try type.decode(jsonDict: json) as? MoleculeModelProtocol else {
throw ModelRegistry.Error.decoderError
}
return model
}
/// Call to register all of the CoreUI molecules. /// Call to register all of the CoreUI molecules.
public static func registerObjects() { public static func registerObjects() {
// Stacks // Stacks
@ -73,6 +85,10 @@ import Foundation
MoleculeObjectMapping.shared()?.register(viewClass: RadioBoxes.self, viewModelClass: RadioBoxesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioBoxes.self, viewModelClass: RadioBoxesModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self) MoleculeObjectMapping.shared()?.register(viewClass: Checkbox.self, viewModelClass: CheckboxModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: RadioSwatches.self, viewModelClass: RadioSwatchesModel.self) MoleculeObjectMapping.shared()?.register(viewClass: RadioSwatches.self, viewModelClass: RadioSwatchesModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: Tags.self, viewModelClass: TagsModel.self)
MoleculeObjectMapping.shared()?.register(viewClass: Tag.self, viewModelClass: TagModel.self)
// Other Atoms // Other Atoms
MoleculeObjectMapping.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self) MoleculeObjectMapping.shared()?.register(viewClass: ProgressBar.self, viewModelClass: ProgressBarModel.self)

View File

@ -15,11 +15,11 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
public var verticalStack: Stack<StackModel> public var verticalStack: Stack<StackModel>
public let eyebrow = Label.createLabelRegularMicro(true) public let eyebrow = Label(fontStyle: .RegularMicro)
public let headline = Label.createLabelBoldTitleMedium(true) public let headline = Label(fontStyle: .BoldTitleMedium)
public let body = Label.createLabelRegularBodySmall(true) public let body = Label(fontStyle: .RegularBodySmall)
public let body2 = Label.createLabelRegularBodySmall(true) public let body2 = Label(fontStyle: .RegularBodySmall)
public let button = PillButton() public let button = PillButton(frame: .zero)
public let rightImageView = LoadImageView() public let rightImageView = LoadImageView()
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
@ -84,10 +84,10 @@ import Foundation
} }
public func setDefault() { public func setDefault() {
eyebrow.styleRegularMicro(true) eyebrow.setFontStyle(.RegularMicro)
headline.styleBoldTitleMedium(true) headline.setFontStyle(.BoldTitleMedium)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
body2.styleRegularBodySmall(true) body2.setFontStyle(.RegularBodySmall)
eyebrow.textColor = .mvmCoolGray6 eyebrow.textColor = .mvmCoolGray6
} }

View File

@ -15,11 +15,11 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
public var verticalStack: Stack<StackModel> public var verticalStack: Stack<StackModel>
public let eyebrow = Label.createLabelRegularMicro(true) public let eyebrow = Label(fontStyle: .RegularMicro)
public let headline = Label.createLabelBoldTitleMedium(true) public let headline = Label(fontStyle: .BoldTitleMedium)
public let body = Label.createLabelRegularBodySmall(true) public let body = Label(fontStyle: .RegularBodySmall)
public let body2 = Label.createLabelRegularBodySmall(true) public let body2 = Label(fontStyle: .RegularBodySmall)
public let button = PillButton() public let button = PillButton(frame: .zero)
public let rightImageView = LoadImageView() public let rightImageView = LoadImageView()
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
@ -84,10 +84,10 @@ import Foundation
} }
public func setDefault() { public func setDefault() {
eyebrow.styleRegularMicro(true) eyebrow.setFontStyle(.RegularMicro)
headline.styleBoldTitleMedium(true) headline.setFontStyle(.BoldTitleMedium)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
body2.styleRegularBodySmall(true) body2.setFontStyle(.RegularBodySmall)
eyebrow.textColor = .mvmCoolGray6 eyebrow.textColor = .mvmCoolGray6
} }

View File

@ -13,11 +13,10 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
public let eyebrow = Label(fontStyle: .RegularMicro)
public let eyebrow = Label.createLabelRegularMicro(true) public let headline = Label(fontStyle: .BoldTitleMedium)
public let headline = Label.createLabelBoldTitleMedium(true) public let body = Label(fontStyle: .RegularBodySmall)
public let body = Label.createLabelRegularBodySmall(true) public let body2 = Label(fontStyle: .RegularBodySmall)
public let body2 = Label.createLabelRegularBodySmall(true)
public let twoLinkView = TwoLinkView() public let twoLinkView = TwoLinkView()
public let rightImage = LoadImageView() public let rightImage = LoadImageView()
let verticalStack: Stack<StackModel> let verticalStack: Stack<StackModel>
@ -83,10 +82,10 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
eyebrow.styleRegularMicro(true) eyebrow.setFontStyle(.RegularMicro)
headline.styleBoldTitleMedium(true) headline.setFontStyle(.BoldTitleMedium)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
body2.styleRegularBodySmall(true) body2.setFontStyle(.RegularBodySmall)
eyebrow.textColor = .mvmCoolGray6 eyebrow.textColor = .mvmCoolGray6
} }

View File

@ -13,11 +13,10 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
public let eyebrow = Label(fontStyle: .RegularMicro)
public let eyebrow = Label.createLabelRegularMicro(true) public let headline = Label(fontStyle: .BoldTitleMedium)
public let headline = Label.createLabelBoldTitleMedium(true) public let body = Label(fontStyle: .RegularBodySmall)
public let body = Label.createLabelRegularBodySmall(true) public let body2 = Label(fontStyle: .RegularBodySmall)
public let body2 = Label.createLabelRegularBodySmall(true)
public let twoLinkView = TwoLinkView() public let twoLinkView = TwoLinkView()
public let rightImage = LoadImageView() public let rightImage = LoadImageView()
let verticalStack: Stack<StackModel> let verticalStack: Stack<StackModel>
@ -81,10 +80,10 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
eyebrow.styleRegularMicro(true) eyebrow.setFontStyle(.RegularMicro)
headline.styleBoldTitleMedium(true) headline.setFontStyle(.BoldTitleMedium)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
body2.styleRegularBodySmall(true) body2.setFontStyle(.RegularBodySmall)
eyebrow.textColor = .mvmCoolGray6 eyebrow.textColor = .mvmCoolGray6
} }

View File

@ -15,11 +15,11 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
var stack: Stack<StackModel> var stack: Stack<StackModel>
let label1 = Label.createLabelRegularBodySmall(true) let label1 = Label(fontStyle: .RegularBodySmall)
let label2 = Label.createLabelRegularBodySmall(true) let label2 = Label(fontStyle: .RegularBodySmall)
let label3 = Label.createLabelRegularBodySmall(true) let label3 = Label(fontStyle: .RegularBodySmall)
let label4 = Label.createLabelRegularBodySmall(true) let label4 = Label(fontStyle: .RegularBodySmall)
let arrow = Arrow() let arrow = Arrow(frame: .zero)
let arrowAndLabel2Stack: Stack<StackModel> let arrowAndLabel2Stack: Stack<StackModel>
//----------------------------------------------------- //-----------------------------------------------------
@ -81,10 +81,10 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
label1.styleRegularBodySmall(true) label1.setFontStyle(.RegularBodySmall)
label2.styleRegularBodySmall(true) label2.setFontStyle(.RegularBodySmall)
label3.styleRegularBodySmall(true) label3.setFontStyle(.RegularBodySmall)
label4.styleRegularBodySmall(true) label4.setFontStyle(.RegularBodySmall)
} }
//----------------------------------------------------- //-----------------------------------------------------

View File

@ -15,8 +15,8 @@ import UIKit
//-------------------------------------------------- //--------------------------------------------------
let leftImage = LoadImageView(pinnedEdges: .all) let leftImage = LoadImageView(pinnedEdges: .all)
let leftLabel = Label.createLabelRegularBodySmall(true) let leftLabel = Label(fontStyle: .RegularBodySmall)
let rightLabel = Label.createLabelRegularBodySmall(true) let rightLabel = Label(fontStyle: .RegularBodySmall)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//-------------------------------------------------- //--------------------------------------------------
@ -73,8 +73,8 @@ import UIKit
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleRegularBodySmall(true) leftLabel.setFontStyle(.RegularBodySmall)
rightLabel.styleRegularBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
} }
func updateAccessibilityLabel() { func updateAccessibilityLabel() {

View File

@ -16,7 +16,7 @@ import Foundation
public let leftImage = LoadImageView() public let leftImage = LoadImageView()
public let headlineBody = HeadlineBody() public let headlineBody = HeadlineBody()
public let rightLabel = Label.createLabelRegularBodySmall(true) public let rightLabel = Label(fontStyle: .RegularBodySmall)
public let rightLabelStackItem: StackItem public let rightLabelStackItem: StackItem
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
@ -85,7 +85,7 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
rightLabel.styleRegularBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -12,15 +12,9 @@ import Foundation
@objcMembers open class ListLeftVariableNumberedListAllTextAndLinks: TableViewCell { @objcMembers open class ListLeftVariableNumberedListAllTextAndLinks: TableViewCell {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//-------------------------------------------------- //-----------------------------------------------------
public let leftLabel = Label(fontStyle: .Title2XLarge)
public let leftLabel = Label.createLabelTitle2XLarge(true) public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink(frame: .zero)
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
//-------------------------------------------------- //--------------------------------------------------
@ -69,7 +63,7 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleTitle2XLarge(true) leftLabel.setFontStyle(.Title2XLarge)
} }
open override func layoutSubviews() { open override func layoutSubviews() {

View File

@ -48,7 +48,7 @@ import UIKit
addMolecule(stack) addMolecule(stack)
stack.restack() stack.restack()
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true) eyebrowHeadlineBodyLink.headline.setFontStyle(.BoldBodySmall)
accessibilityTraits = radioButton.accessibilityTraits accessibilityTraits = radioButton.accessibilityTraits
accessibilityHint = radioButton.accessibilityHint accessibilityHint = radioButton.accessibilityHint
@ -63,7 +63,7 @@ import UIKit
open override func reset() { open override func reset() {
super.reset() super.reset()
eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA eyebrowHeadlineBodyLink.body.textColor = .mvmOrangeAA
eyebrowHeadlineBodyLink.headline.styleBoldBodySmall(true) eyebrowHeadlineBodyLink.headline.setFontStyle(.BoldBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -15,10 +15,10 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
var stack: Stack<StackModel> var stack: Stack<StackModel>
let eyebrow = Label.createLabelRegularMicro(true) let eyebrow = Label(fontStyle: .RegularMicro)
let headline = Label.createLabelBoldTitleMedium(true) let headline = Label(fontStyle: .BoldTitleMedium)
let subHeadline = Label.createLabelBoldBodySmall(true) let subHeadline = Label(fontStyle: .BoldBodySmall)
let body = Label.createLabelRegularBodySmall(true) let body = Label(fontStyle: .RegularBodySmall)
let link = Link() let link = Link()
//----------------------------------------------------- //-----------------------------------------------------
@ -62,10 +62,10 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
eyebrow.styleRegularMicro(true) eyebrow.setFontStyle(.RegularMicro)
headline.styleBoldTitleMedium(true) headline.setFontStyle(.BoldTitleMedium)
subHeadline.styleBoldBodySmall(true) subHeadline.setFontStyle(.BoldBodySmall)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -10,18 +10,9 @@ import Foundation
@objcMembers open class ListRVWheel: TableViewCell { @objcMembers open class ListRVWheel: TableViewCell {
//-------------------------------------------------- let wheel = Wheel(frame: .zero)
// MARK: - Outlets let leftLabel = Label(fontStyle: .BoldBodySmall)
//-------------------------------------------------- let rightLabel = Label(fontStyle: .RegularBodySmall)
let wheel = Wheel()
let leftLabel = Label.createLabelBoldBodySmall(true)
let rightLabel = Label.createLabelRegularBodySmall(true)
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
var stack: Stack<StackModel> var stack: Stack<StackModel>
//----------------------------------------------------- //-----------------------------------------------------
@ -71,8 +62,8 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
rightLabel.styleRegularBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
} }
public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? { public override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {

View File

@ -12,9 +12,8 @@ import Foundation
@objcMembers open class ListRightVariablePayments: TableViewCell { @objcMembers open class ListRightVariablePayments: TableViewCell {
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-------------------------------------------------------
let leftLabel = Label(fontStyle: .BoldBodySmall)
let leftLabel = Label.createLabelBoldBodySmall(true)
let rightImage = LoadImageView(pinnedEdges: .all) let rightImage = LoadImageView(pinnedEdges: .all)
var stack: Stack<StackModel> var stack: Stack<StackModel>
@ -65,7 +64,7 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -16,7 +16,7 @@ import Foundation
public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink() public let eyebrowHeadlineBodyLink = EyebrowHeadlineBodyLink()
public let arrow = Arrow() public let arrow = Arrow()
public let rightLabel = Label.createLabelRegularBodySmall(true) public let rightLabel = Label(fontStyle: .RegularBodySmall)
private let stack: Stack<StackModel> private let stack: Stack<StackModel>
private let arrowStackItem: StackItem private let arrowStackItem: StackItem
private let rightLabelStackItem: StackItem private let rightLabelStackItem: StackItem

View File

@ -13,15 +13,10 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
private let stack: Stack<StackModel>
public let headlineBody = HeadlineBody() public let headlineBody = HeadlineBody()
public let arrow = Arrow() public let arrow = Arrow()
public let rightLabel = Label.createLabelRegularBodySmall(true) public let rightLabel = Label(fontStyle: .RegularBodySmall)
//-----------------------------------------------------
// MARK: - Properties
//-----------------------------------------------------
let arrowAndRightLabelStack: Stack<StackModel> let arrowAndRightLabelStack: Stack<StackModel>
private let stack: Stack<StackModel> private let stack: Stack<StackModel>

View File

@ -13,9 +13,9 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
public var stack: Stack<StackModel>
public let leftLabel = Label.createLabelBoldBodySmall(true) public let leftLabel = Label(fontStyle: .BoldBodySmall)
public let rightLabel = Label.createLabelRegularBodySmall(true) public let rightLabel = Label(fontStyle: .RegularBodySmall)
public let bar = Line() public let bar = Line()
//----------------------------------------------------- //-----------------------------------------------------
@ -76,9 +76,8 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.setFontStyle(.BoldBodySmall)
leftLabel.styleBoldBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
rightLabel.styleRegularBodySmall(true)
bar.setStyle(.heavy) bar.setStyle(.heavy)
} }

View File

@ -12,11 +12,10 @@ import Foundation
@objcMembers open class ListThreeColumnDataUsage: TableViewCell { @objcMembers open class ListThreeColumnDataUsage: TableViewCell {
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-------------------------------------------------------
public let leftLabel = Label(fontStyle: .RegularBodySmall)
public let leftLabel = Label.createLabelRegularBodySmall(true) public let centerLabel = Label(fontStyle: .RegularBodySmall)
public let centerLabel = Label.createLabelRegularBodySmall(true) public let rightLabel = Label(fontStyle: .RegularBodySmall)
public let rightLabel = Label.createLabelRegularBodySmall(true)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//------------------------------------------------------ //------------------------------------------------------
@ -68,9 +67,9 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleRegularBodySmall(true) leftLabel.setFontStyle(.RegularBodySmall)
centerLabel.styleRegularBodySmall(true) centerLabel.setFontStyle(.RegularBodySmall)
rightLabel.styleRegularBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -16,10 +16,10 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
open var stack: Stack<StackModel> open var stack: Stack<StackModel>
public let leftLabel = Label.createLabelRegularBodySmall(true) public let leftLabel = Label(fontStyle: .RegularBodySmall)
public let centerLabel = Label.createLabelRegularBodySmall(true) public let centerLabel = Label(fontStyle: .RegularBodySmall)
public let rightLabel = Label.createLabelRegularBodySmall(true) public let rightLabel = Label(fontStyle: .RegularBodySmall)
public let arrow = Arrow() public let arrow = Arrow(frame: .zero)
public let arrowAndLabel2Stack: Stack<StackModel> public let arrowAndLabel2Stack: Stack<StackModel>
//----------------------------------------------------- //-----------------------------------------------------
@ -77,9 +77,9 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleRegularBodySmall(true) leftLabel.setFontStyle(.RegularBodySmall)
centerLabel.styleRegularBodySmall(true) centerLabel.setFontStyle(.RegularBodySmall)
rightLabel.styleRegularBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -83,14 +83,14 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftHeadlineBodyLink.headline1.styleBoldBodySmall(true) leftHeadline1.setFontStyle(.BoldBodySmall)
leftHeadlineBodyLink.headline2.styleBoldBodySmall(true) leftHeadline2.setFontStyle(.BoldBodySmall)
leftHeadlineBodyLink.headline3.styleBoldBodySmall(true) leftHeadline3.setFontStyle(.BoldBodySmall)
leftHeadlineBodyLink.body.styleRegularBodySmall(true) leftBody.setFontStyle(.RegularBodySmall)
rightHeadlineBodyLink.headline1.styleBoldBodySmall(true) rightHeadline1.setFontStyle(.BoldBodySmall)
rightHeadlineBodyLink.headline2.styleBoldBodySmall(true) rightHeadline2.setFontStyle(.BoldBodySmall)
rightHeadlineBodyLink.headline3.styleBoldBodySmall(true) rightHeadline3.setFontStyle(.BoldBodySmall)
rightHeadlineBodyLink.body.styleRegularBodySmall(true) rightBody.setFontStyle(.RegularBodySmall)
} }
public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { public override class func estimatedHeight(with molecule: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {

View File

@ -12,12 +12,11 @@ import Foundation
@objcMembers open class ListTwoColumnPriceDescription: TableViewCell { @objcMembers open class ListTwoColumnPriceDescription: TableViewCell {
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-------------------------------------------------------
public let leftHeadline = Label(fontStyle: .BoldBodySmall)
public let leftHeadline = Label.createLabelBoldBodySmall(true) public let leftBody = Label(fontStyle: .RegularBodySmall)
public let leftBody = Label.createLabelRegularBodySmall(true) public let rightLabel = Label(fontStyle: .RegularBodySmall)
public let rightLabel = Label.createLabelRegularBodySmall(true) public let rightSubLabel = Label(fontStyle: .RegularBodySmall)
public let rightSubLabel = Label.createLabelRegularBodySmall(true)
public let view = MVMCoreUICommonViewsUtility.commonView() public let view = MVMCoreUICommonViewsUtility.commonView()
public let leftVerticalStack: UIStackView public let leftVerticalStack: UIStackView
@ -97,10 +96,10 @@ import Foundation
super.reset() super.reset()
leftVerticalStack.reset() leftVerticalStack.reset()
rightVerticalStack.reset() rightVerticalStack.reset()
leftHeadline.styleBoldBodySmall(true) leftHeadline.setFontStyle(.BoldBodySmall)
leftBody.styleRegularBodySmall(true) leftBody.setFontStyle(.RegularBodySmall)
rightLabel.styleRegularBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
rightSubLabel.styleRegularBodySmall(true) rightSubLabel.setFontStyle(.RegularBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -14,8 +14,8 @@ import UIKit
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
let leftLabel = Label.createLabelRegularBodySmall(true) let leftLabel = Label(fontStyle: .RegularBodySmall)
let rightLabel = Label.createLabelRegularBodySmall(true) let rightLabel = Label(fontStyle: .RegularBodySmall)
let view = MVMCoreUICommonViewsUtility.commonView() let view = MVMCoreUICommonViewsUtility.commonView()
//-------------------------------------------------- //--------------------------------------------------
@ -59,8 +59,8 @@ import UIKit
super.reset() super.reset()
leftLabel.reset() leftLabel.reset()
rightLabel.reset() rightLabel.reset()
leftLabel.styleRegularBodySmall(true) leftLabel.setFontStyle(.RegularBodySmall)
rightLabel.styleRegularBodySmall(true) rightLabel.setFontStyle(.RegularBodySmall)
} }
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {

View File

@ -13,10 +13,9 @@ import UIKit
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
let progressBar = MultiProgress() let progressBar = MultiProgress()
let leftLabel = Label.createLabelBoldBodySmall(true) let leftLabel = Label(fontStyle: .BoldBodySmall)
let rightLabel = Label.createLabelBoldBodySmall(true) let rightLabel = Label(fontStyle: .BoldBodySmall)
let view = MVMCoreUICommonViewsUtility.commonView() let view = MVMCoreUICommonViewsUtility.commonView()
//----------------------------------------------------- //-----------------------------------------------------
@ -52,8 +51,8 @@ import UIKit
progressBar.reset() progressBar.reset()
leftLabel.reset() leftLabel.reset()
rightLabel.reset() rightLabel.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
rightLabel.styleBoldBodySmall(true) rightLabel.setFontStyle(.BoldBodySmall)
} }
//----------------------------------------------------- //-----------------------------------------------------

View File

@ -14,10 +14,11 @@ import Foundation
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
let label1 = Label.createLabelBoldBodySmall(true) // MARK: - MFViewProtocol
let label2 = Label.createLabelBoldBodySmall(true) let label1 = Label(fontStyle: .BoldBodySmall)
let label3 = Label.createLabelBoldBodySmall(true) let label2 = Label(fontStyle: .BoldBodySmall)
let label4 = Label.createLabelBoldBodySmall(true) let label3 = Label(fontStyle: .BoldBodySmall)
let label4 = Label(fontStyle: .BoldBodySmall)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//-------------------------------------------------- //--------------------------------------------------
@ -71,10 +72,10 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
label1.styleBoldBodySmall(true) label1.setFontStyle(.BoldBodySmall)
label2.styleBoldBodySmall(true) label2.setFontStyle(.BoldBodySmall)
label3.styleBoldBodySmall(true) label3.setFontStyle(.BoldBodySmall)
label4.styleBoldBodySmall(true) label4.setFontStyle(.BoldBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -15,8 +15,8 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
public let headline = Label.createLabelBoldBodySmall(true) public let headline = Label(fontStyle: .BoldBodySmall)
public let body = Label.createLabelRegularBodySmall(true) public let body = Label(fontStyle: .RegularBodySmall)
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
@ -65,8 +65,8 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
headline.styleBoldBodySmall(true) headline.setFontStyle(.BoldBodySmall)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -15,8 +15,8 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
public let headline = Label.createLabelBoldTitleMedium(true) public let headline = Label(fontStyle: .BoldTitleMedium)
public let body = Label.createLabelRegularBodySmall(true) public let body = Label(fontStyle: .RegularBodySmall)
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
@ -65,8 +65,8 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
headline.styleBoldTitleMedium(true) headline.setFontStyle(.BoldTitleMedium)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -15,8 +15,8 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
public var stack: Stack<StackModel> public var stack: Stack<StackModel>
public let headline = Label.createLabelBoldTitleMedium(true) public let headline = Label(fontStyle: .BoldTitleMedium)
public let body = Label.createLabelRegularBodySmall(true) public let body = Label(fontStyle: .RegularBodySmall)
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Initializers // MARK: - Initializers
@ -64,8 +64,8 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
headline.styleBoldTitleMedium(true) headline.setFontStyle(.BoldTitleMedium)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -14,9 +14,9 @@ import Foundation
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
public let leftLabel = Label.createLabelBoldBodySmall(true) public let leftLabel = Label(fontStyle: .BoldBodySmall)
public let centerLabel = Label.createLabelBoldBodySmall(true) public let centerLabel = Label(fontStyle: .BoldBodySmall)
public let rightLabel = Label.createLabelBoldBodySmall(true) public let rightLabel = Label(fontStyle: .BoldBodySmall)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//----------------------------------------------------- //-----------------------------------------------------
@ -68,9 +68,9 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
centerLabel.styleBoldBodySmall(true) centerLabel.setFontStyle(.BoldBodySmall)
rightLabel.styleBoldBodySmall(true) rightLabel.setFontStyle(.BoldBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -12,11 +12,10 @@ import Foundation
@objcMembers open class ListThreeColumnDataUsageDivider: TableViewCell { @objcMembers open class ListThreeColumnDataUsageDivider: TableViewCell {
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-------------------------------------------------------
public let leftLabel = Label(fontStyle: .BoldBodySmall)
public let leftLabel = Label.createLabelBoldBodySmall(true) public let centerLabel = Label(fontStyle: .BoldBodySmall)
public let centerLabel = Label.createLabelBoldBodySmall(true) public let rightLabel = Label(fontStyle: .BoldBodySmall)
public let rightLabel = Label.createLabelBoldBodySmall(true)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//------------------------------------------------------ //------------------------------------------------------
@ -68,9 +67,9 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
centerLabel.styleBoldBodySmall(true) centerLabel.setFontStyle(.BoldBodySmall)
rightLabel.styleBoldBodySmall(true) rightLabel.setFontStyle(.BoldBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -13,10 +13,9 @@ import Foundation
//----------------------------------------------------- //-----------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//----------------------------------------------------- //-----------------------------------------------------
let leftLabel = Label(fontStyle: .BoldBodySmall)
let leftLabel = Label.createLabelBoldBodySmall(true) let centerLabel = Label(fontStyle: .BoldBodySmall)
let centerLabel = Label.createLabelBoldBodySmall(true) let rightLabel = Label(fontStyle: .BoldBodySmall)
let rightLabel = Label.createLabelBoldBodySmall(true)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//------------------------------------------------------ //------------------------------------------------------
@ -67,9 +66,9 @@ import Foundation
override open func reset() { override open func reset() {
super.reset() super.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
centerLabel.styleBoldBodySmall(true) centerLabel.setFontStyle(.BoldBodySmall)
rightLabel.styleBoldBodySmall(true) rightLabel.setFontStyle(.BoldBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -13,10 +13,9 @@ import Foundation
//------------------------------------------------------- //-------------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//------------------------------------------------------- //-------------------------------------------------------
let leftLabel = Label(fontStyle: .BoldBodySmall)
let leftLabel = Label.createLabelBoldBodySmall(true) let centerLabel = Label(fontStyle: .BoldBodySmall)
let centerLabel = Label.createLabelBoldBodySmall(true) let rightLabel = Label(fontStyle: .BoldBodySmall)
let rightLabel = Label.createLabelBoldBodySmall(true)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//------------------------------------------------------- //-------------------------------------------------------
@ -68,9 +67,9 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
centerLabel.styleBoldBodySmall(true) centerLabel.setFontStyle(.BoldBodySmall)
rightLabel.styleBoldBodySmall(true) rightLabel.setFontStyle(.BoldBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -13,9 +13,8 @@ import Foundation
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Outlets // MARK: - Outlets
//-------------------------------------------------- //--------------------------------------------------
let leftLabel = Label(fontStyle: .BoldBodySmall)
let leftLabel = Label.createLabelBoldBodySmall(true) let rightLabel = Label(fontStyle: .BoldBodySmall)
let rightLabel = Label.createLabelBoldBodySmall(true)
var stack: Stack<StackModel> var stack: Stack<StackModel>
//-------------------------------------------------- //--------------------------------------------------
@ -65,8 +64,8 @@ import Foundation
open override func reset() { open override func reset() {
super.reset() super.reset()
leftLabel.styleBoldBodySmall(true) leftLabel.setFontStyle(.BoldBodySmall)
rightLabel.styleBoldBodySmall(true) rightLabel.setFontStyle(.BoldBodySmall)
} }
//---------------------------------------------------- //----------------------------------------------------

View File

@ -14,7 +14,7 @@ open class ColorViewWithLabel: View {
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public var label = Label.createLabelRegularBodySmall(true) public var label = Label(fontStyle: .RegularBodySmall, true)
public var colorView = View() public var colorView = View()
private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: 8)! private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: 8)!

View File

@ -15,8 +15,8 @@ open class DoughnutChart: View {
//-------------------------------------------------- //--------------------------------------------------
public var doughnutLayer = CALayer() public var doughnutLayer = CALayer()
public var titleLabel = Label.createLabelBoldTitleLarge(true) public var titleLabel = Label(fontStyle: .BoldTitleLarge)
public var subTitleLabel = Label.createLabelRegularMicro(true) public var subTitleLabel = Label(fontStyle: .RegularMicro)
public var labelContainer = MVMCoreUICommonViewsUtility.commonView() public var labelContainer = MVMCoreUICommonViewsUtility.commonView()
public static let heightConstant: CGFloat = 136 public static let heightConstant: CGFloat = 136
private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: heightConstant)! private var sizeObject = MFStyler.sizeObjectGeneric(forCurrentDevice: heightConstant)!

View File

@ -18,7 +18,7 @@ import UIKit
open override func setupView() { open override func setupView() {
super.setupView() super.setupView()
headlineBody.headlineLabel.styleBoldBodySmall(true) headlineBody.headlineLabel.setFontStyle(.BoldBodySmall)
headlineBody.spaceBetweenLabelsConstant = 0 headlineBody.spaceBetweenLabelsConstant = 0
imageView.addSizeConstraintsForAspectRatio = true imageView.addSizeConstraintsForAspectRatio = true
@ -43,7 +43,7 @@ import UIKit
open override func reset() { open override func reset() {
super.reset() super.reset()
headlineBody.reset() headlineBody.reset()
headlineBody.headlineLabel.styleBoldBodySmall(true) headlineBody.headlineLabel.setFontStyle(.BoldBodySmall)
headlineBody.spaceBetweenLabelsConstant = 0 headlineBody.spaceBetweenLabelsConstant = 0
imageView.reset() imageView.reset()
} }

View File

@ -13,6 +13,12 @@ import Foundation
open override class var identifier: String { open override class var identifier: String {
return "collectionItem" return "collectionItem"
} }
public var action: ActionModelProtocol?
private enum CodingKeys: String, CodingKey {
case action
}
/// Defaults to set /// Defaults to set
public override func setDefaults() { public override func setDefaults() {
@ -35,10 +41,14 @@ import Foundation
} }
required public init(from decoder: Decoder) throws { required public init(from decoder: Decoder) throws {
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
try super.init(from: decoder) try super.init(from: decoder)
} }
public override func encode(to encoder: Encoder) throws { public override func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeModelIfPresent(action, forKey: .action)
try super.encode(to: encoder) try super.encode(to: encoder)
} }
} }

View File

@ -10,10 +10,10 @@ import UIKit
@objcMembers public class CornerLabels: View { @objcMembers public class CornerLabels: View {
var middleView: UIView? var middleView: UIView?
let topLeftLabel = Label.createLabelBoldBodySmall(true) let topLeftLabel = Label(fontStyle: .BoldBodySmall)
let topRightLabel = Label.createLabelBoldBodySmall(true) let topRightLabel = Label(fontStyle: .BoldBodySmall)
let bottomLeftLabel = Label.createLabelRegularMicro(true) let bottomLeftLabel = Label(fontStyle: .RegularMicro)
let bottomRightLabel = Label.createLabelRegularMicro(true) let bottomRightLabel = Label(fontStyle: .RegularMicro)
let topLabelsView = MVMCoreUICommonViewsUtility.commonView() let topLabelsView = MVMCoreUICommonViewsUtility.commonView()
let bottomLabelsView = MVMCoreUICommonViewsUtility.commonView() let bottomLabelsView = MVMCoreUICommonViewsUtility.commonView()
@ -151,10 +151,10 @@ import UIKit
} }
func styleDefault() { func styleDefault() {
topLeftLabel.styleBoldBodySmall(true) topLeftLabel.setFontStyle(.BoldBodySmall)
topRightLabel.styleBoldBodySmall(true) topRightLabel.setFontStyle(.BoldBodySmall)
bottomLeftLabel.styleRegularMicro(true) bottomLeftLabel.setFontStyle(.RegularMicro)
bottomRightLabel.styleRegularMicro(true) bottomRightLabel.setFontStyle(.RegularMicro)
} }
public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat { public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {

View File

@ -14,7 +14,7 @@ import UIKit
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
public let label = Label.createLabelBoldBodySmall(true) public let label = Label(fontStyle: .BoldBodySmall)
public let toggle = Toggle() public let toggle = Toggle()
//-------------------------------------------------- //--------------------------------------------------
@ -58,6 +58,6 @@ import UIKit
super.reset() super.reset()
label.reset() label.reset()
toggle.reset() toggle.reset()
label.styleBoldBodySmall(true) label.setFontStyle(.BoldBodySmall)
} }
} }

View File

@ -18,6 +18,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
public var backgroundColor: Color? public var backgroundColor: Color?
public var tintColor: Color public var tintColor: Color
public var line: LineModel? public var line: LineModel?
public var alwaysShowBackButton = false
public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "back", action: ActionBackModel()) public var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? = NavigationImageButtonModel(with: "back", action: ActionBackModel())
public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? public var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? public var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]?
@ -30,11 +31,13 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
} }
private enum CodingKeys: String, CodingKey { private enum CodingKeys: String, CodingKey {
case moleculeName
case title case title
case hidden case hidden
case backgroundColor case backgroundColor
case tintColor case tintColor
case line case line
case alwaysShowBackButton
case backButton case backButton
case showLeftPanelButton case showLeftPanelButton
case showRightPanelButton case showRightPanelButton
@ -49,6 +52,7 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) ?? Color(uiColor: .white)
tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black) tintColor = try typeContainer.decodeIfPresent(Color.self, forKey: .tintColor) ?? Color(uiColor: .black)
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line) line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
alwaysShowBackButton = try typeContainer.decodeIfPresent(Bool.self, forKey: .alwaysShowBackButton) ?? false
if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) { if let backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol) = try typeContainer.decodeModelIfPresent(codingKey: .backButton) {
self.backButton = backButton self.backButton = backButton
} }
@ -58,11 +62,13 @@ public class NavigationItemModel: NavigationItemModelProtocol, MoleculeModelProt
open func encode(to encoder: Encoder) throws { open func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(title, forKey: .title) try container.encodeIfPresent(title, forKey: .title)
try container.encode(hidden, forKey: .hidden) try container.encode(hidden, forKey: .hidden)
try container.encode(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encode(tintColor, forKey: .tintColor) try container.encode(tintColor, forKey: .tintColor)
try container.encodeIfPresent(line, forKey: .line) try container.encodeIfPresent(line, forKey: .line)
try container.encode(alwaysShowBackButton, forKey: .alwaysShowBackButton)
try container.encodeModelIfPresent(backButton, forKey: .backButton) try container.encodeModelIfPresent(backButton, forKey: .backButton)
try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons) try container.encodeModelsIfPresent(additionalLeftButtons, forKey: .additionalLeftButtons)
try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons) try container.encodeModelsIfPresent(additionalRightButtons, forKey: .additionalRightButtons)

View File

@ -14,9 +14,9 @@ import UIKit
//-------------------------------------------------- //--------------------------------------------------
public let stack = Stack<StackModel>(frame: .zero) public let stack = Stack<StackModel>(frame: .zero)
public let eyebrow = Label.createLabelRegularMicro(true) public let eyebrow = Label(fontStyle: .RegularMicro)
public let headline = Label.createLabelBoldBodySmall(true) public let headline = Label(fontStyle: .BoldBodySmall)
public let body = Label.createLabelRegularBodySmall(true) public let body = Label(fontStyle: .RegularBodySmall, true)
public let link = Link() public let link = Link()
var castModel: EyebrowHeadlineBodyLinkModel? { var castModel: EyebrowHeadlineBodyLinkModel? {
@ -48,9 +48,9 @@ import UIKit
open override func reset() { open override func reset() {
super.reset() super.reset()
stack.reset() stack.reset()
eyebrow.styleRegularMicro(true) eyebrow.setFontStyle(.RegularMicro)
headline.styleBoldBodySmall(true) headline.setFontStyle(.BoldBodySmall)
body.styleRegularBodySmall(true) body.setFontStyle(.RegularBodySmall)
} }
//-------------------------------------------------- //--------------------------------------------------

View File

@ -10,8 +10,8 @@ import UIKit
open class HeadlineBody: View { open class HeadlineBody: View {
let headlineLabel = Label.createLabelBoldTitleLarge(true) let headlineLabel = Label(fontStyle: .BoldTitleLarge)
let messageLabel = Label.createLabelRegularBodySmall(true) let messageLabel = Label(fontStyle: .RegularBodySmall)
var spaceBetweenLabelsConstant = PaddingOne var spaceBetweenLabelsConstant = PaddingOne
var spaceBetweenLabels: NSLayoutConstraint? var spaceBetweenLabels: NSLayoutConstraint?
var leftConstraintTitle: NSLayoutConstraint? var leftConstraintTitle: NSLayoutConstraint?
@ -39,26 +39,26 @@ open class HeadlineBody: View {
} }
func styleLandingPageHeader() { func styleLandingPageHeader() {
headlineLabel.styleTitle2XLarge(true) headlineLabel.setFontStyle(.Title2XLarge)
messageLabel.styleRegularBodySmall(true) messageLabel.setFontStyle(.RegularBodySmall)
spaceBetweenLabelsConstant = PaddingTwo spaceBetweenLabelsConstant = PaddingTwo
} }
func stylePageHeader() { func stylePageHeader() {
headlineLabel.styleBoldTitleLarge(true) headlineLabel.setFontStyle(.BoldTitleLarge)
messageLabel.styleRegularBodySmall(true) messageLabel.setFontStyle(.RegularBodySmall)
spaceBetweenLabelsConstant = PaddingOne spaceBetweenLabelsConstant = PaddingOne
} }
func styleListItem() { func styleListItem() {
headlineLabel.styleBoldBodySmall(true) headlineLabel.setFontStyle(.BoldBodySmall)
messageLabel.styleRegularBodySmall(true) messageLabel.setFontStyle(.RegularBodySmall)
spaceBetweenLabelsConstant = 0 spaceBetweenLabelsConstant = 0
} }
func styleListItemDivider() { func styleListItemDivider() {
headlineLabel.styleBoldTitleMedium(true) headlineLabel.setFontStyle(.BoldTitleMedium)
messageLabel.styleRegularBodySmall(true) messageLabel.setFontStyle(.RegularBodySmall)
spaceBetweenLabelsConstant = 0 spaceBetweenLabelsConstant = 0
} }

View File

@ -9,7 +9,7 @@
import Foundation import Foundation
open class StringAndMoleculeView: View { open class StringAndMoleculeView: View {
var label = Label.createLabelRegularBodySmall(true) var label = Label(fontStyle: .RegularBodySmall)
var molecule: MoleculeViewProtocol var molecule: MoleculeViewProtocol
var leftWidthConstraint: NSLayoutConstraint? var leftWidthConstraint: NSLayoutConstraint?

View File

@ -19,8 +19,14 @@ public protocol CarouselPageControlProtocol {
open class Carousel: View { open class Carousel: View {
public let collectionView = CollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()) public let collectionView: CollectionView = {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
layout.minimumInteritemSpacing = 0
layout.minimumLineSpacing = 0
return CollectionView(frame: .zero, collectionViewLayout: layout)
}()
/// The current index of the collection view. Includes dummy cells when looping. /// The current index of the collection view. Includes dummy cells when looping.
public var currentIndex = 0 public var currentIndex = 0
@ -36,13 +42,13 @@ open class Carousel: View {
open var numberOfPages = 0 open var numberOfPages = 0
/// The models for the molecules. /// The models for the molecules.
var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]? public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]?
/// The horizontal alignment of the cell in the collection view. Only noticeable if the itemWidthPercent is less than 100%. /// The horizontal alignment of the cell in the collection view. Only noticeable if the itemWidthPercent is less than 100%.
public var itemAlignment = UICollectionView.ScrollPosition.left public var itemAlignment = UICollectionView.ScrollPosition.left
/// From 0-1. The item width as a percent of the carousel width. /// From 0-1. The item width as a percent of the carousel width.
public var itemWidthPercent: Float = 1 public var itemWidthPercent: CGFloat = 1
/// The height of the carousel. Default is 300. /// The height of the carousel. Default is 300.
public var collectionViewHeight: NSLayoutConstraint? public var collectionViewHeight: NSLayoutConstraint?
@ -51,7 +57,7 @@ open class Carousel: View {
public var pagingView: (UIView & CarouselPageControlProtocol)? public var pagingView: (UIView & CarouselPageControlProtocol)?
/// If the carousel should loop after scrolling past the first and final cells. /// If the carousel should loop after scrolling past the first and final cells.
var loop = false public var loop = false
private var dragging = false private var dragging = false
@ -81,6 +87,8 @@ open class Carousel: View {
showPeaking(false) showPeaking(false)
// Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled. // Go to current cell. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking logic. The dispatch is a sad way to ensure the collection view is ready to be scrolled.
guard let model = model as? CarouselModel,
(model.paging == true || model.loop == true) else { return }
DispatchQueue.main.async { DispatchQueue.main.async {
self.collectionView.scrollToItem(at: IndexPath(row: self.currentIndex, section: 0), at: self.itemAlignment, animated: false) self.collectionView.scrollToItem(at: IndexPath(row: self.currentIndex, section: 0), at: self.itemAlignment, animated: false)
self.collectionView.layoutIfNeeded() self.collectionView.layoutIfNeeded()
@ -98,15 +106,23 @@ open class Carousel: View {
collectionView.delegate = self collectionView.delegate = self
addSubview(collectionView) addSubview(collectionView)
bottomPin = NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView)?[ConstraintBot] as? NSLayoutConstraint bottomPin = NSLayoutConstraint.constraintPinSubview(toSuperview: collectionView)?[ConstraintBot] as? NSLayoutConstraint
collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 300) collectionViewHeight = collectionView.heightAnchor.constraint(equalToConstant: 300)
collectionViewHeight?.isActive = false collectionViewHeight?.isActive = true
} }
open override func updateView(_ size: CGFloat) { open override func updateView(_ size: CGFloat) {
super.updateView(size) super.updateView(size)
self.size = size self.size = size
// Set insets for the carousel.
var inset = UIEdgeInsets.zero
let carouselModel = model as? CarouselModel
if carouselModel?.useHorizontalMargins ?? false {
inset.left = carouselModel?.leftPadding ?? Padding.Component.horizontalPaddingForSize(size)
inset.right = carouselModel?.rightPadding ?? Padding.Component.horizontalPaddingForSize(size)
}
(collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.sectionInset = inset
// Update cells and re-layout. // Update cells and re-layout.
for cell in collectionView.visibleCells { for cell in collectionView.visibleCells {
(cell as? MVMCoreViewProtocol)?.updateView(size) (cell as? MVMCoreViewProtocol)?.updateView(size)
@ -128,19 +144,19 @@ open class Carousel: View {
collectionView.layer.borderColor = backgroundColor?.cgColor collectionView.layer.borderColor = backgroundColor?.cgColor
collectionView.layer.borderWidth = (carouselModel.border ?? false) ? 1 : 0 collectionView.layer.borderWidth = (carouselModel.border ?? false) ? 1 : 0
backgroundColor = .white backgroundColor = .white
(collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing = carouselModel.spacing ?? 0
registerCells(with: carouselModel, delegateObject: delegateObject)
setupLayout(with: carouselModel) itemWidthPercent = carouselModel.itemWidthPercent / 100.0
prepareMolecules(with: carouselModel)
itemWidthPercent = (carouselModel.itemWidthPercent ?? 100) / 100
if let alignment = carouselModel.itemAlignment { if let alignment = carouselModel.itemAlignment {
itemAlignment = alignment itemAlignment = alignment
} }
if let height = carouselModel.height { if let height = carouselModel.height {
collectionViewHeight?.constant = CGFloat(height) collectionViewHeight?.constant = height
collectionViewHeight?.isActive = true
} }
registerCells(with: carouselModel, delegateObject: delegateObject)
prepareMolecules(with: carouselModel)
setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject) setupPagingMolecule(carouselModel.pagingMolecule, delegateObject: delegateObject)
@ -153,16 +169,6 @@ open class Carousel: View {
// MARK: - JSON Setters // MARK: - JSON Setters
//-------------------------------------------------- //--------------------------------------------------
/// Updates the layout being used
func setupLayout(with carouselModel: CarouselModel?) {
let layout = UICollectionViewFlowLayout()
layout.scrollDirection = .horizontal
layout.minimumLineSpacing = CGFloat(carouselModel?.spacing ?? 1)
layout.minimumInteritemSpacing = 0
collectionView.collectionViewLayout = layout
}
func prepareMolecules(with carouselModel: CarouselModel?) { func prepareMolecules(with carouselModel: CarouselModel?) {
guard let newMolecules = carouselModel?.molecules else { guard let newMolecules = carouselModel?.molecules else {
numberOfPages = 0 numberOfPages = 0
@ -187,11 +193,12 @@ open class Carousel: View {
/// Sets up the paging molecule /// Sets up the paging molecule
open func setupPagingMolecule(_ molecule: (CarouselPagingModelProtocol & MoleculeModelProtocol)?, delegateObject: MVMCoreUIDelegateObject?) { open func setupPagingMolecule(_ molecule: (CarouselPagingModelProtocol & MoleculeModelProtocol)?, delegateObject: MVMCoreUIDelegateObject?) {
var pagingView: (UIView & CarouselPageControlProtocol)? = nil var pagingView: (UIView & CarouselPageControlProtocol)? = nil
if let molecule = molecule { if let molecule = molecule,
(!molecule.hidesForSinglePage || numberOfPages > 1) {
pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol) pagingView = MoleculeObjectMapping.shared()?.createMolecule(molecule, delegateObject: delegateObject) as? (UIView & CarouselPageControlProtocol)
} }
addPaging(view: pagingView, position: (CGFloat(molecule?.position ?? 20))) addPaging(view: pagingView, position: molecule?.position ?? 20)
} }
/// Registers the cells with the collection view /// Registers the cells with the collection view
@ -294,7 +301,7 @@ open class Carousel: View {
extension Carousel: UICollectionViewDelegateFlowLayout { extension Carousel: UICollectionViewDelegateFlowLayout {
open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { open func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
let itemWidth = collectionView.bounds.width * CGFloat(itemWidthPercent) let itemWidth = collectionView.bounds.width * itemWidthPercent
return CGSize(width: itemWidth, height: collectionView.bounds.height) return CGSize(width: itemWidth, height: collectionView.bounds.height)
} }
@ -324,8 +331,15 @@ extension Carousel: UICollectionViewDataSource {
} }
} }
extension Carousel: UICollectionViewDelegate {
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
(collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol)?.didSelectCell(at: indexPath, delegateObject: delegateObject, additionalData: nil)
}
}
extension Carousel: UIScrollViewDelegate { extension Carousel: UIScrollViewDelegate {
/// Go to the cell at the specified index.
func goTo(_ index: Int, animated: Bool) { func goTo(_ index: Int, animated: Bool) {
showPeaking(false) showPeaking(false)
@ -339,51 +353,33 @@ extension Carousel: UIScrollViewDelegate {
} }
} }
func handleUserOnBufferCell() { /// Adjusts the current contentOffset if we are going onto buffer cells while looping to help with the endless scrolling appearance.
guard loop else { return } func adjustOffsetForLooping(_ scrollView: UIScrollView) {
let translatedPoint = scrollView.panGestureRecognizer.translation(in: scrollView.superview).x
let lastPageIndex = numberOfPages + 1 if translatedPoint > 0 {
let goToIndex = { (index: Int) in // Moving left, see if we are moving passed the first left buffer card and adjust
self.goTo(index, animated: false) if let threshold = collectionView.layoutAttributesForItem(at: IndexPath(item: 1, section: 0))?.frame.minX,
self.collectionView.layoutIfNeeded() scrollView.contentOffset.x < threshold,
self.pagingView?.currentIndex = self.pageIndex let newOffset = collectionView.layoutAttributesForItem(at: IndexPath(item: numberOfPages + 1, section: 0))?.frame.minX {
} scrollView.contentOffset.x = newOffset
}
if currentIndex < 2 { } else if translatedPoint < 0 {
// If on a "buffer" last row (which is the first index), go to the real last row secretly. layoutIfNeeded is needed otherwise cellForItem returns nil for peaking. // Moving right, see if we are moving passed the first right buffer card and adjust
goToIndex(lastPageIndex) if let threshold = collectionView.layoutAttributesForItem(at: IndexPath(item: numberOfPages + 2, section: 0))?.frame.maxX,
} else if currentIndex > lastPageIndex { scrollView.contentOffset.x + scrollView.bounds.width > threshold,
// If on the "buffer" first row (which is the index after the real last row), go to the real first row secretly. let newEndOffset = collectionView.layoutAttributesForItem(at: IndexPath(item: 2, section: 0))?.frame.maxX {
goToIndex(2) scrollView.contentOffset.x = newEndOffset - scrollView.bounds.width
}
}
func checkForDraggingOutOfBounds(_ scrollView: UIScrollView) {
guard loop, dragging else { return }
// Checks if the user is not paging but attempting to drag endlessly and goes out of bounds. Caps the index.
if let separatorWidth = (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing {
let itemWidth = collectionView.bounds.width * CGFloat(itemWidthPercent)
let index = scrollView.contentOffset.x / (itemWidth + separatorWidth)
let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1
if index < 1 {
currentIndex = 0
updateModelIndex()
} else if index > CGFloat(lastCellIndex - 1) {
currentIndex = lastCellIndex
updateModelIndex()
} }
} }
handleUserOnBufferCell()
} }
open func scrollViewDidScroll(_ scrollView: UIScrollView) { open func scrollViewDidScroll(_ scrollView: UIScrollView) {
// Check if the user is dragging the card even further past the next card. // Adjust for looping
//checkForDraggingOutOfBounds(scrollView) if let model = model as? CarouselModel,
model.loop == true {
adjustOffsetForLooping(scrollView)
}
// Let the pager know our progress if needed. // Let the pager know our progress if needed.
pagingView?.scrollViewDidScroll(collectionView) pagingView?.scrollViewDidScroll(collectionView)
@ -391,6 +387,7 @@ extension Carousel: UIScrollViewDelegate {
public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) { public func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
// Disable peaking when dragging.
dragging = true dragging = true
showPeaking(false) showPeaking(false)
} }
@ -398,32 +395,63 @@ extension Carousel: UIScrollViewDelegate {
public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { public func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
dragging = false dragging = false
targetContentOffset.pointee = scrollView.contentOffset
// This is for setting up smooth custom paging. (Since UICollectionView only handles paging based on collection view size and not cell size). // This is for setting up smooth custom paging. (Since UICollectionView only handles paging based on collection view size and not cell size). Math requires that we are using UICollectionViewFlowLayout.
guard let separatorWidth = (collectionView.collectionViewLayout as? UICollectionViewFlowLayout)?.minimumLineSpacing else { return } guard (model as? CarouselModel)?.paging == true,
let layout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout else { return }
// We switch cards if we pass the velocity threshold or position threshold (currently 50%). let separatorWidth = layout.minimumLineSpacing
let itemWidth = collectionView.bounds.width * CGFloat(itemWidthPercent) let itemWidth = collectionView.bounds.width * itemWidthPercent
var cellToSwipeTo = Int(scrollView.contentOffset.x / (itemWidth + separatorWidth) + 0.5) let width = itemWidth + separatorWidth
let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1
let velocityThreshold: CGFloat = 1.1
if velocity.x > velocityThreshold { // Adjusts the offset for the contentInset. Adds imaginary half separator to the left of the first card, which is necessary for determining the percent of a given card we are currently at.
cellToSwipeTo = currentIndex + 1 let adjustedOffset = scrollView.contentOffset.x - layout.sectionInset.left + (separatorWidth / 2)
} else if velocity.x < -velocityThreshold { // Calculates the offset per card depending on the alignment.
cellToSwipeTo = currentIndex - 1 var offsetByCard: CGFloat
switch itemAlignment {
case .right:
offsetByCard = ((adjustedOffset + scrollView.bounds.width) / width) - 1
case .centeredHorizontally:
offsetByCard = ((adjustedOffset + (scrollView.bounds.width / 2)) / width) - 0.5
default:
offsetByCard = adjustedOffset / width
} }
// Adjust card for velocity impact.
let velocityThreshold: CGFloat = 1.1
var cellToSwipeTo: Int
if velocity.x > velocityThreshold {
cellToSwipeTo = Int(ceil(offsetByCard))
} else if velocity.x < -velocityThreshold {
cellToSwipeTo = Int(floor(offsetByCard))
} else {
cellToSwipeTo = Int(round(offsetByCard))
}
// If we are swiping to a buffer cell, change to real cell before beginning animation so we don't go out of bounds.
if cellToSwipeTo < 2 {
let newOffset = scrollView.contentOffset.x + (width * CGFloat(numberOfPages))
scrollView.contentOffset.x = newOffset
targetContentOffset.pointee.x = newOffset
cellToSwipeTo = cellToSwipeTo + numberOfPages
} else if cellToSwipeTo > numberOfPages + 1 {
let newOffset = scrollView.contentOffset.x - (width * CGFloat(numberOfPages))
scrollView.contentOffset.x = newOffset
targetContentOffset.pointee.x = newOffset
cellToSwipeTo = cellToSwipeTo - numberOfPages
} else {
targetContentOffset.pointee = scrollView.contentOffset
}
// Cap the index. // Cap the index.
let lastCellIndex = collectionView(collectionView, numberOfItemsInSection: 0) - 1
goTo(min(max(cellToSwipeTo, 0), lastCellIndex), animated: true) goTo(min(max(cellToSwipeTo, 0), lastCellIndex), animated: true)
} }
// To give the illusion of endless scrolling. Since we are always calling scrollToItem we can assume finished paging in here. // To give the illusion of endless scrolling. Since we are always calling scrollToItem we can assume finished paging in here.
public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) { public func scrollViewDidEndScrollingAnimation(_ scrollView: UIScrollView) {
// Cycle to other end if on buffer cell. // Cycle to other end if on buffer cell.
handleUserOnBufferCell()
pagingView?.currentIndex = pageIndex pagingView?.currentIndex = pageIndex
showPeaking(true) showPeaking(true)
} }

View File

@ -21,14 +21,18 @@ import UIKit
public var backgroundColor: Color? public var backgroundColor: Color?
public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol] public var molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]
public var index: Int = 0 public var index: Int = 0
public var spacing: Float? public var spacing: CGFloat?
public var border: Bool? public var border: Bool?
public var loop: Bool? public var loop: Bool?
public var height: Float? public var height: CGFloat?
public var itemWidthPercent: Float? @Percent public var itemWidthPercent = 100
public var itemAlignment: UICollectionView.ScrollPosition? public var itemAlignment: UICollectionView.ScrollPosition?
public var pagingMolecule: (CarouselPagingModelProtocol & MoleculeModelProtocol)? public var pagingMolecule: (CarouselPagingModelProtocol & MoleculeModelProtocol)?
public var paging: Bool = true
public var useHorizontalMargins: Bool?
public var leftPadding: CGFloat?
public var rightPadding: CGFloat?
public init(molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]) { public init(molecules: [MoleculeModelProtocol & CarouselItemModelProtocol]) {
self.molecules = molecules self.molecules = molecules
} }
@ -49,6 +53,10 @@ import UIKit
case itemWidthPercent case itemWidthPercent
case itemAlignment case itemAlignment
case pagingMolecule case pagingMolecule
case paging
case useHorizontalMargins
case leftPadding
case rightPadding
} }
//-------------------------------------------------- //--------------------------------------------------
@ -60,13 +68,21 @@ import UIKit
molecules = try typeContainer.decodeModels(codingKey: .molecules) molecules = try typeContainer.decodeModels(codingKey: .molecules)
index = try typeContainer.decodeIfPresent(Int.self, forKey: .index) ?? 0 index = try typeContainer.decodeIfPresent(Int.self, forKey: .index) ?? 0
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor) backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
spacing = try typeContainer.decodeIfPresent(Float.self, forKey: .spacing) spacing = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .spacing)
border = try typeContainer.decodeIfPresent(Bool.self, forKey: .border) border = try typeContainer.decodeIfPresent(Bool.self, forKey: .border)
loop = try typeContainer.decodeIfPresent(Bool.self, forKey: .loop) loop = try typeContainer.decodeIfPresent(Bool.self, forKey: .loop)
height = try typeContainer.decodeIfPresent(Float.self, forKey: .height) height = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .height)
itemWidthPercent = try typeContainer.decodeIfPresent(Float.self, forKey: .itemWidthPercent) if let itemWidthPercent = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .itemWidthPercent) {
self.itemWidthPercent = itemWidthPercent
}
itemAlignment = try typeContainer.decodeIfPresent(UICollectionView.ScrollPosition.self, forKey: .itemAlignment) itemAlignment = try typeContainer.decodeIfPresent(UICollectionView.ScrollPosition.self, forKey: .itemAlignment)
pagingMolecule = try typeContainer.decodeModelIfPresent(codingKey: .pagingMolecule) pagingMolecule = try typeContainer.decodeModelIfPresent(codingKey: .pagingMolecule)
if let paging = try typeContainer.decodeIfPresent(Bool.self, forKey: .paging) {
self.paging = paging
}
useHorizontalMargins = try typeContainer.decodeIfPresent(Bool.self, forKey: .useHorizontalMargins)
leftPadding = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .leftPadding)
rightPadding = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .rightPadding)
} }
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
@ -74,12 +90,16 @@ import UIKit
try container.encode(moleculeName, forKey: .moleculeName) try container.encode(moleculeName, forKey: .moleculeName)
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor) try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
try container.encodeModels(molecules, forKey: .molecules) try container.encodeModels(molecules, forKey: .molecules)
try container.encode(spacing, forKey: .spacing) try container.encodeIfPresent(spacing, forKey: .spacing)
try container.encode(border, forKey: .border) try container.encodeIfPresent(border, forKey: .border)
try container.encode(loop, forKey: .loop) try container.encodeIfPresent(loop, forKey: .loop)
try container.encode(height, forKey: .height) try container.encodeIfPresent(height, forKey: .height)
try container.encode(itemWidthPercent, forKey: .itemWidthPercent) try container.encode(itemWidthPercent, forKey: .itemWidthPercent)
try container.encode(itemAlignment, forKey: .itemAlignment) try container.encodeIfPresent(itemAlignment, forKey: .itemAlignment)
try container.encodeModelIfPresent(pagingMolecule, forKey: .pagingMolecule) try container.encodeModelIfPresent(pagingMolecule, forKey: .pagingMolecule)
try container.encode(paging, forKey: .paging)
try container.encodeIfPresent(useHorizontalMargins, forKey: .useHorizontalMargins)
try container.encodeIfPresent(leftPadding, forKey: .leftPadding)
try container.encodeIfPresent(rightPadding, forKey: .rightPadding)
} }
} }

View File

@ -10,5 +10,6 @@ import Foundation
public protocol CarouselPagingModelProtocol { public protocol CarouselPagingModelProtocol {
var position: Float? { get } var position: CGFloat? { get }
var hidesForSinglePage: Bool { get }
} }

View File

@ -14,6 +14,7 @@ public protocol NavigationItemModelProtocol {
var backgroundColor: Color? { get set } var backgroundColor: Color? { get set }
var tintColor: Color { get set } var tintColor: Color { get set }
var line: LineModel? { get set } var line: LineModel? { get set }
var alwaysShowBackButton: Bool { get set }
var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? { get set } var backButton: (NavigationButtonModelProtocol & MoleculeModelProtocol)? { get set }
var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var additionalLeftButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }
var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set } var additionalRightButtons: [(NavigationButtonModelProtocol & MoleculeModelProtocol)]? { get set }

View File

@ -131,7 +131,7 @@ import Foundation
return cell return cell
} }
public func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { public override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
(collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol)?.didSelectCell(at: indexPath, delegateObject: delegateObjectIVar, additionalData: nil) (collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol)?.didSelectCell(at: indexPath, delegateObject: delegateObjectIVar, additionalData: nil)
} }

View File

@ -10,7 +10,7 @@ import Foundation
/// A base collection view cell with basic mvm functionality. /// A base collection view cell with basic mvm functionality.
open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol { open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCoreViewProtocol, CollectionTemplateItemProtocol, MFButtonProtocol {
//-------------------------------------------------- //--------------------------------------------------
// MARK: - Properties // MARK: - Properties
//-------------------------------------------------- //--------------------------------------------------
@ -25,10 +25,6 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
private var initialSetupPerformed = false private var initialSetupPerformed = false
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
// MARK: - Inits // MARK: - Inits
public override init(frame: CGRect) { public override init(frame: CGRect) {
super.init(frame: .zero) super.init(frame: .zero)
@ -47,10 +43,6 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
} }
} }
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
// MARK: - MVMCoreViewProtocol // MARK: - MVMCoreViewProtocol
open func setupView() { open func setupView() {
isAccessibilityElement = false isAccessibilityElement = false
@ -68,16 +60,6 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
(molecule as? MVMCoreViewProtocol)?.updateView(size) (molecule as? MVMCoreViewProtocol)?.updateView(size)
} }
open func reset() {
molecule?.reset()
backgroundColor = .mvmWhite
width = nil
}
//--------------------------------------------------
// MARK: - Properties
//--------------------------------------------------
// MARK: - MoleculeViewProtocol // MARK: - MoleculeViewProtocol
open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) { open func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
guard let model = model as? CollectionItemModelProtocol else { return } guard let model = model as? CollectionItemModelProtocol else { return }
@ -94,6 +76,12 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
} }
} }
open func reset() {
molecule?.reset()
backgroundColor = .mvmWhite
width = nil
}
/// Convenience function. Adds a molecule to the view. /// Convenience function. Adds a molecule to the view.
open func addMolecule(_ molecule: MoleculeViewProtocol) { open func addMolecule(_ molecule: MoleculeViewProtocol) {
contentView.addSubview(molecule) contentView.addSubview(molecule)
@ -109,6 +97,12 @@ open class CollectionViewCell: UICollectionViewCell, MoleculeViewProtocol, MVMCo
self.width = width self.width = width
} }
// MARK: - Override
open func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
guard let action = model?.action else { return }
Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData)
}
// Column logic, set width. // Column logic, set width.
override open func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes { override open func preferredLayoutAttributesFitting(_ layoutAttributes: UICollectionViewLayoutAttributes) -> UICollectionViewLayoutAttributes {
let autoLayoutAttributes = super.preferredLayoutAttributesFitting(layoutAttributes) let autoLayoutAttributes = super.preferredLayoutAttributesFitting(layoutAttributes)

View File

@ -9,5 +9,13 @@
import Foundation import Foundation
public protocol CollectionItemModelProtocol { public protocol CollectionItemModelProtocol {
var action: ActionModelProtocol? { get set }
}
// Not a strict requirement.
public extension CollectionItemModelProtocol {
var action: ActionModelProtocol? {
get { return nil }
set { }
}
} }

View File

@ -8,7 +8,7 @@
import UIKit import UIKit
@objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol { @objcMembers open class TableViewCell: UITableViewCell, MoleculeViewProtocol, MoleculeListCellProtocol, MVMCoreViewProtocol, MFButtonProtocol {
open var molecule: MoleculeViewProtocol? open var molecule: MoleculeViewProtocol?
open var listItemModel: ListItemModelProtocol? open var listItemModel: ListItemModelProtocol?
@ -267,10 +267,8 @@ import UIKit
} }
public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) { public func didSelectCell(at index: IndexPath, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
//TODO: Use object when handleAction is rewrote to handle action model guard let action = listItemModel?.action else { return }
if let actionMap = self.listItemModel?.action?.toJSON() { Button.performButtonAction(with: action, button: self, delegateObject: delegateObject, additionalData: additionalData)
MVMCoreActionHandler.shared()?.handleAction(with: actionMap, additionalData: additionalData, delegateObject: delegateObject)
}
} }
public func willDisplay() { public func willDisplay() {

View File

@ -0,0 +1,27 @@
//
// UICollectionViewLeftAlignedLayout.swift
// MVMCoreUI
//
// Created by Dhamodaram Nandi on 05/06/20.
// Copyright © 2020 Verizon Wireless. All rights reserved.
//
// Left aligns items and makes the minimumInteritemSpacing absolute.
import Foundation
class UICollectionViewLeftAlignedLayout: UICollectionViewFlowLayout {
override func layoutAttributesForElements(in rect: CGRect) -> [UICollectionViewLayoutAttributes]? {
guard let attributes = super.layoutAttributesForElements(in: rect) else { return nil }
var newAttributesForElementsInRect = [UICollectionViewLayoutAttributes]()
for attribute in attributes {
if let previousFrame = newAttributesForElementsInRect.last,
MVMCoreGetterUtility.cgfequal(previousFrame.frame.minY, attribute.frame.minY) {
attribute.frame.origin.x = previousFrame.frame.maxX + minimumInteritemSpacing
} else {
attribute.frame.origin.x = 0
}
newAttributesForElementsInRect.append(attribute)
}
return newAttributesForElementsInRect
}
}

View File

@ -233,4 +233,8 @@ import Foundation
} }
fatalError() fatalError()
} }
open func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
(collectionView.cellForItem(at: indexPath) as? CollectionTemplateItemProtocol)?.didSelectCell(at: indexPath, delegateObject: delegateObjectIVar, additionalData: nil)
}
} }

View File

@ -282,7 +282,9 @@ extension UIColor {
guard let components = color.cgColor.components else { return nil } guard let components = color.cgColor.components else { return nil }
if color.cgColor.numberOfComponents >= 3 { let numberOfComponents = color.cgColor.numberOfComponents
if numberOfComponents >= 3 {
// RGB color space
let r = Int(CGFloat(components[0]) * 255) let r = Int(CGFloat(components[0]) * 255)
let g = Int(CGFloat(components[1]) * 255) let g = Int(CGFloat(components[1]) * 255)
let b = Int(CGFloat(components[2]) * 255) let b = Int(CGFloat(components[2]) * 255)
@ -294,6 +296,16 @@ extension UIColor {
} }
return String(format: "%02X%02X%02X", r, g, b) return String(format: "%02X%02X%02X", r, g, b)
} else if numberOfComponents == 2 {
// Monochromatic color space
let value = Int(CGFloat(components[0]) * 255)
// If alpha of color is less than 1.0 then alpha hex is relevant.
if components[1] < 1.0 {
let alpha = Int(CGFloat(components[1]) * 255)
return String(format: "%02X%02X%02X%02X", value, value, value, alpha)
}
return String(format: "%02X%02X%02X", value, value, value)
} }
return nil return nil

View File

@ -48,7 +48,7 @@ import UIKit
let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject let delegate = (viewController as? MVMCoreViewControllerProtocol)?.delegateObject?() as? MVMCoreUIDelegateObject
var leftItems: [UIBarButtonItem] = [] var leftItems: [UIBarButtonItem] = []
if let backButtonModel = navigationItemModel.backButton, if let backButtonModel = navigationItemModel.backButton,
navigationController.viewControllers.count > 1 { navigationController.viewControllers.count > 1 || navigationItemModel.alwaysShowBackButton {
leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil)) leftItems.append(backButtonModel.createNavigationItemButton(delegateObject: delegate, additionalData: nil))
} }
if let leftItemModels = navigationItemModel.additionalLeftButtons { if let leftItemModels = navigationItemModel.additionalLeftButtons {
@ -90,4 +90,12 @@ import UIKit
// Sets up the navigation buttons. // Sets up the navigation buttons.
setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController) setNavigationButtons(navigationController: navigationController, navigationItemModel: navigationItemModel, viewController: viewController)
} }
/// Convenience setter for legacy files
public static func set(navigationController: UINavigationController, navigationJSON: [String: Any], viewController: UIViewController) throws {
guard let barModel = try MoleculeObjectMapping.shared()?.getMoleculeModelForJSON(navigationJSON) as? (MoleculeModelProtocol & NavigationItemModelProtocol) else {
throw ModelRegistry.Error.decoderOther(message: "Model not a bar model")
}
set(navigationController: navigationController, navigationItemModel: barModel, viewController: viewController)
}
} }