Merge branch 'develop' into feature/checkboxView_constraints
# Conflicts: # MVMCoreUI/Atoms/Views/CheckboxWithLabelView.swift
This commit is contained in:
commit
f56b08fa0c
@ -47,6 +47,7 @@
|
|||||||
D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */; };
|
D22D1F47220496A30077CEC0 /* MVMCoreUISwitch.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */; };
|
||||||
D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; };
|
D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; };
|
||||||
|
D243859923A16B1800332775 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = D243859823A16B1800332775 /* Container.swift */; };
|
||||||
D260D7B122D65BDD007E7233 /* MVMCoreUIPageControl.h in Headers */ = {isa = PBXBuildFile; fileRef = D260D7AF22D65BDD007E7233 /* MVMCoreUIPageControl.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
D260D7B122D65BDD007E7233 /* MVMCoreUIPageControl.h in Headers */ = {isa = PBXBuildFile; fileRef = D260D7AF22D65BDD007E7233 /* MVMCoreUIPageControl.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
D260D7B222D65BDD007E7233 /* MVMCoreUIPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = D260D7B022D65BDD007E7233 /* MVMCoreUIPageControl.m */; };
|
D260D7B222D65BDD007E7233 /* MVMCoreUIPageControl.m in Sources */ = {isa = PBXBuildFile; fileRef = D260D7B022D65BDD007E7233 /* MVMCoreUIPageControl.m */; };
|
||||||
D260D7B622D68514007E7233 /* MVMCoreUIPagingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D260D7B522D68509007E7233 /* MVMCoreUIPagingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
D260D7B622D68514007E7233 /* MVMCoreUIPagingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D260D7B522D68509007E7233 /* MVMCoreUIPagingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
@ -197,6 +198,8 @@
|
|||||||
D2E1FADB2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADA2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift */; };
|
D2E1FADB2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADA2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift */; };
|
||||||
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */; };
|
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */; };
|
||||||
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */; };
|
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */; };
|
||||||
|
D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2FB151A23A2B65B00C20E10 /* MoleculeContainer.swift */; };
|
||||||
|
D2FB151D23A40F1500C20E10 /* StackItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2FB151C23A40F1500C20E10 /* StackItem.swift */; };
|
||||||
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */; };
|
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */; };
|
||||||
DBC4391822442197001AB423 /* CaretView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391622442196001AB423 /* CaretView.swift */; };
|
DBC4391822442197001AB423 /* CaretView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391622442196001AB423 /* CaretView.swift */; };
|
||||||
DBC4391922442197001AB423 /* DashLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391722442197001AB423 /* DashLine.swift */; };
|
DBC4391922442197001AB423 /* DashLine.swift in Sources */ = {isa = PBXBuildFile; fileRef = DBC4391722442197001AB423 /* DashLine.swift */; };
|
||||||
@ -245,6 +248,7 @@
|
|||||||
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUISwitch.m; sourceTree = "<group>"; };
|
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUISwitch.m; sourceTree = "<group>"; };
|
||||||
D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = "<group>"; };
|
D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = "<group>"; };
|
||||||
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = "<group>"; };
|
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = "<group>"; };
|
||||||
|
D243859823A16B1800332775 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = "<group>"; };
|
||||||
D260D7AF22D65BDD007E7233 /* MVMCoreUIPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIPageControl.h; sourceTree = "<group>"; };
|
D260D7AF22D65BDD007E7233 /* MVMCoreUIPageControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIPageControl.h; sourceTree = "<group>"; };
|
||||||
D260D7B022D65BDD007E7233 /* MVMCoreUIPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIPageControl.m; sourceTree = "<group>"; };
|
D260D7B022D65BDD007E7233 /* MVMCoreUIPageControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIPageControl.m; sourceTree = "<group>"; };
|
||||||
D260D7B522D68509007E7233 /* MVMCoreUIPagingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIPagingProtocol.h; sourceTree = "<group>"; };
|
D260D7B522D68509007E7233 /* MVMCoreUIPagingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIPagingProtocol.h; sourceTree = "<group>"; };
|
||||||
@ -400,6 +404,8 @@
|
|||||||
D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerTableViewController.swift; sourceTree = "<group>"; };
|
D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerTableViewController.swift; sourceTree = "<group>"; };
|
||||||
D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListTemplate.swift; sourceTree = "<group>"; };
|
D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListTemplate.swift; sourceTree = "<group>"; };
|
||||||
D2F4DDE52371A4CB00CD28BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
D2F4DDE52371A4CB00CD28BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||||
|
D2FB151A23A2B65B00C20E10 /* MoleculeContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeContainer.swift; sourceTree = "<group>"; };
|
||||||
|
D2FB151C23A40F1500C20E10 /* StackItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StackItem.swift; sourceTree = "<group>"; };
|
||||||
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftRightLabelView.swift; sourceTree = "<group>"; };
|
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = LeftRightLabelView.swift; sourceTree = "<group>"; };
|
||||||
DB891E822253FA8500022516 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
|
DB891E822253FA8500022516 /* Label.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Label.swift; sourceTree = "<group>"; };
|
||||||
DBC4391622442196001AB423 /* CaretView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaretView.swift; sourceTree = "<group>"; };
|
DBC4391622442196001AB423 /* CaretView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CaretView.swift; sourceTree = "<group>"; };
|
||||||
@ -454,6 +460,12 @@
|
|||||||
D29DF31F21ED0CBA003B2FB9 /* LabelView.m */,
|
D29DF31F21ED0CBA003B2FB9 /* LabelView.m */,
|
||||||
D29DF15921E697DA003B2FB9 /* SeparatorView.h */,
|
D29DF15921E697DA003B2FB9 /* SeparatorView.h */,
|
||||||
D29DF15A21E697DA003B2FB9 /* SeparatorView.m */,
|
D29DF15A21E697DA003B2FB9 /* SeparatorView.m */,
|
||||||
|
D22D1F1C220343560077CEC0 /* MVMCoreUICheckMarkView.h */,
|
||||||
|
D22D1F1D220343560077CEC0 /* MVMCoreUICheckMarkView.m */,
|
||||||
|
D22D1F18220341F50077CEC0 /* MVMCoreUICheckBox.h */,
|
||||||
|
D22D1F19220341F50077CEC0 /* MVMCoreUICheckBox.m */,
|
||||||
|
0198F7A02256A80A0066C936 /* MFRadioButton.h */,
|
||||||
|
0198F7A22256A80A0066C936 /* MFRadioButton.m */,
|
||||||
);
|
);
|
||||||
path = Views;
|
path = Views;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -514,6 +526,7 @@
|
|||||||
D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */,
|
D224799A231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift */,
|
||||||
D27CD40D2322EEAF00C1DC07 /* TabsTableViewCell.swift */,
|
D27CD40D2322EEAF00C1DC07 /* TabsTableViewCell.swift */,
|
||||||
D268C70D238C22D7007F2C1C /* DropDownFilterTableViewCell.swift */,
|
D268C70D238C22D7007F2C1C /* DropDownFilterTableViewCell.swift */,
|
||||||
|
D2FB151C23A40F1500C20E10 /* StackItem.swift */,
|
||||||
);
|
);
|
||||||
path = Items;
|
path = Items;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -619,6 +632,7 @@
|
|||||||
D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */,
|
D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */,
|
||||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||||
017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */,
|
017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */,
|
||||||
|
D2FB151A23A2B65B00C20E10 /* MoleculeContainer.swift */,
|
||||||
);
|
);
|
||||||
path = Molecules;
|
path = Molecules;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -663,6 +677,7 @@
|
|||||||
D29DF2B721E7BE79003B2FB9 /* TabBarController */,
|
D29DF2B721E7BE79003B2FB9 /* TabBarController */,
|
||||||
D29DF2B621E7BE66003B2FB9 /* SplitViewController */,
|
D29DF2B621E7BE66003B2FB9 /* SplitViewController */,
|
||||||
D2B18B93236214AD00A9AEDC /* NavigationController.swift */,
|
D2B18B93236214AD00A9AEDC /* NavigationController.swift */,
|
||||||
|
D243859823A16B1800332775 /* Container.swift */,
|
||||||
);
|
);
|
||||||
path = Containers;
|
path = Containers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -764,16 +779,10 @@
|
|||||||
D29DF32221ED0DA2003B2FB9 /* TextButtonView.m */,
|
D29DF32221ED0DA2003B2FB9 /* TextButtonView.m */,
|
||||||
D29770FB21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h */,
|
D29770FB21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h */,
|
||||||
D29770FA21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m */,
|
D29770FA21F7C77400B2F0D0 /* MVMCoreUITextFieldView.m */,
|
||||||
D22D1F1C220343560077CEC0 /* MVMCoreUICheckMarkView.h */,
|
|
||||||
D22D1F1D220343560077CEC0 /* MVMCoreUICheckMarkView.m */,
|
|
||||||
D22D1F18220341F50077CEC0 /* MVMCoreUICheckBox.h */,
|
|
||||||
D22D1F19220341F50077CEC0 /* MVMCoreUICheckBox.m */,
|
|
||||||
D22D1F44220496A30077CEC0 /* MVMCoreUISwitch.h */,
|
D22D1F44220496A30077CEC0 /* MVMCoreUISwitch.h */,
|
||||||
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */,
|
D22D1F45220496A30077CEC0 /* MVMCoreUISwitch.m */,
|
||||||
DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */,
|
DBC4391C2245232D001AB423 /* LabelWithInternalButton.swift */,
|
||||||
DB891E822253FA8500022516 /* Label.swift */,
|
DB891E822253FA8500022516 /* Label.swift */,
|
||||||
0198F7A02256A80A0066C936 /* MFRadioButton.h */,
|
|
||||||
0198F7A22256A80A0066C936 /* MFRadioButton.m */,
|
|
||||||
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */,
|
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */,
|
||||||
0A7BAFA2232BE63400FB8E22 /* CheckboxWithLabelView.swift */,
|
0A7BAFA2232BE63400FB8E22 /* CheckboxWithLabelView.swift */,
|
||||||
01004F2F22721C3800991ECC /* RadioButton.swift */,
|
01004F2F22721C3800991ECC /* RadioButton.swift */,
|
||||||
@ -1070,6 +1079,7 @@
|
|||||||
D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */,
|
D29B771022C281F400D6ACE0 /* ModuleMolecule.swift in Sources */,
|
||||||
DBC4391922442197001AB423 /* DashLine.swift in Sources */,
|
DBC4391922442197001AB423 /* DashLine.swift in Sources */,
|
||||||
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */,
|
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */,
|
||||||
|
D2FB151D23A40F1500C20E10 /* StackItem.swift in Sources */,
|
||||||
D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */,
|
D29DF29621E7ADB8003B2FB9 /* StackableViewController.m in Sources */,
|
||||||
0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */,
|
0116A4E5228B19640094F3ED /* RadioButtonModel.swift in Sources */,
|
||||||
D2E1FADB2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift in Sources */,
|
D2E1FADB2260D3D200AEFD8C /* MVMCoreUIDelegateObject.swift in Sources */,
|
||||||
@ -1135,6 +1145,7 @@
|
|||||||
D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */,
|
D2A6390122CBB1820052ED1F /* Carousel.swift in Sources */,
|
||||||
D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */,
|
D29DF2C721E7BF57003B2FB9 /* MFTabBarInteractor.m in Sources */,
|
||||||
D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */,
|
D29DF29521E7ADB8003B2FB9 /* ProgrammaticScrollViewController.m in Sources */,
|
||||||
|
D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */,
|
||||||
D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */,
|
D2A638FD22CA98280052ED1F /* HeadlineBody.swift in Sources */,
|
||||||
D29DF16121E69996003B2FB9 /* MFViewController.m in Sources */,
|
D29DF16121E69996003B2FB9 /* MFViewController.m in Sources */,
|
||||||
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */,
|
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */,
|
||||||
@ -1146,6 +1157,7 @@
|
|||||||
D27CD4102339057800C1DC07 /* EyebrowHeadlineBodyLink.swift in Sources */,
|
D27CD4102339057800C1DC07 /* EyebrowHeadlineBodyLink.swift in Sources */,
|
||||||
D29DF11D21E684A9003B2FB9 /* MVMCoreUISplitViewController.m in Sources */,
|
D29DF11D21E684A9003B2FB9 /* MVMCoreUISplitViewController.m in Sources */,
|
||||||
0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */,
|
0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */,
|
||||||
|
D243859923A16B1800332775 /* Container.swift in Sources */,
|
||||||
D29DF29821E7ADB8003B2FB9 /* MFScrollingViewController.m in Sources */,
|
D29DF29821E7ADB8003B2FB9 /* MFScrollingViewController.m in Sources */,
|
||||||
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */,
|
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */,
|
||||||
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
|
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */,
|
||||||
|
|||||||
@ -136,7 +136,7 @@ open class CaretButton: MFCustomButton, MVMCoreUIMoleculeViewProtocol, MVMCoreUI
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open func alignment() -> UIStackView.Alignment {
|
open func horizontalAlignment() -> UIStackView.Alignment {
|
||||||
return UIStackView.Alignment.leading;
|
return UIStackView.Alignment.leading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -156,7 +156,7 @@
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIStackViewAlignment)alignment {
|
- (UIStackViewAlignment)horizontalAlignment {
|
||||||
return UIStackViewAlignmentLeading;
|
return UIStackViewAlignmentLeading;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -664,6 +664,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
- (void)setAsMolecule {
|
- (void)setAsMolecule {
|
||||||
|
self.translatesAutoresizingMaskIntoConstraints = false;
|
||||||
|
[self pinHeight];
|
||||||
[self setAsStandardCustom];
|
[self setAsStandardCustom];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,6 +715,10 @@
|
|||||||
[self setWithActionMap:json delegateObject:delegateObject additionalData:additionalData];
|
[self setWithActionMap:json delegateObject:delegateObject additionalData:additionalData];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (UIStackViewAlignment)horizontalAlignment {
|
||||||
|
return UIStackViewAlignmentCenter;
|
||||||
|
}
|
||||||
|
|
||||||
#pragma mark - Handling Validations
|
#pragma mark - Handling Validations
|
||||||
|
|
||||||
- (void)setEnabledByValidity {
|
- (void)setEnabledByValidity {
|
||||||
|
|||||||
@ -131,7 +131,7 @@ extension CaretView: MVMCoreUIViewConstrainingProtocol {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
open func alignment() -> UIStackView.Alignment {
|
open func horizontalAlignment() -> UIStackView.Alignment {
|
||||||
return UIStackView.Alignment.leading;
|
return UIStackView.Alignment.leading;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -598,7 +598,7 @@ extension Label {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
public func alignment() -> UIStackView.Alignment {
|
public func horizontalAlignment() -> UIStackView.Alignment {
|
||||||
return .leading
|
return .leading
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -193,7 +193,7 @@ const CGFloat SwitchShakeIntensity = 2;
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIStackViewAlignment)alignment {
|
- (UIStackViewAlignment)horizontalAlignment {
|
||||||
return UIStackViewAlignmentTrailing;
|
return UIStackViewAlignmentTrailing;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -54,8 +54,9 @@ import Foundation
|
|||||||
if let thickness = json?.optionalCGFloatForKey("thickness") {
|
if let thickness = json?.optionalCGFloatForKey("thickness") {
|
||||||
self.thickness = thickness
|
self.thickness = thickness
|
||||||
}
|
}
|
||||||
if let percentage = json?["percent"] as? Float {
|
// as? Float returns nil, apple defect.
|
||||||
progress = percentage/100.0
|
if let percentage = json?["percent"] as? CGFloat {
|
||||||
|
progress = Float(percentage/100.0)
|
||||||
}
|
}
|
||||||
if let progressColor = json?.optionalStringForKey("progressColor") {
|
if let progressColor = json?.optionalStringForKey("progressColor") {
|
||||||
progressTintColor = UIColor.mfGet(forHex: progressColor)
|
progressTintColor = UIColor.mfGet(forHex: progressColor)
|
||||||
|
|||||||
239
MVMCoreUI/Containers/Container.swift
Normal file
239
MVMCoreUI/Containers/Container.swift
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
//
|
||||||
|
// Container.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 12/11/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
public protocol ContainerModelProtocol {
|
||||||
|
var horizontalAlignment: UIStackView.Alignment? { get set }
|
||||||
|
var verticalAlignment: UIStackView.Alignment? { get set }
|
||||||
|
var useHorizontalMargins: Bool? { get set }
|
||||||
|
var useVerticalMargins: Bool? { get set }
|
||||||
|
}
|
||||||
|
|
||||||
|
public class ContainerHelper: NSObject {
|
||||||
|
var leftConstraint: NSLayoutConstraint?
|
||||||
|
var topConstraint: NSLayoutConstraint?
|
||||||
|
var bottomConstraint: NSLayoutConstraint?
|
||||||
|
var rightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
var alignCenterHorizontalConstraint: NSLayoutConstraint?
|
||||||
|
var alignCenterLeftConstraint: NSLayoutConstraint?
|
||||||
|
var alignCenterRightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
var alignCenterVerticalConstraint: NSLayoutConstraint?
|
||||||
|
var alignCenterTopConstraint: NSLayoutConstraint?
|
||||||
|
var alignCenterBottomConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
var leftLowConstraint: NSLayoutConstraint?
|
||||||
|
var topLowConstraint: NSLayoutConstraint?
|
||||||
|
var bottomLowConstraint: NSLayoutConstraint?
|
||||||
|
var rightLowConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
|
func constrainView(_ view: UIView) {
|
||||||
|
guard let margins = view.superview?.layoutMarginsGuide else { return }
|
||||||
|
leftConstraint = view.leftAnchor.constraint(equalTo: margins.leftAnchor)
|
||||||
|
leftConstraint?.isActive = true
|
||||||
|
|
||||||
|
topConstraint = view.topAnchor.constraint(equalTo: margins.topAnchor)
|
||||||
|
topConstraint?.isActive = true
|
||||||
|
|
||||||
|
rightConstraint = margins.rightAnchor.constraint(equalTo: view.rightAnchor)
|
||||||
|
rightConstraint?.isActive = true
|
||||||
|
|
||||||
|
bottomConstraint = margins.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||||
|
bottomConstraint?.isActive = true
|
||||||
|
|
||||||
|
alignCenterHorizontalConstraint = view.centerXAnchor.constraint(equalTo: margins.centerXAnchor)
|
||||||
|
alignCenterLeftConstraint = view.leftAnchor.constraint(greaterThanOrEqualTo: margins.leftAnchor)
|
||||||
|
alignCenterRightConstraint = margins.rightAnchor.constraint(greaterThanOrEqualTo: view.rightAnchor)
|
||||||
|
|
||||||
|
alignCenterVerticalConstraint = view.centerYAnchor.constraint(equalTo: margins.centerYAnchor)
|
||||||
|
alignCenterTopConstraint = view.topAnchor.constraint(greaterThanOrEqualTo: margins.topAnchor)
|
||||||
|
alignCenterBottomConstraint = margins.bottomAnchor.constraint(greaterThanOrEqualTo: view.bottomAnchor)
|
||||||
|
|
||||||
|
leftLowConstraint = view.leftAnchor.constraint(equalTo: margins.leftAnchor)
|
||||||
|
leftLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
|
leftLowConstraint?.isActive = true
|
||||||
|
|
||||||
|
topLowConstraint = view.topAnchor.constraint(equalTo: margins.topAnchor)
|
||||||
|
topLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
|
topLowConstraint?.isActive = true
|
||||||
|
|
||||||
|
rightLowConstraint = margins.rightAnchor.constraint(equalTo: view.rightAnchor)
|
||||||
|
rightLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
|
rightLowConstraint?.isActive = true
|
||||||
|
|
||||||
|
bottomLowConstraint = margins.bottomAnchor.constraint(equalTo: view.bottomAnchor)
|
||||||
|
bottomLowConstraint?.priority = UILayoutPriority(rawValue: 200)
|
||||||
|
bottomLowConstraint?.isActive = true
|
||||||
|
|
||||||
|
setAccessibility(view)
|
||||||
|
}
|
||||||
|
|
||||||
|
func setAccessibility(_ view: UIView) {
|
||||||
|
guard let superView = view.superview else { return }
|
||||||
|
superView.isAccessibilityElement = false
|
||||||
|
if let elements = view.accessibilityElements {
|
||||||
|
superView.accessibilityElements = elements
|
||||||
|
} else {
|
||||||
|
superView.accessibilityElements = [view]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func alignHorizontal(_ alignment: UIStackView.Alignment) {
|
||||||
|
switch alignment {
|
||||||
|
case .center:
|
||||||
|
alignCenterHorizontalConstraint?.isActive = true
|
||||||
|
alignCenterLeftConstraint?.isActive = true
|
||||||
|
alignCenterRightConstraint?.isActive = true
|
||||||
|
leftConstraint?.isActive = false
|
||||||
|
rightConstraint?.isActive = false
|
||||||
|
case .leading:
|
||||||
|
alignCenterHorizontalConstraint?.isActive = false
|
||||||
|
alignCenterLeftConstraint?.isActive = false
|
||||||
|
alignCenterRightConstraint?.isActive = true
|
||||||
|
leftConstraint?.isActive = true
|
||||||
|
rightConstraint?.isActive = false
|
||||||
|
case .trailing:
|
||||||
|
alignCenterHorizontalConstraint?.isActive = false
|
||||||
|
alignCenterLeftConstraint?.isActive = true
|
||||||
|
alignCenterRightConstraint?.isActive = false
|
||||||
|
leftConstraint?.isActive = false
|
||||||
|
rightConstraint?.isActive = true
|
||||||
|
case .fill:
|
||||||
|
alignCenterHorizontalConstraint?.isActive = false
|
||||||
|
alignCenterLeftConstraint?.isActive = false
|
||||||
|
alignCenterRightConstraint?.isActive = false
|
||||||
|
leftConstraint?.isActive = true
|
||||||
|
rightConstraint?.isActive = true
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func alignVertical(_ alignment: UIStackView.Alignment) {
|
||||||
|
switch alignment {
|
||||||
|
case .center:
|
||||||
|
alignCenterVerticalConstraint?.isActive = true
|
||||||
|
alignCenterTopConstraint?.isActive = true
|
||||||
|
alignCenterBottomConstraint?.isActive = true
|
||||||
|
topConstraint?.isActive = false
|
||||||
|
bottomConstraint?.isActive = false
|
||||||
|
case .leading:
|
||||||
|
alignCenterVerticalConstraint?.isActive = false
|
||||||
|
alignCenterTopConstraint?.isActive = false
|
||||||
|
alignCenterBottomConstraint?.isActive = true
|
||||||
|
topConstraint?.isActive = true
|
||||||
|
bottomConstraint?.isActive = false
|
||||||
|
case .trailing:
|
||||||
|
alignCenterVerticalConstraint?.isActive = false
|
||||||
|
alignCenterTopConstraint?.isActive = true
|
||||||
|
alignCenterBottomConstraint?.isActive = false
|
||||||
|
topConstraint?.isActive = false
|
||||||
|
bottomConstraint?.isActive = true
|
||||||
|
case .fill:
|
||||||
|
alignCenterVerticalConstraint?.isActive = false
|
||||||
|
alignCenterTopConstraint?.isActive = false
|
||||||
|
alignCenterBottomConstraint?.isActive = false
|
||||||
|
topConstraint?.isActive = true
|
||||||
|
bottomConstraint?.isActive = true
|
||||||
|
default: break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func set(with model: ContainerModelProtocol) {
|
||||||
|
if let horizontalAlignment = model.horizontalAlignment {
|
||||||
|
alignHorizontal(horizontalAlignment)
|
||||||
|
}
|
||||||
|
if let verticalAlignment = model.verticalAlignment {
|
||||||
|
alignVertical(verticalAlignment)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static func getAlignment(for string: String) -> UIStackView.Alignment? {
|
||||||
|
switch string {
|
||||||
|
case "leading":
|
||||||
|
return .leading
|
||||||
|
case "trailing":
|
||||||
|
return .trailing
|
||||||
|
case "center":
|
||||||
|
return .center
|
||||||
|
case "fill":
|
||||||
|
return .fill
|
||||||
|
default:
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func set(with JSON: [AnyHashable: Any]?, for contained: UIView) {
|
||||||
|
if let horizontalAlignmentString = JSON?.optionalStringForKey("horizontalAlignment"), let alignment = ContainerHelper.getAlignment(for: horizontalAlignmentString) ?? (contained as? MVMCoreUIViewConstrainingProtocol)?.horizontalAlignment?() {
|
||||||
|
alignHorizontal(alignment)
|
||||||
|
} else if let alignment = (contained as? MVMCoreUIViewConstrainingProtocol)?.horizontalAlignment?() {
|
||||||
|
alignHorizontal(alignment)
|
||||||
|
}
|
||||||
|
|
||||||
|
if let verticalAlignmentString = JSON?.optionalStringForKey("verticalAlignment"), let alignment = ContainerHelper.getAlignment(for: verticalAlignmentString) ?? (contained as? MVMCoreUIViewConstrainingProtocol)?.verticalAlignment?() {
|
||||||
|
alignVertical(alignment)
|
||||||
|
} else if let alignment = (contained as? MVMCoreUIViewConstrainingProtocol)?.verticalAlignment?() {
|
||||||
|
alignVertical(alignment)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class Container: View {
|
||||||
|
var model: ContainerModelProtocol?
|
||||||
|
var view: UIView?
|
||||||
|
let containerHelper = ContainerHelper()
|
||||||
|
|
||||||
|
var topMarginPadding: CGFloat = 0
|
||||||
|
var bottomMarginPadding: CGFloat = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - MVMCoreViewProtocol
|
||||||
|
public extension Container {
|
||||||
|
override func updateView(_ size: CGFloat) {
|
||||||
|
super.updateView(size)
|
||||||
|
(view as? MVMCoreViewProtocol)?.updateView(size)
|
||||||
|
MFStyler.setMarginsFor(self, size: size, defaultHorizontal: model?.useHorizontalMargins ?? true, top: model?.useHorizontalMargins ?? true ? topMarginPadding : 0, bottom: model?.useHorizontalMargins ?? true ? bottomMarginPadding : 0)
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Will be called only once.
|
||||||
|
override func setupView() {
|
||||||
|
super.setupView()
|
||||||
|
backgroundColor = .clear
|
||||||
|
}
|
||||||
|
|
||||||
|
func addAndContain(_ view: UIView) {
|
||||||
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
addSubview(view)
|
||||||
|
containerHelper.constrainView(view)
|
||||||
|
self.view = view
|
||||||
|
}
|
||||||
|
|
||||||
|
convenience init(andContain view: UIView) {
|
||||||
|
self.init()
|
||||||
|
addAndContain(view)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
|
public extension Container {
|
||||||
|
override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
guard let view = view else { return }
|
||||||
|
containerHelper.set(with: json, for: view)
|
||||||
|
}
|
||||||
|
|
||||||
|
override func reset() {
|
||||||
|
super.reset()
|
||||||
|
(view as? MVMCoreUIMoleculeViewProtocol)?.reset?()
|
||||||
|
}
|
||||||
|
|
||||||
|
func setAsMolecule() {
|
||||||
|
(view as? MVMCoreUIMoleculeViewProtocol)?.setAsMolecule?()
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,7 +16,9 @@ NS_ASSUME_NONNULL_BEGIN
|
|||||||
@optional
|
@optional
|
||||||
|
|
||||||
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
||||||
|
- (void)panelWillAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel overtakingDetail:(BOOL)willOvertake;
|
||||||
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
||||||
|
- (void)panelDidAppear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel overtakingDetail:(BOOL)didOvertake;
|
||||||
|
|
||||||
- (void)panelWillDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
- (void)panelWillDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
||||||
- (void)panelDidDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
- (void)panelDidDisappear:(nonnull NSObject <MVMCoreUIPanelProtocol>*)panel;
|
||||||
|
|||||||
@ -357,16 +357,19 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
- (void)showLeftPanelAnimated:(BOOL)animated explict:(BOOL)explict {
|
- (void)showLeftPanelAnimated:(BOOL)animated explict:(BOOL)explict {
|
||||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
if (self.mainViewLeading.constant < .1) {
|
if (self.mainViewLeading.constant < .1) {
|
||||||
|
BOOL shouldExtendLeftPanel = [self shouldExtendLeftPanel];
|
||||||
|
|
||||||
if (explict) {
|
if (explict) {
|
||||||
self.explictlyShowingPanel = self.leftPanel;
|
self.explictlyShowingPanel = self.leftPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void (^animations)(void) = [self getLeftPanelShowAnimationBlock];
|
void (^animations)(void) = [self getLeftPanelShowAnimationBlock];
|
||||||
|
|
||||||
void (^completion)(BOOL) = ^(BOOL finished){
|
void (^completion)(BOOL) = ^(BOOL finished){
|
||||||
[self panelDidAppear:self.leftPanel animated:animated];
|
[self panelDidAppear:self.leftPanel didExtend:shouldExtendLeftPanel animated:animated];
|
||||||
};
|
};
|
||||||
|
|
||||||
if (![self shouldExtendLeftPanel]) {
|
if (!shouldExtendLeftPanel) {
|
||||||
if ([self.leftPanel respondsToSelector:@selector(showArrow)]){
|
if ([self.leftPanel respondsToSelector:@selector(showArrow)]){
|
||||||
[self.leftPanel showArrow];
|
[self.leftPanel showArrow];
|
||||||
}
|
}
|
||||||
@ -389,7 +392,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
}
|
}
|
||||||
|
|
||||||
self.mainViewCoverView.hidden = NO;
|
self.mainViewCoverView.hidden = NO;
|
||||||
[self panelWillAppear:self.leftPanel animated:animated];
|
[self panelWillAppear:self.leftPanel willExtend:shouldExtendLeftPanel animated:animated];
|
||||||
if (animated) {
|
if (animated) {
|
||||||
[UIView animateWithDuration:PanelAnimationDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:animations completion:completion];
|
[UIView animateWithDuration:PanelAnimationDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:animations completion:completion];
|
||||||
} else {
|
} else {
|
||||||
@ -547,19 +550,22 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
- (void)showRightPanelAnimated:(BOOL)animated explict:(BOOL)explict {
|
- (void)showRightPanelAnimated:(BOOL)animated explict:(BOOL)explict {
|
||||||
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
[MVMCoreDispatchUtility performBlockOnMainThread:^{
|
||||||
if (self.mainViewTrailing.constant < .1) {
|
if (self.mainViewTrailing.constant < .1) {
|
||||||
|
BOOL shouldExtendRightPanel = [self shouldExtendRightPanel];
|
||||||
|
|
||||||
if (explict) {
|
if (explict) {
|
||||||
self.explictlyShowingPanel = self.rightPanel;
|
self.explictlyShowingPanel = self.rightPanel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void (^animations)(void) = [self getRightPanelShowAnimationBlock];
|
void (^animations)(void) = [self getRightPanelShowAnimationBlock];
|
||||||
|
|
||||||
void (^completion)(BOOL) = ^(BOOL finished){
|
void (^completion)(BOOL) = ^(BOOL finished){
|
||||||
[self panelDidAppear:self.rightPanel animated:animated];
|
[self panelDidAppear:self.rightPanel didExtend:shouldExtendRightPanel animated:animated];
|
||||||
self.mainView.accessibilityElementsHidden = YES;
|
self.mainView.accessibilityElementsHidden = YES;
|
||||||
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, self.rightPanel);
|
UIAccessibilityPostNotification(UIAccessibilityLayoutChangedNotification, self.rightPanel);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.mainViewCoverView.hidden = NO;
|
self.mainViewCoverView.hidden = NO;
|
||||||
if (![self shouldExtendRightPanel]) {
|
if (!shouldExtendRightPanel) {
|
||||||
if ([self.rightPanel respondsToSelector:@selector(showArrow)]){
|
if ([self.rightPanel respondsToSelector:@selector(showArrow)]){
|
||||||
[self.rightPanel showArrow];
|
[self.rightPanel showArrow];
|
||||||
}
|
}
|
||||||
@ -579,7 +585,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
self.rightPanelSeparator = rightPanelSeparator;
|
self.rightPanelSeparator = rightPanelSeparator;
|
||||||
}
|
}
|
||||||
|
|
||||||
[self panelWillAppear:self.rightPanel animated:animated];
|
[self panelWillAppear:self.rightPanel willExtend:shouldExtendRightPanel animated:animated];
|
||||||
if (animated) {
|
if (animated) {
|
||||||
[UIView animateWithDuration:PanelAnimationDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:animations completion:completion];
|
[UIView animateWithDuration:PanelAnimationDuration delay:0 options:UIViewAnimationOptionCurveLinear animations:animations completion:completion];
|
||||||
} else {
|
} else {
|
||||||
@ -612,7 +618,7 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
[self hideRightPanelIfNeededAnimated:YES];
|
[self hideRightPanelIfNeededAnimated:YES];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)panelWillAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel animated:(BOOL)animated {
|
- (void)panelWillAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel willExtend:(BOOL)willExtend animated:(BOOL)animated {
|
||||||
if ([panel respondsToSelector:@selector(willAppear:)]) {
|
if ([panel respondsToSelector:@selector(willAppear:)]) {
|
||||||
[panel willAppear:animated];
|
[panel willAppear:animated];
|
||||||
} else {
|
} else {
|
||||||
@ -621,13 +627,15 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
UIViewController *controller = [self getCurrentDetailViewController];
|
UIViewController *controller = [self getCurrentDetailViewController];
|
||||||
if ([controller.class conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]) {
|
if ([controller.class conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]) {
|
||||||
UIViewController <MVMCoreUIDetailViewProtocol>* protocolController = (UIViewController <MVMCoreUIDetailViewProtocol>*)controller;
|
UIViewController <MVMCoreUIDetailViewProtocol>* protocolController = (UIViewController <MVMCoreUIDetailViewProtocol>*)controller;
|
||||||
if ([protocolController respondsToSelector:@selector(panelWillAppear:)]) {
|
if ([protocolController respondsToSelector:@selector(panelWillAppear:overtakingDetail:)]) {
|
||||||
|
[protocolController panelWillAppear:panel overtakingDetail:!willExtend];
|
||||||
|
} else if ([protocolController respondsToSelector:@selector(panelWillAppear:)]) {
|
||||||
[protocolController panelWillAppear:panel];
|
[protocolController panelWillAppear:panel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)panelDidAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel animated:(BOOL)animated {
|
- (void)panelDidAppear:(UIViewController <MVMCoreUIPanelProtocol> *)panel didExtend:(BOOL)didExtend animated:(BOOL)animated {
|
||||||
if ([panel respondsToSelector:@selector(didAppear:)]) {
|
if ([panel respondsToSelector:@selector(didAppear:)]) {
|
||||||
[panel didAppear:animated];
|
[panel didAppear:animated];
|
||||||
} else {
|
} else {
|
||||||
@ -636,7 +644,9 @@ CGFloat const PanelAnimationDuration = 0.2;
|
|||||||
UIViewController *controller = [self getCurrentDetailViewController];
|
UIViewController *controller = [self getCurrentDetailViewController];
|
||||||
if ([controller.class conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]) {
|
if ([controller.class conformsToProtocol:@protocol(MVMCoreUIDetailViewProtocol)]) {
|
||||||
UIViewController <MVMCoreUIDetailViewProtocol>* protocolController = (UIViewController <MVMCoreUIDetailViewProtocol>*)controller;
|
UIViewController <MVMCoreUIDetailViewProtocol>* protocolController = (UIViewController <MVMCoreUIDetailViewProtocol>*)controller;
|
||||||
if ([protocolController respondsToSelector:@selector(panelDidAppear:)]) {
|
if ([protocolController respondsToSelector:@selector(panelDidAppear:overtakingDetail:)]) {
|
||||||
|
[protocolController panelDidAppear:panel overtakingDetail:!didExtend];
|
||||||
|
} else if ([protocolController respondsToSelector:@selector(panelDidAppear:)]) {
|
||||||
[protocolController panelDidAppear:panel];
|
[protocolController panelDidAppear:panel];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -54,7 +54,7 @@ static const CGFloat CheckBoxHeightWidth = 18.0;
|
|||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (UIStackViewAlignment)alignment {
|
- (UIStackViewAlignment)horizontalAlignment {
|
||||||
return UIStackViewAlignmentLeading;
|
return UIStackViewAlignmentLeading;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -11,7 +11,8 @@ import UIKit
|
|||||||
open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol {
|
open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol {
|
||||||
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
||||||
open var json: [AnyHashable: Any]?
|
open var json: [AnyHashable: Any]?
|
||||||
|
public let containerHelper = ContainerHelper()
|
||||||
|
|
||||||
// In updateView, will set padding to default.
|
// In updateView, will set padding to default.
|
||||||
open var updateViewHorizontalDefaults = true
|
open var updateViewHorizontalDefaults = true
|
||||||
open var updateViewVerticalDefaults = true
|
open var updateViewVerticalDefaults = true
|
||||||
@ -91,21 +92,19 @@ open class MoleculeCollectionViewCell: UICollectionViewCell, MVMCoreUIMoleculeVi
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
if molecule == nil {
|
if molecule == nil {
|
||||||
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: true) {
|
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: false) {
|
||||||
contentView.insertSubview(moleculeView, at: 0)
|
contentView.insertSubview(moleculeView, at: 0)
|
||||||
NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: moleculeView, useMargins: true).values))
|
containerHelper.constrainView(moleculeView)
|
||||||
molecule = moleculeView
|
molecule = moleculeView
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
molecule?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
|
molecule?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
// This molecule will handle spacing by default.
|
|
||||||
if let castView = molecule as? MVMCoreUIViewConstrainingProtocol {
|
guard let molecule = molecule else { return }
|
||||||
castView.shouldSetHorizontalMargins?(false)
|
containerHelper.set(with: json, for: molecule)
|
||||||
castView.shouldSetVerticalMargins?(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
accessibilityElements = molecule?.subviews
|
accessibilityElements = molecule.subviews
|
||||||
}
|
}
|
||||||
|
|
||||||
public func reset() {
|
public func reset() {
|
||||||
|
|||||||
@ -11,11 +11,20 @@ import UIKit
|
|||||||
@objcMembers open class MoleculeTableViewCell: TableViewCell {
|
@objcMembers open class MoleculeTableViewCell: TableViewCell {
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
public override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?)
|
||||||
|
{
|
||||||
|
guard let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule) else {
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if molecule == nil {
|
||||||
|
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: false) {
|
||||||
|
addMolecule(moleculeView)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
molecule?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
guard molecule == nil, let json = json, let moleculeJSON = json.optionalDictionaryForKey(KeyMolecule), let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: true) else { return }
|
|
||||||
addMolecule(moleculeView)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public override class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
|
|||||||
56
MVMCoreUI/Molecules/Items/StackItem.swift
Normal file
56
MVMCoreUI/Molecules/Items/StackItem.swift
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
//
|
||||||
|
// StackItem.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 12/13/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
open class StackItemModel: ContainerModelProtocol {
|
||||||
|
public var view: StackItem
|
||||||
|
public var spacing: CGFloat?
|
||||||
|
public var percentage: Int?
|
||||||
|
public var verticalAlignment: UIStackView.Alignment?
|
||||||
|
public var horizontalAlignment: UIStackView.Alignment?
|
||||||
|
public var useHorizontalMargins: Bool? = false
|
||||||
|
public var useVerticalMargins: Bool? = false
|
||||||
|
public var gone = false
|
||||||
|
|
||||||
|
init(with view: StackItem) {
|
||||||
|
self.view = view
|
||||||
|
view.model = self
|
||||||
|
}
|
||||||
|
|
||||||
|
init(with view: StackItem, json: [AnyHashable: Any]?) {
|
||||||
|
self.view = view
|
||||||
|
view.model = self
|
||||||
|
update(with: json)
|
||||||
|
}
|
||||||
|
|
||||||
|
func update(with json: [AnyHashable: Any]?) {
|
||||||
|
gone = json?.boolForKey("gone") ?? (json == nil)
|
||||||
|
spacing = json?.optionalCGFloatForKey("spacing")
|
||||||
|
percentage = json?["percent"] as? Int
|
||||||
|
if let horizontalAlignmentString = json?.optionalStringForKey("horizontalAlignment") {
|
||||||
|
horizontalAlignment = ContainerHelper.getAlignment(for: horizontalAlignmentString)
|
||||||
|
} else {
|
||||||
|
horizontalAlignment = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if let verticalAlignmentString = json?.optionalStringForKey("verticalAlignment") {
|
||||||
|
verticalAlignment = ContainerHelper.getAlignment(for: verticalAlignmentString)
|
||||||
|
} else {
|
||||||
|
verticalAlignment = nil
|
||||||
|
}
|
||||||
|
|
||||||
|
useHorizontalMargins = json?.optionalBoolForKey("useHorizontalMargins") ?? false
|
||||||
|
useVerticalMargins = json?.optionalBoolForKey("useVerticalMargins") ?? false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
open class StackItem: MoleculeContainer {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -11,7 +11,8 @@ import UIKit
|
|||||||
@objcMembers open class TableViewCell: UITableViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol {
|
@objcMembers open class TableViewCell: UITableViewCell, MVMCoreUIMoleculeViewProtocol, MoleculeListCellProtocol {
|
||||||
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
||||||
open var json: [AnyHashable: Any]?
|
open var json: [AnyHashable: Any]?
|
||||||
|
public let containerHelper = ContainerHelper()
|
||||||
|
|
||||||
// In updateView, will set padding to default.
|
// In updateView, will set padding to default.
|
||||||
open var updateViewHorizontalDefaults = true
|
open var updateViewHorizontalDefaults = true
|
||||||
|
|
||||||
@ -48,6 +49,8 @@ import UIKit
|
|||||||
styleStandard()
|
styleStandard()
|
||||||
case "header":
|
case "header":
|
||||||
styleHeader()
|
styleHeader()
|
||||||
|
case "sectionFooter":
|
||||||
|
styleFooter()
|
||||||
case "none":
|
case "none":
|
||||||
styleNone()
|
styleNone()
|
||||||
default: break
|
default: break
|
||||||
@ -68,6 +71,13 @@ import UIKit
|
|||||||
bottomSeparatorView?.style = .thin
|
bottomSeparatorView?.style = .thin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open func styleFooter() {
|
||||||
|
topMarginPadding = 24
|
||||||
|
bottomMarginPadding = 0
|
||||||
|
topSeparatorView?.style = .none
|
||||||
|
bottomSeparatorView?.style = .none
|
||||||
|
}
|
||||||
|
|
||||||
open func styleNone() {
|
open func styleNone() {
|
||||||
topMarginPadding = 0
|
topMarginPadding = 0
|
||||||
bottomMarginPadding = 0
|
bottomMarginPadding = 0
|
||||||
@ -78,14 +88,7 @@ import UIKit
|
|||||||
/// Adds the molecule to the view.
|
/// Adds the molecule to the view.
|
||||||
open func addMolecule(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
|
open func addMolecule(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
|
||||||
contentView.addSubview(molecule)
|
contentView.addSubview(molecule)
|
||||||
let standardConstraints = (molecule as? MVMCoreUIViewConstrainingProtocol)?.useStandardConstraints?() ?? true
|
containerHelper.constrainView(molecule)
|
||||||
NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: molecule, useMargins: standardConstraints).values))
|
|
||||||
|
|
||||||
// This molecule will by default handle margins.
|
|
||||||
if let castView = molecule as? MVMCoreUIViewConstrainingProtocol {
|
|
||||||
castView.shouldSetHorizontalMargins?(false)
|
|
||||||
castView.shouldSetVerticalMargins?(false)
|
|
||||||
}
|
|
||||||
self.molecule = molecule
|
self.molecule = molecule
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,14 +179,8 @@ import UIKit
|
|||||||
bottomSeparatorView?.setWithJSON(separator, delegateObject: delegateObject, additionalData: additionalData)
|
bottomSeparatorView?.setWithJSON(separator, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
guard let moleculeJSON = json.optionalDictionaryForKey(KeyMolecule) else { return }
|
guard let molecule = molecule else { return }
|
||||||
molecule?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
|
containerHelper.set(with: json, for: molecule)
|
||||||
|
|
||||||
// This molecule will by default handle margins.
|
|
||||||
if let castView = molecule as? MVMCoreUIViewConstrainingProtocol {
|
|
||||||
castView.shouldSetHorizontalMargins?(false)
|
|
||||||
castView.shouldSetVerticalMargins?(false)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public func reset() {
|
public func reset() {
|
||||||
@ -237,11 +234,13 @@ import UIKit
|
|||||||
|
|
||||||
var queue = [UIView]()
|
var queue = [UIView]()
|
||||||
|
|
||||||
for view in views {
|
// Reversed the array to first check views at the front.
|
||||||
|
for view in views.reversed() {
|
||||||
// Only one Label will have a hero in a table cell.
|
// Only one Label will have a hero in a table cell.
|
||||||
if let label = view as? Label, label.hero != nil {
|
if let label = view as? Label, label.hero != nil {
|
||||||
return label
|
return label
|
||||||
}
|
}
|
||||||
|
|
||||||
queue.append(contentsOf: view.subviews)
|
queue.append(contentsOf: view.subviews)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -8,13 +8,17 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
open class ModuleMolecule: ViewConstrainingView {
|
struct ModuleMoleculeModel: ContainerModelProtocol {
|
||||||
|
var horizontalAlignment: UIStackView.Alignment? = .fill
|
||||||
open var moduleMolecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
var verticalAlignment: UIStackView.Alignment? = .fill
|
||||||
|
var useHorizontalMargins: Bool? = false
|
||||||
|
var useVerticalMargins: Bool? = false
|
||||||
|
}
|
||||||
|
|
||||||
open override func updateView(_ size: CGFloat) {
|
open class ModuleMolecule: Container {
|
||||||
super.updateView(size)
|
public override func setupView() {
|
||||||
moduleMolecule?.updateView(size)
|
super.setupView()
|
||||||
|
model = ModuleMoleculeModel()
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
@ -26,35 +30,16 @@ open class ModuleMolecule: ViewConstrainingView {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if moduleMolecule == nil {
|
if view == nil {
|
||||||
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: module, delegateObject: delegateObject, constrainIfNeeded: true) {
|
if let moleculeView = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: module, delegateObject: delegateObject, constrainIfNeeded: false) {
|
||||||
addSubview(moleculeView)
|
addAndContain(moleculeView)
|
||||||
NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: moleculeView, useMargins: false).values))
|
|
||||||
moduleMolecule = moleculeView
|
|
||||||
|
|
||||||
isAccessibilityElement = false
|
|
||||||
if moleculeView.accessibilityElements != nil {
|
|
||||||
accessibilityElements = moleculeView.accessibilityElements
|
|
||||||
} else {
|
|
||||||
accessibilityElements = [moleculeView]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
moduleMolecule?.setWithJSON(module, delegateObject: delegateObject, additionalData: additionalData)
|
(view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON(module, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setAsMolecule() {
|
public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
super.setAsMolecule()
|
|
||||||
moduleMolecule?.setAsMolecule?()
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func reset() {
|
|
||||||
super.reset()
|
|
||||||
moduleMolecule?.reset?()
|
|
||||||
}
|
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
|
||||||
guard let moduleName = json?.optionalStringForKey("moduleName"), let module = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else {
|
guard let moduleName = json?.optionalStringForKey("moduleName"), let module = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else {
|
||||||
// Critical error
|
// Critical error
|
||||||
return 0
|
return 0
|
||||||
@ -62,7 +47,7 @@ open class ModuleMolecule: ViewConstrainingView {
|
|||||||
return MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: module)?.estimatedHeight?(forRow: module, delegateObject: delegateObject) ?? 0
|
return MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: module)?.estimatedHeight?(forRow: module, delegateObject: delegateObject) ?? 0
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func name(forReuse molecule: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public class func name(forReuse molecule: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
guard let moduleName = molecule?.optionalStringForKey("moduleName"), let module = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else {
|
guard let moduleName = molecule?.optionalStringForKey("moduleName"), let module = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else {
|
||||||
// Critical error
|
// Critical error
|
||||||
return "moduleMolecule<>"
|
return "moduleMolecule<>"
|
||||||
@ -70,7 +55,7 @@ open class ModuleMolecule: ViewConstrainingView {
|
|||||||
return "moduleMolecule<" + (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: module)?.name?(forReuse: module, delegateObject: delegateObject) ?? module.stringForkey(KeyMoleculeName)) + ">"
|
return "moduleMolecule<" + (MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: module)?.name?(forReuse: module, delegateObject: delegateObject) ?? module.stringForkey(KeyMoleculeName)) + ">"
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func requiredModules(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
public class func requiredModules(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
let moduleName = json?.optionalStringForKey("moduleName")
|
let moduleName = json?.optionalStringForKey("moduleName")
|
||||||
if moduleName == nil || delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) == nil {
|
if moduleName == nil || delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) == nil {
|
||||||
if let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: CoreUIErrorCode.ErrorCodeModuleMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) {
|
if let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: CoreUIErrorCode.ErrorCodeModuleMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) {
|
||||||
@ -83,25 +68,4 @@ open class ModuleMolecule: ViewConstrainingView {
|
|||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MVMCoreUIViewConstrainingProtocol
|
|
||||||
open override func useStandardConstraints() -> Bool {
|
|
||||||
return (moduleMolecule as? MVMCoreUIViewConstrainingProtocol)?.useStandardConstraints?() ?? true
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func alignHorizontal(_ alignment: UIStackView.Alignment) {
|
|
||||||
(moduleMolecule as? MVMCoreUIViewConstrainingProtocol)?.alignHorizontal?(alignment)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func alignVertical(_ alignment: UIStackView.Alignment) {
|
|
||||||
(moduleMolecule as? MVMCoreUIViewConstrainingProtocol)?.alignVertical?(alignment)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func shouldSetHorizontalMargins(_ shouldSet: Bool) {
|
|
||||||
(moduleMolecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetHorizontalMargins?(shouldSet)
|
|
||||||
}
|
|
||||||
|
|
||||||
open override func shouldSetVerticalMargins(_ shouldSet: Bool) {
|
|
||||||
(moduleMolecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(shouldSet)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
27
MVMCoreUI/Molecules/MoleculeContainer.swift
Normal file
27
MVMCoreUI/Molecules/MoleculeContainer.swift
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
//
|
||||||
|
// MoleculeContainer.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 12/12/19.
|
||||||
|
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
open class MoleculeContainer: Container {
|
||||||
|
|
||||||
|
override public func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||||
|
guard let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule) else {
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if view == nil {
|
||||||
|
if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: false) {
|
||||||
|
addAndContain(molecule)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
(view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -8,28 +8,23 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
open class StandardFooterView: ViewConstrainingView {
|
open class StandardFooterView: MoleculeContainer {
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
topMarginPadding = PaddingDefaultVerticalSpacing
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
shouldSetupMoleculeFromJSON = true
|
|
||||||
updateViewVerticalDefaults = true
|
|
||||||
updateViewHorizontalDefaults = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
|
||||||
|
|
||||||
// This molecule will by default handle margins.
|
|
||||||
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetHorizontalMargins?(false)
|
|
||||||
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
|
||||||
if let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), let height = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON)?.estimatedHeight?(forRow: moleculeJSON, delegateObject: delegateObject) {
|
if let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), let height = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON)?.estimatedHeight?(forRow: moleculeJSON, delegateObject: delegateObject) {
|
||||||
return height + PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing
|
return height + PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing
|
||||||
}
|
}
|
||||||
return 42
|
return 42
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open override func reset() {
|
||||||
|
super.reset()
|
||||||
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class StandardHeaderView: ViewConstrainingView {
|
public class StandardHeaderView: MoleculeContainer {
|
||||||
var line: Line?
|
var line: Line?
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
@ -19,9 +19,6 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
|
|
||||||
public override func setupView() {
|
public override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
shouldSetupMoleculeFromJSON = true
|
|
||||||
updateViewVerticalDefaults = true
|
|
||||||
updateViewHorizontalDefaults = true
|
|
||||||
topMarginPadding = PaddingDefaultVerticalSpacing
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
|
|
||||||
@ -38,11 +35,6 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
|
|
||||||
// This molecule will by default handle margins.
|
|
||||||
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetHorizontalMargins?(false)
|
|
||||||
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(false)
|
|
||||||
|
|
||||||
if let separatorJSON = json?.optionalDictionaryForKey("separator") {
|
if let separatorJSON = json?.optionalDictionaryForKey("separator") {
|
||||||
line?.setWithJSON(separatorJSON, delegateObject: delegateObject, additionalData: additionalData)
|
line?.setWithJSON(separatorJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
@ -50,12 +42,12 @@ public class StandardHeaderView: ViewConstrainingView {
|
|||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
|
line?.style = .heavy
|
||||||
topMarginPadding = PaddingDefaultVerticalSpacing
|
topMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
bottomMarginPadding = PaddingDefaultVerticalSpacing
|
||||||
line?.style = .heavy
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
if let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), let height = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON)?.estimatedHeight?(forRow: moleculeJSON, delegateObject: delegateObject) {
|
if let moleculeJSON = json?.optionalDictionaryForKey(KeyMolecule), let height = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(withJSON: moleculeJSON)?.estimatedHeight?(forRow: moleculeJSON, delegateObject: delegateObject) {
|
||||||
return height + PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing
|
return height + PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,15 +22,14 @@ import UIKit
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
stack.spacing = 0
|
stack.spacing = 0
|
||||||
stack.updateViewHorizontalDefaults = false
|
|
||||||
addSubview(stack)
|
addSubview(stack)
|
||||||
pinView(toSuperView: stack)
|
pinView(toSuperView: stack)
|
||||||
stack.addStackItem(StackItem(with: eyebrow), lastItem: false)
|
stack.addStackItem(StackItemModel(with: StackItem(andContain: eyebrow)), lastItem: false)
|
||||||
stack.addStackItem(StackItem(with: headline), lastItem: false)
|
stack.addStackItem(StackItemModel(with: StackItem(andContain: headline)), lastItem: false)
|
||||||
stack.addStackItem(StackItem(with: body), lastItem: false)
|
stack.addStackItem(StackItemModel(with: StackItem(andContain: body)), lastItem: false)
|
||||||
|
|
||||||
// To visually take into account the extra padding in the intrinsic content of a button.
|
// To visually take into account the extra padding in the intrinsic content of a button.
|
||||||
let stackItem = StackItem(with: link)
|
let stackItem = StackItemModel(with: StackItem(andContain: link))
|
||||||
stackItem.spacing = -6
|
stackItem.spacing = -6
|
||||||
stack.addStackItem(stackItem, lastItem: true)
|
stack.addStackItem(stackItem, lastItem: true)
|
||||||
}
|
}
|
||||||
@ -58,7 +57,6 @@ import UIKit
|
|||||||
super.reset()
|
super.reset()
|
||||||
stack.reset()
|
stack.reset()
|
||||||
stack.spacing = 0
|
stack.spacing = 0
|
||||||
stack.updateViewHorizontalDefaults = false
|
|
||||||
eyebrow.styleB3(true)
|
eyebrow.styleB3(true)
|
||||||
headline.styleB1(true)
|
headline.styleB1(true)
|
||||||
body.styleB2(true)
|
body.styleB2(true)
|
||||||
|
|||||||
@ -8,47 +8,13 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
public class StackItem {
|
open class MoleculeStackView: Container {
|
||||||
var view: UIView
|
|
||||||
var spacing: CGFloat?
|
|
||||||
var percentage: Int?
|
|
||||||
var verticalAlignment: UIStackView.Alignment?
|
|
||||||
var horizontalAlignment: UIStackView.Alignment?
|
|
||||||
var gone = false
|
|
||||||
|
|
||||||
init(with view: UIView) {
|
|
||||||
self.view = view
|
|
||||||
}
|
|
||||||
|
|
||||||
init(with view: UIView, json: [AnyHashable: Any]?) {
|
|
||||||
self.view = view
|
|
||||||
update(with: json)
|
|
||||||
}
|
|
||||||
|
|
||||||
func update(with json: [AnyHashable: Any]?) {
|
|
||||||
gone = json?.boolForKey("gone") ?? (json == nil)
|
|
||||||
spacing = json?.optionalCGFloatForKey("spacing")
|
|
||||||
percentage = json?["percent"] as? Int
|
|
||||||
if let alignment = json?.stringOptionalWithChainOfKeysOrIndexes([KeyMolecule,"verticalAlignment"]) {
|
|
||||||
verticalAlignment = ViewConstrainingView.getAlignmentFor(alignment, defaultAlignment: .fill)
|
|
||||||
} else {
|
|
||||||
verticalAlignment = nil
|
|
||||||
}
|
|
||||||
if let alignment = json?.stringOptionalWithChainOfKeysOrIndexes([KeyMolecule,"horizontalAlignment"]) {
|
|
||||||
horizontalAlignment = ViewConstrainingView.getAlignmentFor(alignment, defaultAlignment: .fill)
|
|
||||||
} else {
|
|
||||||
horizontalAlignment = nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public class MoleculeStackView: ViewConstrainingView {
|
|
||||||
var contentView: UIView = MVMCoreUICommonViewsUtility.commonView()
|
var contentView: UIView = MVMCoreUICommonViewsUtility.commonView()
|
||||||
var items: [StackItem] = []
|
var items: [StackItemModel] = []
|
||||||
var useStackSpacingBeforeFirstItem = false
|
var useStackSpacingBeforeFirstItem = false
|
||||||
|
|
||||||
private var moleculesShouldSetHorizontalMargins = false
|
var moleculesShouldSetHorizontalMargins = false
|
||||||
private var moleculesShouldSetVerticalMargins = false
|
var moleculesShouldSetVerticalMargins = false
|
||||||
|
|
||||||
/// For setting the direction of the stack
|
/// For setting the direction of the stack
|
||||||
var axis: NSLayoutConstraint.Axis = .vertical {
|
var axis: NSLayoutConstraint.Axis = .vertical {
|
||||||
@ -97,6 +63,10 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Inits
|
// MARK: - Inits
|
||||||
|
public override init() {
|
||||||
|
super.init()
|
||||||
|
}
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
}
|
}
|
||||||
@ -117,19 +87,20 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
MVMCoreUIUtility.setMarginsFor(contentView, leading: 0, top: 0, trailing: 0, bottom: 0)
|
MVMCoreUIUtility.setMarginsFor(contentView, leading: 0, top: 0, trailing: 0, bottom: 0)
|
||||||
updateViewHorizontalDefaults = true
|
|
||||||
translatesAutoresizingMaskIntoConstraints = false
|
translatesAutoresizingMaskIntoConstraints = false
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
addSubview(contentView)
|
addSubview(contentView)
|
||||||
pinView(toSuperView: contentView)
|
containerHelper.constrainView(contentView)
|
||||||
contentView.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
contentView.setContentHuggingPriority(.defaultHigh, for: .vertical)
|
||||||
contentView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
contentView.setContentHuggingPriority(.defaultHigh, for: .horizontal)
|
||||||
}
|
}
|
||||||
|
|
||||||
public override func updateView(_ size: CGFloat) {
|
public override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
|
directionalLayoutMargins.leading = 0
|
||||||
|
directionalLayoutMargins.trailing = 0
|
||||||
for item in items {
|
for item in items {
|
||||||
(item.view as? MVMCoreViewProtocol)?.updateView(size)
|
item.view.updateView(size)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,11 +108,8 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
public override func reset() {
|
public override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
backgroundColor = .clear
|
backgroundColor = .clear
|
||||||
updateViewHorizontalDefaults = true
|
|
||||||
for item in items {
|
for item in items {
|
||||||
if let view = item.view as? MVMCoreUIMoleculeViewProtocol {
|
item.view.reset()
|
||||||
view.reset?()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -151,7 +119,7 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
removeAllItemViews()
|
removeAllItemViews()
|
||||||
|
|
||||||
// If the items in the stack are the same, just update previous items instead of re-allocating.
|
// If the items in the stack are the same, just update previous items instead of re-allocating.
|
||||||
var items: [StackItem]?
|
var items: [StackItemModel]?
|
||||||
if MoleculeStackView.name(forReuse: previousJSON, delegateObject: delegateObject) == MoleculeStackView.name(forReuse: json, delegateObject: delegateObject) {
|
if MoleculeStackView.name(forReuse: previousJSON, delegateObject: delegateObject) == MoleculeStackView.name(forReuse: json, delegateObject: delegateObject) {
|
||||||
items = self.items
|
items = self.items
|
||||||
}
|
}
|
||||||
@ -167,24 +135,28 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
|
|
||||||
// Adds the molecules and sets the json.
|
// Adds the molecules and sets the json.
|
||||||
for (index, map) in molecules.enumerated() {
|
for (index, map) in molecules.enumerated() {
|
||||||
if let moleculeJSON = map.optionalDictionaryForKey(KeyMolecule) {
|
var view: UIView?
|
||||||
var view: UIView?
|
var stackItemModel: StackItemModel
|
||||||
if let item = items?[index] {
|
if let item = items?[index] {
|
||||||
item.update(with: map)
|
stackItemModel = item
|
||||||
view = item.view
|
item.update(with: map)
|
||||||
(view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON(moleculeJSON, delegateObject: delegateObject, additionalData: nil)
|
view = item.view
|
||||||
addStackItem(item, lastItem: index == molecules.count - 1)
|
(view as? MVMCoreUIMoleculeViewProtocol)?.setWithJSON(map, delegateObject: delegateObject, additionalData: nil)
|
||||||
} else if let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(forJSON: moleculeJSON, delegateObject: delegateObject, constrainIfNeeded: true) {
|
addStackItem(item, lastItem: index == molecules.count - 1)
|
||||||
view = molecule
|
} else {
|
||||||
addStackItem(StackItem(with: molecule, json: map), lastItem: index == molecules.count - 1)
|
let stackItem = StackItem()
|
||||||
}
|
stackItem.setWithJSON(map, delegateObject: delegateObject, additionalData: additionalData)
|
||||||
(view as? MVMCoreUIViewConstrainingProtocol)?.shouldSetHorizontalMargins?(moleculesShouldSetHorizontalMargins)
|
view = stackItem
|
||||||
(view as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(moleculesShouldSetVerticalMargins)
|
stackItemModel = StackItemModel(with: stackItem, json: map)
|
||||||
|
addStackItem(stackItemModel, lastItem: index == molecules.count - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stackItemModel.useHorizontalMargins = moleculesShouldSetHorizontalMargins
|
||||||
|
stackItemModel.useVerticalMargins = moleculesShouldSetVerticalMargins
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func name(forReuse molecule: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public class func name(forReuse molecule: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
// This will aggregate names of molecules to make an id.
|
// This will aggregate names of molecules to make an id.
|
||||||
guard let molecules = molecule?.optionalArrayForKey(KeyMolecules) else {
|
guard let molecules = molecule?.optionalArrayForKey(KeyMolecules) else {
|
||||||
return "stack<>"
|
return "stack<>"
|
||||||
@ -199,7 +171,7 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
return name
|
return name
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
public class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
guard let items = json?.optionalArrayForKey(KeyMolecules) else {
|
guard let items = json?.optionalArrayForKey(KeyMolecules) else {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
@ -221,7 +193,7 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
return estimatedHeight
|
return estimatedHeight
|
||||||
}
|
}
|
||||||
|
|
||||||
public override class func requiredModules(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
public class func requiredModules(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
guard let items = json?.optionalArrayForKey(KeyMolecules) else {
|
guard let items = json?.optionalArrayForKey(KeyMolecules) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -237,11 +209,11 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
// MARK: - Adding to stack
|
// MARK: - Adding to stack
|
||||||
/// Adds the view to the stack.
|
/// Adds the view to the stack.
|
||||||
func addView(_ view: UIView, lastItem: Bool) {
|
func addView(_ view: UIView, lastItem: Bool) {
|
||||||
addStackItem(StackItem(with: view), lastItem: lastItem)
|
addStackItem(StackItemModel(with: StackItem(andContain: view)), lastItem: lastItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Adds the stack item to the stack.
|
/// Adds the stack item to the stack.
|
||||||
func addStackItem(_ stackItem: StackItem, lastItem: Bool) {
|
func addStackItem(_ stackItem: StackItemModel, lastItem: Bool) {
|
||||||
guard !stackItem.gone else {
|
guard !stackItem.gone else {
|
||||||
items.append(stackItem)
|
items.append(stackItem)
|
||||||
return
|
return
|
||||||
@ -251,12 +223,11 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
view.translatesAutoresizingMaskIntoConstraints = false
|
view.translatesAutoresizingMaskIntoConstraints = false
|
||||||
|
|
||||||
let spacing = stackItem.spacing ?? self.spacing
|
let spacing = stackItem.spacing ?? self.spacing
|
||||||
if let view = view as? MVMCoreUIViewConstrainingProtocol {
|
let verticalAlignment = stackItem.verticalAlignment ?? (stackItem.percentage == nil && axis == .vertical ? .fill : (axis == .vertical ? .leading : .center))
|
||||||
let verticalAlignment = stackItem.verticalAlignment ?? (stackItem.percentage == nil && axis == .vertical ? .fill : (axis == .vertical ? .leading : .center))
|
let horizontalAlignment = stackItem.horizontalAlignment ?? (view.view as? MVMCoreUIViewConstrainingProtocol)?.horizontalAlignment?() ?? (axis == .vertical || stackItem.percentage == nil ? .fill : .leading)
|
||||||
let horizontalAlignment = stackItem.horizontalAlignment ?? view.alignment?() ?? (axis == .vertical || stackItem.percentage == nil ? .fill : .leading)
|
view.containerHelper.alignHorizontal(horizontalAlignment)
|
||||||
view.alignHorizontal?(horizontalAlignment)
|
view.containerHelper.alignVertical(verticalAlignment)
|
||||||
view.alignVertical?(verticalAlignment)
|
|
||||||
}
|
|
||||||
let first = items.first { !$0.gone } == nil
|
let first = items.first { !$0.gone } == nil
|
||||||
if axis == .vertical {
|
if axis == .vertical {
|
||||||
if first {
|
if first {
|
||||||
@ -264,7 +235,7 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
} else if let previousView = items.last(where: { stackItem in
|
} else if let previousView = items.last(where: { stackItem in
|
||||||
return !stackItem.gone
|
return !stackItem.gone
|
||||||
})?.view {
|
})?.view {
|
||||||
_ = NSLayoutConstraint(pinFirstView: previousView, toSecondView: view, withConstant: spacing, directionVertical: true)
|
view.topAnchor.constraint(equalTo: previousView.bottomAnchor, constant: spacing).isActive = true
|
||||||
}
|
}
|
||||||
pinView(view, toView: contentView, attribute: .leading, relation: .equal, priority: .required, constant: 0)
|
pinView(view, toView: contentView, attribute: .leading, relation: .equal, priority: .required, constant: 0)
|
||||||
pinView(contentView, toView: view, attribute: .trailing, relation: .equal, priority: .required, constant: 0)
|
pinView(contentView, toView: view, attribute: .trailing, relation: .equal, priority: .required, constant: 0)
|
||||||
@ -281,7 +252,7 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
} else if let previousView = items.last(where: { stackItem in
|
} else if let previousView = items.last(where: { stackItem in
|
||||||
return !stackItem.gone
|
return !stackItem.gone
|
||||||
})?.view {
|
})?.view {
|
||||||
_ = NSLayoutConstraint(pinFirstView: previousView, toSecondView: view, withConstant: spacing, directionVertical: false)
|
view.leftAnchor.constraint(equalTo: previousView.rightAnchor, constant: spacing).isActive = true
|
||||||
}
|
}
|
||||||
pinView(view, toView: contentView, attribute: .top, relation: .equal, priority: .required, constant: 0)
|
pinView(view, toView: contentView, attribute: .top, relation: .equal, priority: .required, constant: 0)
|
||||||
pinView(contentView, toView: view, attribute: .bottom, relation: .equal, priority: .required, constant: 0)
|
pinView(contentView, toView: view, attribute: .bottom, relation: .equal, priority: .required, constant: 0)
|
||||||
@ -295,10 +266,10 @@ public class MoleculeStackView: ViewConstrainingView {
|
|||||||
items.append(stackItem)
|
items.append(stackItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
func setWithStackItems(_ items: [StackItem]) {
|
func setWithStackItems(_ items: [StackItemModel]) {
|
||||||
removeAllItemViews()
|
removeAllItemViews()
|
||||||
self.items.removeAll()
|
self.items.removeAll()
|
||||||
var previousPresentItem: StackItem? = nil
|
var previousPresentItem: StackItemModel? = nil
|
||||||
for item in items {
|
for item in items {
|
||||||
if !item.gone {
|
if !item.gone {
|
||||||
previousPresentItem = item
|
previousPresentItem = item
|
||||||
|
|||||||
@ -27,7 +27,7 @@
|
|||||||
mapping = [@{
|
mapping = [@{
|
||||||
@"label": Label.class,
|
@"label": Label.class,
|
||||||
@"line": Line.class,
|
@"line": Line.class,
|
||||||
@"button": ButtonView.class,
|
@"button": PrimaryButton.class,
|
||||||
@"textButton": MFTextButton.class,
|
@"textButton": MFTextButton.class,
|
||||||
@"header": StandardHeaderView.class,
|
@"header": StandardHeaderView.class,
|
||||||
@"moleculeStack": MoleculeStackView.class,
|
@"moleculeStack": MoleculeStackView.class,
|
||||||
|
|||||||
@ -16,7 +16,13 @@
|
|||||||
- (BOOL)needsToBeConstrained;
|
- (BOOL)needsToBeConstrained;
|
||||||
|
|
||||||
/// The alignment if constrained.
|
/// The alignment if constrained.
|
||||||
- (UIStackViewAlignment)alignment;
|
- (UIStackViewAlignment)alignment __deprecated;
|
||||||
|
|
||||||
|
/// The alignment if constrained.
|
||||||
|
- (UIStackViewAlignment)horizontalAlignment;
|
||||||
|
|
||||||
|
/// The alignment if constrained.
|
||||||
|
- (UIStackViewAlignment)verticalAlignment;
|
||||||
|
|
||||||
/// Can be used to override any standard constraints that may be added.
|
/// Can be used to override any standard constraints that may be added.
|
||||||
- (BOOL)useStandardConstraints;
|
- (BOOL)useStandardConstraints;
|
||||||
|
|||||||
@ -42,6 +42,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController {
|
|||||||
}
|
}
|
||||||
let stack = MoleculeStackView(frame: .zero)
|
let stack = MoleculeStackView(frame: .zero)
|
||||||
stack.useStackSpacingBeforeFirstItem = true
|
stack.useStackSpacingBeforeFirstItem = true
|
||||||
|
stack.moleculesShouldSetHorizontalMargins = true
|
||||||
stack.setWithJSON(moleculeJSON, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, additionalData: nil)
|
stack.setWithJSON(moleculeJSON, delegateObject: delegateObject() as? MVMCoreUIDelegateObject, additionalData: nil)
|
||||||
return stack
|
return stack
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user