swiftify MoleculeDelegateProtocol
This commit is contained in:
parent
c8f8f8136d
commit
8d2348fe63
@ -52,7 +52,6 @@
|
|||||||
017BEB4A236235BA0024EF95 /* ModelMoleculeViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */; };
|
017BEB4A236235BA0024EF95 /* ModelMoleculeViewProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */; };
|
||||||
017BEB7B236763000024EF95 /* LineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7A236763000024EF95 /* LineModel.swift */; };
|
017BEB7B236763000024EF95 /* LineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7A236763000024EF95 /* LineModel.swift */; };
|
||||||
017BEB7F23676E870024EF95 /* MoleculeObjectMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */; };
|
017BEB7F23676E870024EF95 /* MoleculeObjectMapping.swift in Sources */ = {isa = PBXBuildFile; fileRef = 017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */; };
|
||||||
0189255C239AA7EB004E8AFF /* ModuleDelegateProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0189255B239AA7EB004E8AFF /* ModuleDelegateProtocol.swift */; };
|
|
||||||
0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198F79E225679870066C936 /* FormValidationProtocol.swift */; };
|
0198F79F225679880066C936 /* FormValidationProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0198F79E225679870066C936 /* FormValidationProtocol.swift */; };
|
||||||
0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0198F7A02256A80A0066C936 /* MFRadioButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
0198F7A62256A80B0066C936 /* MFRadioButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 0198F7A02256A80A0066C936 /* MFRadioButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0198F7A22256A80A0066C936 /* MFRadioButton.m */; };
|
0198F7A82256A80B0066C936 /* MFRadioButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 0198F7A22256A80A0066C936 /* MFRadioButton.m */; };
|
||||||
@ -123,7 +122,6 @@
|
|||||||
D282AACB2243C61700C46919 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AACA2243C61700C46919 /* ButtonView.swift */; };
|
D282AACB2243C61700C46919 /* ButtonView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AACA2243C61700C46919 /* ButtonView.swift */; };
|
||||||
D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */; };
|
D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */; };
|
||||||
D296E13C229598BF0051EBE7 /* MoleculeListCellProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E13B2295969C0051EBE7 /* MoleculeListCellProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
D296E13C229598BF0051EBE7 /* MoleculeListCellProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E13B2295969C0051EBE7 /* MoleculeListCellProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
D296E1412295EBBA0051EBE7 /* MoleculeDelegateProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E1402295EBBA0051EBE7 /* MoleculeDelegateProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
|
||||||
D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
D296E14722A5984C0051EBE7 /* MVMCoreUIViewConstrainingProtocol.h in Headers */ = {isa = PBXBuildFile; fileRef = D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; };
|
D29770C821F7C4AE00B2F0D0 /* TopLabelsView.m in Sources */ = {isa = PBXBuildFile; fileRef = D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */; };
|
||||||
D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
D29770C921F7C4AE00B2F0D0 /* TopLabelsView.h in Headers */ = {isa = PBXBuildFile; fileRef = D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||||
@ -312,7 +310,6 @@
|
|||||||
017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMoleculeViewProtocol.swift; sourceTree = "<group>"; };
|
017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelMoleculeViewProtocol.swift; sourceTree = "<group>"; };
|
||||||
017BEB7A236763000024EF95 /* LineModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineModel.swift; sourceTree = "<group>"; };
|
017BEB7A236763000024EF95 /* LineModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LineModel.swift; sourceTree = "<group>"; };
|
||||||
017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeObjectMapping.swift; sourceTree = "<group>"; };
|
017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeObjectMapping.swift; sourceTree = "<group>"; };
|
||||||
0189255B239AA7EB004E8AFF /* ModuleDelegateProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModuleDelegateProtocol.swift; sourceTree = "<group>"; };
|
|
||||||
0198F79E225679870066C936 /* FormValidationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidationProtocol.swift; sourceTree = "<group>"; };
|
0198F79E225679870066C936 /* FormValidationProtocol.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidationProtocol.swift; sourceTree = "<group>"; };
|
||||||
0198F7A02256A80A0066C936 /* MFRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFRadioButton.h; sourceTree = "<group>"; };
|
0198F7A02256A80A0066C936 /* MFRadioButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MFRadioButton.h; sourceTree = "<group>"; };
|
||||||
0198F7A22256A80A0066C936 /* MFRadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFRadioButton.m; sourceTree = "<group>"; };
|
0198F7A22256A80A0066C936 /* MFRadioButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MFRadioButton.m; sourceTree = "<group>"; };
|
||||||
@ -382,7 +379,6 @@
|
|||||||
D282AACA2243C61700C46919 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = "<group>"; };
|
D282AACA2243C61700C46919 /* ButtonView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonView.swift; sourceTree = "<group>"; };
|
||||||
D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFCustomButton+ActionModel.swift"; sourceTree = "<group>"; };
|
D28A837623C79FC600DFE4FC /* MFCustomButton+ActionModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MFCustomButton+ActionModel.swift"; sourceTree = "<group>"; };
|
||||||
D296E13B2295969C0051EBE7 /* MoleculeListCellProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoleculeListCellProtocol.h; sourceTree = "<group>"; };
|
D296E13B2295969C0051EBE7 /* MoleculeListCellProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoleculeListCellProtocol.h; sourceTree = "<group>"; };
|
||||||
D296E1402295EBBA0051EBE7 /* MoleculeDelegateProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MoleculeDelegateProtocol.h; sourceTree = "<group>"; };
|
|
||||||
D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = "<group>"; };
|
D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIViewConstrainingProtocol.h; sourceTree = "<group>"; };
|
||||||
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; };
|
D29770C621F7C4AE00B2F0D0 /* TopLabelsView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TopLabelsView.m; sourceTree = "<group>"; };
|
||||||
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = "<group>"; };
|
D29770C721F7C4AE00B2F0D0 /* TopLabelsView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TopLabelsView.h; sourceTree = "<group>"; };
|
||||||
@ -1095,13 +1091,11 @@
|
|||||||
D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */,
|
D2C5001621F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h */,
|
||||||
D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */,
|
D2C5001721F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m */,
|
||||||
D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */,
|
D296E14622A597490051EBE7 /* MVMCoreUIViewConstrainingProtocol.h */,
|
||||||
D296E1402295EBBA0051EBE7 /* MoleculeDelegateProtocol.h */,
|
|
||||||
012A88C7238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift */,
|
012A88C7238DB02000FE3DA1 /* ModelMoleculeDelegateProtocol.swift */,
|
||||||
D2A514562211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.h */,
|
D2A514562211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.h */,
|
||||||
D2A514572211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m */,
|
D2A514572211C53C00345BFB /* MVMCoreUIMoleculeMappingObject.m */,
|
||||||
017BEB432362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift */,
|
017BEB432362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift */,
|
||||||
017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */,
|
017BEB7E23676E870024EF95 /* MoleculeObjectMapping.swift */,
|
||||||
0189255B239AA7EB004E8AFF /* ModuleDelegateProtocol.swift */,
|
|
||||||
);
|
);
|
||||||
path = OtherHandlers;
|
path = OtherHandlers;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1231,7 +1225,6 @@
|
|||||||
D29DF12D21E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.h in Headers */,
|
D29DF12D21E6851E003B2FB9 /* MVMCoreUITopAlertBaseView.h in Headers */,
|
||||||
D29DF24E21E6A177003B2FB9 /* MFDigitTextField.h in Headers */,
|
D29DF24E21E6A177003B2FB9 /* MFDigitTextField.h in Headers */,
|
||||||
D29770F321F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h in Headers */,
|
D29770F321F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.h in Headers */,
|
||||||
D296E1412295EBBA0051EBE7 /* MoleculeDelegateProtocol.h in Headers */,
|
|
||||||
D2C5001821F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h in Headers */,
|
D2C5001821F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.h in Headers */,
|
||||||
D29770FD21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h in Headers */,
|
D29770FD21F7C77400B2F0D0 /* MVMCoreUITextFieldView.h in Headers */,
|
||||||
D29DF17421E69E1F003B2FB9 /* MFCustomButton.h in Headers */,
|
D29DF17421E69E1F003B2FB9 /* MFCustomButton.h in Headers */,
|
||||||
@ -1380,7 +1373,6 @@
|
|||||||
D29DF24D21E6A177003B2FB9 /* MFTextField.m in Sources */,
|
D29DF24D21E6A177003B2FB9 /* MFTextField.m in Sources */,
|
||||||
014AA72D23C5059B006F3E93 /* StackPageTemplateModel.swift in Sources */,
|
014AA72D23C5059B006F3E93 /* StackPageTemplateModel.swift in Sources */,
|
||||||
012A88C4238D86E600FE3DA1 /* CollectionCellMoleculeProtocol.swift in Sources */,
|
012A88C4238D86E600FE3DA1 /* CollectionCellMoleculeProtocol.swift in Sources */,
|
||||||
0189255C239AA7EB004E8AFF /* ModuleDelegateProtocol.swift in Sources */,
|
|
||||||
94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */,
|
94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */,
|
||||||
014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */,
|
014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */,
|
||||||
017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */,
|
017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */,
|
||||||
|
|||||||
@ -289,7 +289,7 @@ import UIKit
|
|||||||
self?.addConstraints(width: width, height: height, size: image?.size)
|
self?.addConstraints(width: width, height: height, size: image?.size)
|
||||||
self?.loadingSpinnerHeightConstraint?.constant = 0
|
self?.loadingSpinnerHeightConstraint?.constant = 0
|
||||||
if layoutWillChange {
|
if layoutWillChange {
|
||||||
self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated?(self!)
|
self?.delegateObject?.moleculeDelegate?.moleculeLayoutUpdated(self!)
|
||||||
}
|
}
|
||||||
completionHandler(image,data,isFallbackImage)
|
completionHandler(image,data,isFallbackImage)
|
||||||
})}
|
})}
|
||||||
|
|||||||
@ -8,7 +8,14 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
extension MFViewController: ModuleDelegateProtocol {
|
extension MFViewController: MoleculeDelegateProtocol {
|
||||||
|
public func getModuleWithName(_ name: String?) -> [AnyHashable : Any]? {
|
||||||
|
guard let name = name else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return loadObject?.modulesJSON?.optionalDictionaryForKey(name)
|
||||||
|
}
|
||||||
|
|
||||||
public func getModuleWithName(_ moduleName: String) -> Model? {
|
public func getModuleWithName(_ moduleName: String) -> Model? {
|
||||||
guard let moduleJSON = loadObject?.modulesJSON?.optionalDictionaryForKey(moduleName),
|
guard let moduleJSON = loadObject?.modulesJSON?.optionalDictionaryForKey(moduleName),
|
||||||
let moleculeName = moduleJSON.optionalStringForKey("moleculeName"),
|
let moleculeName = moduleJSON.optionalStringForKey("moleculeName"),
|
||||||
@ -29,3 +36,5 @@ public extension MFViewController {
|
|||||||
(self as? TemplateProtocol)?.parseTemplateJSON()
|
(self as? TemplateProtocol)?.parseTemplateJSON()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//MoleculeDelegateProtocol
|
||||||
|
|||||||
@ -27,14 +27,13 @@
|
|||||||
#import <MVMCoreUI/ButtonDelegateProtocol.h>
|
#import <MVMCoreUI/ButtonDelegateProtocol.h>
|
||||||
#import <MVMCoreUI/MFStyler.h>
|
#import <MVMCoreUI/MFStyler.h>
|
||||||
#import <MVMCoreUI/MVMCoreUIDetailViewProtocol.h>
|
#import <MVMCoreUI/MVMCoreUIDetailViewProtocol.h>
|
||||||
#import <MVMCoreUI/MoleculeDelegateProtocol.h>
|
|
||||||
|
|
||||||
@class MainMenuViewController;
|
@class MainMenuViewController;
|
||||||
@class MVMCoreUITabBarPageControlViewController;
|
@class MVMCoreUITabBarPageControlViewController;
|
||||||
@class MVMAnimationManager;
|
@class MVMAnimationManager;
|
||||||
@class DelegateObject;
|
@class DelegateObject;
|
||||||
|
|
||||||
@interface MFViewController : UIViewController <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, MFTextFieldDelegate, ButtonDelegateProtocol, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MVMCoreUIDetailViewProtocol, MoleculeDelegateProtocol>
|
@interface MFViewController : UIViewController <MVMCoreLoadDelegateProtocol, MVMCorePresentationDelegateProtocol, MVMCoreActionDelegateProtocol, UITextFieldDelegate, UITextViewDelegate, MFTextFieldDelegate, ButtonDelegateProtocol, MVMCoreViewControllerProtocol, MVMCoreViewManagerViewControllerProtocol, MVMCoreUIDetailViewProtocol>
|
||||||
|
|
||||||
// Stores the load object that this screen was loaded with.
|
// Stores the load object that this screen was loaded with.
|
||||||
@property (nullable, strong, nonatomic) MVMCoreLoadObject *loadObject;
|
@property (nullable, strong, nonatomic) MVMCoreLoadObject *loadObject;
|
||||||
|
|||||||
@ -834,15 +834,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#pragma mark - MoleculeDelegateProtocol
|
|
||||||
|
|
||||||
- (NSDictionary *)getModuleWithName:(NSString *)name {
|
|
||||||
if (!name) {
|
|
||||||
return nil;
|
|
||||||
}
|
|
||||||
return [self.loadObject.modulesJSON dict:name];
|
|
||||||
}
|
|
||||||
|
|
||||||
#pragma mark - adobe analytics
|
#pragma mark - adobe analytics
|
||||||
|
|
||||||
- (nullable NSArray <NSDictionary *> *)additionalActionsToTrackWithMainActionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
|
- (nullable NSArray <NSDictionary *> *)additionalActionsToTrackWithMainActionInformation:(nullable NSDictionary *)actionInformation additionalData:(nullable NSDictionary *)additionalData {
|
||||||
|
|||||||
@ -20,7 +20,6 @@ FOUNDATION_EXPORT const unsigned char MVMCoreUIVersionString[];
|
|||||||
#import <MVMCoreUI/MVMCoreUILoggingHandler.h>
|
#import <MVMCoreUI/MVMCoreUILoggingHandler.h>
|
||||||
#import <MVMCoreUI/MVMCoreUIViewControllerMappingObject.h>
|
#import <MVMCoreUI/MVMCoreUIViewControllerMappingObject.h>
|
||||||
#import <MVMCoreUI/MVMCoreUIViewConstrainingProtocol.h>
|
#import <MVMCoreUI/MVMCoreUIViewConstrainingProtocol.h>
|
||||||
#import <MVMCoreUI/MoleculeDelegateProtocol.h>
|
|
||||||
#import <MVMCoreUI/MoleculeListCellProtocol.h>
|
#import <MVMCoreUI/MoleculeListCellProtocol.h>
|
||||||
#import <MVMCoreUI/MVMCoreUIMoleculeMappingObject.h>
|
#import <MVMCoreUI/MVMCoreUIMoleculeMappingObject.h>
|
||||||
|
|
||||||
|
|||||||
@ -34,9 +34,9 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
if accordionButton.isSelected {
|
if accordionButton.isSelected {
|
||||||
delegateObject?.moleculeDelegate?.addMolecules?(molecules, sender: self, animation: .automatic)
|
delegateObject?.moleculeDelegate?.addMolecules(molecules, sender: self, animation: .automatic)
|
||||||
} else {
|
} else {
|
||||||
delegateObject?.moleculeDelegate?.removeMolecules?(molecules, sender: self, animation: .automatic)
|
delegateObject?.moleculeDelegate?.removeMolecules(molecules, sender: self, animation: .automatic)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (json?.boolForKey("hideSeparatorWhenExpanded") ?? false) && (self.bottomSeparatorView?.shouldBeVisible() ?? false) {
|
if (json?.boolForKey("hideSeparatorWhenExpanded") ?? false) && (self.bottomSeparatorView?.shouldBeVisible() ?? false) {
|
||||||
|
|||||||
@ -39,10 +39,10 @@ import UIKit
|
|||||||
|
|
||||||
if self.previousIndex != NSNotFound {
|
if self.previousIndex != NSNotFound {
|
||||||
let previousMolecules = moleculesArrays[self.previousIndex]
|
let previousMolecules = moleculesArrays[self.previousIndex]
|
||||||
self.delegateObject?.moleculeDelegate?.removeMolecules?(previousMolecules, sender: self, animation: .fade)
|
self.delegateObject?.moleculeDelegate?.removeMolecules(previousMolecules, sender: self, animation: .fade)
|
||||||
}
|
}
|
||||||
let molecules = moleculesArrays[index]
|
let molecules = moleculesArrays[index]
|
||||||
self.delegateObject?.moleculeDelegate?.addMolecules?(molecules, sender: self, animation: .fade)
|
self.delegateObject?.moleculeDelegate?.addMolecules(molecules, sender: self, animation: .fade)
|
||||||
self.previousIndex = index
|
self.previousIndex = index
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -58,7 +58,7 @@ extension TabsTableViewCell: TopTabbarDelegate {
|
|||||||
public func shouldSelectItem(at index: Int, topTabbar: TopTabbar) -> Bool {
|
public func shouldSelectItem(at index: Int, topTabbar: TopTabbar) -> Bool {
|
||||||
if let moleculesArrays = json?.arrayForKey(KeyMolecules),
|
if let moleculesArrays = json?.arrayForKey(KeyMolecules),
|
||||||
let molecules = moleculesArrays[topTabbar.selectedIndex] as? [[AnyHashable: Any]] {
|
let molecules = moleculesArrays[topTabbar.selectedIndex] as? [[AnyHashable: Any]] {
|
||||||
delegateObject?.moleculeDelegate?.removeMolecules?(molecules, sender: self, animation: index < tabs.selectedIndex ? .right : .left)
|
delegateObject?.moleculeDelegate?.removeMolecules(molecules, sender: self, animation: index < tabs.selectedIndex ? .right : .left)
|
||||||
}
|
}
|
||||||
previousTabIndex = tabs.selectedIndex
|
previousTabIndex = tabs.selectedIndex
|
||||||
return true
|
return true
|
||||||
@ -67,7 +67,7 @@ extension TabsTableViewCell: TopTabbarDelegate {
|
|||||||
public func topTabbar(_ topTabbar: TopTabbar, didSelectItemAt index: Int) {
|
public func topTabbar(_ topTabbar: TopTabbar, didSelectItemAt index: Int) {
|
||||||
if let moleculesArrays = json?.arrayForKey(KeyMolecules),
|
if let moleculesArrays = json?.arrayForKey(KeyMolecules),
|
||||||
let molecules = moleculesArrays[index] as? [[AnyHashable: Any]] {
|
let molecules = moleculesArrays[index] as? [[AnyHashable: Any]] {
|
||||||
delegateObject?.moleculeDelegate?.addMolecules?(molecules, sender: self, animation: index < previousTabIndex ? .left : .right)
|
delegateObject?.moleculeDelegate?.addMolecules(molecules, sender: self, animation: index < previousTabIndex ? .left : .right)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -23,7 +23,7 @@ open class ModuleMolecule: Container {
|
|||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.setWithModel(model, delegateObject, additionalData)
|
||||||
|
|
||||||
guard let moduleMoleculeModel = model as? ModuleMoleculeModel,
|
guard let moduleMoleculeModel = model as? ModuleMoleculeModel,
|
||||||
let moduleModel = delegateObject?.moduleProtocol?.getModuleWithName(moduleMoleculeModel.moduleName) as? MoleculeProtocol else {
|
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMoleculeModel.moduleName) as? MoleculeProtocol else {
|
||||||
// Critical error
|
// Critical error
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -49,7 +49,7 @@ open class ModuleMolecule: Container {
|
|||||||
public static func estimatedHeight(forRow molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public static func estimatedHeight(forRow molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
|
|
||||||
guard let moduleMolecule = molecule as? ModuleMoleculeModel,
|
guard let moduleMolecule = molecule as? ModuleMoleculeModel,
|
||||||
let moduleModel = delegateObject?.moduleProtocol?.getModuleWithName(moduleMolecule.moduleName) as? MoleculeProtocol,
|
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName) as? MoleculeProtocol,
|
||||||
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type,
|
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol.Type,
|
||||||
let height = classType.estimatedHeight(forRow: moduleModel, delegateObject: delegateObject)else {
|
let height = classType.estimatedHeight(forRow: moduleModel, delegateObject: delegateObject)else {
|
||||||
// Critical error
|
// Critical error
|
||||||
@ -60,7 +60,7 @@ open class ModuleMolecule: Container {
|
|||||||
|
|
||||||
public override func nameForReuse(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
public override func nameForReuse(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?) -> String? {
|
||||||
guard let moduleMolecule = model as? ModuleMoleculeModel,
|
guard let moduleMolecule = model as? ModuleMoleculeModel,
|
||||||
let moduleModel = delegateObject?.moduleProtocol?.getModuleWithName(moduleMolecule.moduleName) as? MoleculeProtocol,
|
let moduleModel = delegateObject?.moleculeDelegate?.getModuleWithName(moduleMolecule.moduleName) as? MoleculeProtocol,
|
||||||
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol,
|
let classType = MVMCoreUIMoleculeMappingObject.shared()?.getMoleculeClass(moduleModel) as? ModelMoleculeViewProtocol,
|
||||||
let name = classType.nameForReuse(moduleModel, delegateObject) else {
|
let name = classType.nameForReuse(moduleModel, delegateObject) else {
|
||||||
// Critical error
|
// Critical error
|
||||||
@ -73,7 +73,7 @@ open class ModuleMolecule: Container {
|
|||||||
public static func requiredModules(_ molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
public static func requiredModules(_ molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?, error: AutoreleasingUnsafeMutablePointer<MVMCoreErrorObject?>?) -> [String]? {
|
||||||
|
|
||||||
guard let moduleName = (molecule as? ModuleMoleculeModel)?.moduleName,
|
guard let moduleName = (molecule as? ModuleMoleculeModel)?.moduleName,
|
||||||
let _ = delegateObject?.moduleProtocol?.getModuleWithName(moduleName) else {
|
let _ = delegateObject?.moleculeDelegate?.getModuleWithName(moduleName) else {
|
||||||
if let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: CoreUIErrorCode.ErrorCodeModuleMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) {
|
if let errorObject = MVMCoreErrorObject(title: nil, message: MVMCoreGetterUtility.hardcodedString(withKey: HardcodedErrorUnableToProcess), code: CoreUIErrorCode.ErrorCodeModuleMolecule.rawValue, domain: ErrorDomainNative, location: String(describing: self)) {
|
||||||
error?.pointee = errorObject
|
error?.pointee = errorObject
|
||||||
MVMCoreUILoggingHandler.shared()?.addError(toLog: errorObject)
|
MVMCoreUILoggingHandler.shared()?.addError(toLog: errorObject)
|
||||||
|
|||||||
@ -12,16 +12,14 @@ open class MVMCoreUIDelegateObject: DelegateObject {
|
|||||||
public weak var formValidationProtocol: FormValidationProtocol?
|
public weak var formValidationProtocol: FormValidationProtocol?
|
||||||
public weak var buttonDelegate: ButtonDelegateProtocol?
|
public weak var buttonDelegate: ButtonDelegateProtocol?
|
||||||
public weak var uiTextFieldDelegate: UITextFieldDelegate?
|
public weak var uiTextFieldDelegate: UITextFieldDelegate?
|
||||||
public weak var moleculeDelegate: MoleculeDelegateProtocol?
|
public var moleculeDelegate: MoleculeDelegateProtocol?
|
||||||
public var moduleProtocol: ModuleDelegateProtocol?
|
|
||||||
|
|
||||||
open override func setAll(withDelegate delegate: Any) {
|
open override func setAll(withDelegate delegate: Any) {
|
||||||
super.setAll(withDelegate: delegate)
|
super.setAll(withDelegate: delegate)
|
||||||
formValidationProtocol = delegate as? FormValidationProtocol
|
formValidationProtocol = delegate as? FormValidationProtocol
|
||||||
buttonDelegate = delegate as? ButtonDelegateProtocol
|
buttonDelegate = delegate as? ButtonDelegateProtocol
|
||||||
uiTextFieldDelegate = delegate as? UITextFieldDelegate
|
uiTextFieldDelegate = delegate as? UITextFieldDelegate
|
||||||
moleculeDelegate = delegate as? MoleculeDelegateProtocol
|
moleculeDelegate = delegate as? MoleculeDelegateProtocol
|
||||||
moduleProtocol = delegate as? ModuleDelegateProtocol
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class func delegateObject(from controller: MVMCoreViewControllerProtocol?) -> MVMCoreUIDelegateObject? {
|
class func delegateObject(from controller: MVMCoreViewControllerProtocol?) -> MVMCoreUIDelegateObject? {
|
||||||
|
|||||||
@ -8,7 +8,39 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public protocol ModelMoleculeDelegateProtocol {
|
public protocol MoleculeDelegateProtocol {
|
||||||
|
|
||||||
|
/// returns a module for the corresponding module name.
|
||||||
|
func getModuleWithName(_ name: String?) -> [AnyHashable : Any]?
|
||||||
|
func getModuleWithName(_ moleculeName: String) -> Model?
|
||||||
|
|
||||||
|
/// Notifies the delegate that the molecule layout update. Should be called when the layout may change due to an async method.
|
||||||
|
func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) //optional
|
||||||
|
|
||||||
|
/// Asks the delegate to add or remove molecules.
|
||||||
|
//optional
|
||||||
|
func addMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
||||||
|
func removeMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
||||||
|
|
||||||
|
//optional
|
||||||
func addMolecules(_ molecules: [ListItemModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
func addMolecules(_ molecules: [ListItemModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
||||||
func removeMolecules(_ molecules: [ListItemModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
func removeMolecules(_ molecules: [ListItemModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension MoleculeDelegateProtocol {
|
||||||
|
public func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
|
||||||
|
// Do Nothing
|
||||||
|
}
|
||||||
|
public func addMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
||||||
|
// Do nothpublic ing
|
||||||
|
}
|
||||||
|
public func removeMolecules(_ molecules: [[AnyHashable : Any]], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
public func addMolecules(_ molecules: [ListItemModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
||||||
|
// Do nothpublic ing
|
||||||
|
}
|
||||||
|
public func removeMolecules(_ molecules: [ListItemModelProtocol], sender: UITableViewCell, animation: UITableView.RowAnimation) {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
|
||||||
open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol, ModelMoleculeDelegateProtocol {
|
open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol {
|
||||||
|
|
||||||
public var moleculesInfo: [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)]?
|
public var moleculesInfo: [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)]?
|
||||||
var observer: NSKeyValueObservation?
|
var observer: NSKeyValueObservation?
|
||||||
@ -129,7 +129,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - MoleculeDelegateProtocol
|
// MARK: - MoleculeDelegateProtocol
|
||||||
open override func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
|
open func moleculeLayoutUpdated(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
|
||||||
if let tableView = tableView {
|
if let tableView = tableView {
|
||||||
let point = molecule.convert(molecule.bounds.origin, to: tableView)
|
let point = molecule.convert(molecule.bounds.origin, to: tableView)
|
||||||
if let indexPath = tableView.indexPathForRow(at: point), tableView.indexPathsForVisibleRows?.contains(indexPath) ?? false {
|
if let indexPath = tableView.indexPathForRow(at: point), tableView.indexPathsForVisibleRows?.contains(indexPath) ?? false {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user