Template associated type testing
This commit is contained in:
parent
629f30e073
commit
99a258c0f8
@ -119,6 +119,7 @@
|
|||||||
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */; };
|
D282AABA224131D100C46919 /* MFTransparentGIFView.swift in Sources */ = {isa = PBXBuildFile; fileRef = D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */; };
|
||||||
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 */; };
|
||||||
|
D28A837923C7D5BC00DFE4FC /* PageModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D28A837823C7D5BC00DFE4FC /* PageModelProtocol.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, ); }; };
|
||||||
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 */; };
|
||||||
@ -374,6 +375,7 @@
|
|||||||
D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFTransparentGIFView.swift; sourceTree = "<group>"; };
|
D282AAB9224131D100C46919 /* MFTransparentGIFView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MFTransparentGIFView.swift; sourceTree = "<group>"; };
|
||||||
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>"; };
|
||||||
|
D28A837823C7D5BC00DFE4FC /* PageModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PageModelProtocol.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>"; };
|
||||||
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>"; };
|
||||||
@ -548,6 +550,7 @@
|
|||||||
01EB3683236097C0006832FA /* MoleculeProtocol.swift */,
|
01EB3683236097C0006832FA /* MoleculeProtocol.swift */,
|
||||||
012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */,
|
012A88AC238C418100FE3DA1 /* TemplateProtocol.swift */,
|
||||||
012A889B23889E8400FE3DA1 /* TemplateModelProtocol.swift */,
|
012A889B23889E8400FE3DA1 /* TemplateModelProtocol.swift */,
|
||||||
|
D28A837823C7D5BC00DFE4FC /* PageModelProtocol.swift */,
|
||||||
011B58EF23A2AA980085F53C /* ListItemModelProtocol.swift */,
|
011B58EF23A2AA980085F53C /* ListItemModelProtocol.swift */,
|
||||||
);
|
);
|
||||||
path = ModelProtocols;
|
path = ModelProtocols;
|
||||||
@ -624,6 +627,14 @@
|
|||||||
path = Molecules;
|
path = Molecules;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
|
0A5D59C323AD488600EFD9E9 /* Protocols */ = {
|
||||||
|
isa = PBXGroup;
|
||||||
|
children = (
|
||||||
|
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */,
|
||||||
|
);
|
||||||
|
path = Protocols;
|
||||||
|
sourceTree = "<group>";
|
||||||
|
};
|
||||||
946EE1B5237B663A0036751F /* Extensions */ = {
|
946EE1B5237B663A0036751F /* Extensions */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -654,14 +665,6 @@
|
|||||||
name = "Recovered References";
|
name = "Recovered References";
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
};
|
};
|
||||||
0A5D59C323AD488600EFD9E9 /* Protocols */ = {
|
|
||||||
isa = PBXGroup;
|
|
||||||
children = (
|
|
||||||
0A5D59C123AD2F5700EFD9E9 /* AppleGuidelinesProtocol.swift */,
|
|
||||||
);
|
|
||||||
path = Protocols;
|
|
||||||
sourceTree = "<group>";
|
|
||||||
};
|
|
||||||
D213347423842FE3008E41B3 /* Controllers */ = {
|
D213347423842FE3008E41B3 /* Controllers */ = {
|
||||||
isa = PBXGroup;
|
isa = PBXGroup;
|
||||||
children = (
|
children = (
|
||||||
@ -1411,6 +1414,7 @@
|
|||||||
D29DF2AE21E7B3A4003B2FB9 /* MFTextView.m in Sources */,
|
D29DF2AE21E7B3A4003B2FB9 /* MFTextView.m in Sources */,
|
||||||
017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */,
|
017BEB382360C6AC0024EF95 /* RadioButtonLabel.swift in Sources */,
|
||||||
D29DF18121E69E50003B2FB9 /* MFView.m in Sources */,
|
D29DF18121E69E50003B2FB9 /* MFView.m in Sources */,
|
||||||
|
D28A837923C7D5BC00DFE4FC /* PageModelProtocol.swift in Sources */,
|
||||||
D29DF18321E69E54003B2FB9 /* SeparatorView.m in Sources */,
|
D29DF18321E69E54003B2FB9 /* SeparatorView.m in Sources */,
|
||||||
D29DF17A21E69E1F003B2FB9 /* MFCustomButton.m in Sources */,
|
D29DF17A21E69E1F003B2FB9 /* MFCustomButton.m in Sources */,
|
||||||
017BEB7B236763000024EF95 /* LineModel.swift in Sources */,
|
017BEB7B236763000024EF95 /* LineModel.swift in Sources */,
|
||||||
|
|||||||
15
MVMCoreUI/Models/ModelProtocols/PageModelProtocol.swift
Normal file
15
MVMCoreUI/Models/ModelProtocols/PageModelProtocol.swift
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
//
|
||||||
|
// PageModelProtocol.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Scott Pfeil on 1/9/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
public protocol PageModelProtocol: Model {
|
||||||
|
var pageType: String { get set }
|
||||||
|
var screenHeading: String? { get set }
|
||||||
|
var isAtomicTabs: Bool? { get set }
|
||||||
|
}
|
||||||
@ -8,11 +8,8 @@
|
|||||||
|
|
||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public protocol TemplateModelProtocol: Model {
|
public protocol TemplateModelProtocol: PageModelProtocol {
|
||||||
var template: String { get }
|
var template: String { get }
|
||||||
var pageType: String { get set }
|
|
||||||
var screenHeading: String { get set }
|
|
||||||
var isAtomicTabs: Bool? { get set }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TemplateModelProtocol {
|
extension TemplateModelProtocol {
|
||||||
|
|||||||
@ -9,21 +9,33 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
public protocol TemplateProtocol {
|
public protocol TemplateProtocol {
|
||||||
var templateModel: TemplateModelProtocol? {get}
|
associatedtype TemplateModel: TemplateModelProtocol
|
||||||
func parseTemplateJSON()
|
var templateModel: TemplateModel? { get set }
|
||||||
func templateData() -> Data?
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extension TemplateProtocol where Self: MFViewController {
|
public extension TemplateProtocol {
|
||||||
public func templateData() -> Data? {
|
|
||||||
guard let pageJSON = loadObject?.pageJSON as? [String: AnyHashable] else {
|
}
|
||||||
return nil
|
|
||||||
}
|
public extension TemplateProtocol where Self: MFViewController {
|
||||||
|
mutating func parseTemplateJSON() {
|
||||||
|
guard let pageJSON = loadObject?.pageJSON as? [String: AnyHashable] else { return }
|
||||||
do {
|
do {
|
||||||
return try JSONSerialization.data(withJSONObject: pageJSON)
|
let data = try JSONSerialization.data(withJSONObject: pageJSON)
|
||||||
|
let decoder = JSONDecoder()
|
||||||
|
let templateModel = try decoder.decode(TemplateModel.self, from: data)
|
||||||
|
self.templateModel = templateModel
|
||||||
} catch {
|
} catch {
|
||||||
MVMCoreUILoggingHandler.logDebugMessage(withDelegate: "error: \(error)")
|
MVMCoreUILoggingHandler.logDebugMessage(withDelegate: "error: \(error)")
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
class Testing: MFViewController, TemplateProtocol {
|
||||||
|
typealias TemplateModel = StackPageTemplateModel
|
||||||
|
var templateModel: StackPageTemplateModel?
|
||||||
|
|
||||||
|
public func parsePageJSON() {
|
||||||
|
parseTemplateJSON()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -13,7 +13,7 @@ import Foundation
|
|||||||
public static var identifier: String = "listTemplate"
|
public static var identifier: String = "listTemplate"
|
||||||
|
|
||||||
public var pageType: String
|
public var pageType: String
|
||||||
public var screenHeading: String
|
public var screenHeading: String?
|
||||||
public var isAtomicTabs: Bool?
|
public var isAtomicTabs: Bool?
|
||||||
|
|
||||||
public var header: HeaderModel?
|
public var header: HeaderModel?
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import Foundation
|
|||||||
|
|
||||||
public var pageType: String
|
public var pageType: String
|
||||||
|
|
||||||
public var screenHeading: String
|
public var screenHeading: String?
|
||||||
|
|
||||||
public var isAtomicTabs: Bool?
|
public var isAtomicTabs: Bool?
|
||||||
|
|
||||||
|
|||||||
@ -14,7 +14,7 @@ import Foundation
|
|||||||
|
|
||||||
public var pageType: String
|
public var pageType: String
|
||||||
|
|
||||||
public var screenHeading: String
|
public var screenHeading: String?
|
||||||
|
|
||||||
public var isAtomicTabs: Bool?
|
public var isAtomicTabs: Bool?
|
||||||
|
|
||||||
|
|||||||
@ -9,12 +9,11 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
|
|
||||||
@objcMembers public class ThreeLayerPageTemplateModel: TemplateModelProtocol {
|
@objcMembers public class ThreeLayerPageTemplateModel: TemplateModelProtocol {
|
||||||
|
|
||||||
public static var identifier: String = "threeLayer"
|
public static var identifier: String = "threeLayer"
|
||||||
|
|
||||||
public var pageType: String
|
public var pageType: String
|
||||||
|
|
||||||
public var screenHeading: String
|
public var screenHeading: String?
|
||||||
|
|
||||||
public var isAtomicTabs: Bool?
|
public var isAtomicTabs: Bool?
|
||||||
|
|
||||||
|
|||||||
@ -13,20 +13,10 @@ 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?
|
||||||
|
|
||||||
public var templateModel: TemplateModelProtocol?
|
public var templateModel: ListPageTemplateModel?
|
||||||
|
|
||||||
public func parseTemplateJSON() {
|
public func parsePageJSON() {
|
||||||
guard let templateData = templateData() else {
|
parseTemplateJSON()
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
let decoder = JSONDecoder()
|
|
||||||
let templateModel = try decoder.decode(ListPageTemplateModel.self, from: templateData)
|
|
||||||
self.templateModel = templateModel
|
|
||||||
} catch {
|
|
||||||
MVMCoreUILoggingHandler.logDebugMessage(withDelegate: "error: \(error)")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override var loadObject: MVMCoreLoadObject? {
|
open override var loadObject: MVMCoreLoadObject? {
|
||||||
@ -44,7 +34,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override func viewForTop() -> UIView {
|
open override func viewForTop() -> UIView {
|
||||||
guard let headerModel = (templateModel as? ListPageTemplateModel)?.header,
|
guard let headerModel = templateModel?.header,
|
||||||
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
||||||
return super.viewForTop()
|
return super.viewForTop()
|
||||||
}
|
}
|
||||||
@ -52,7 +42,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
}
|
}
|
||||||
|
|
||||||
override open func viewForBottom() -> UIView {
|
override open func viewForBottom() -> UIView {
|
||||||
guard let footerModel = (templateModel as? ListPageTemplateModel)?.footer,
|
guard let footerModel = templateModel?.footer,
|
||||||
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
||||||
return super.viewForBottom()
|
return super.viewForBottom()
|
||||||
}
|
}
|
||||||
@ -187,7 +177,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
/// Sets up the molecule list and ensures no errors loading all content.
|
/// Sets up the molecule list and ensures no errors loading all content.
|
||||||
func getMoleculeInfoList() -> [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)]? {
|
func getMoleculeInfoList() -> [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)]? {
|
||||||
var moleculeList: [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)] = []
|
var moleculeList: [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)] = []
|
||||||
if let molecules = (templateModel as? ListPageTemplateModel)?.molecules {
|
if let molecules = templateModel?.molecules {
|
||||||
for molecule in molecules {
|
for molecule in molecules {
|
||||||
if let info = getMoleculeInfo(with: molecule) {
|
if let info = getMoleculeInfo(with: molecule) {
|
||||||
moleculeList.append(info)
|
moleculeList.append(info)
|
||||||
@ -200,7 +190,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
|
|||||||
/// Sets up the header, footer, molecule list and ensures no errors loading all content.
|
/// Sets up the header, footer, molecule list and ensures no errors loading all content.
|
||||||
func setup() {
|
func setup() {
|
||||||
var moleculeList: [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)] = []
|
var moleculeList: [(identifier: String, class: AnyClass, molecule: ListItemModelProtocol)] = []
|
||||||
if let molecules = (templateModel as? ListPageTemplateModel)?.molecules {
|
if let molecules = templateModel?.molecules {
|
||||||
for molecule in molecules {
|
for molecule in molecules {
|
||||||
if let info = getMoleculeInfo(with: molecule) {
|
if let info = getMoleculeInfo(with: molecule) {
|
||||||
moleculeList.append(info)
|
moleculeList.append(info)
|
||||||
|
|||||||
@ -11,21 +11,7 @@ import UIKit
|
|||||||
open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
|
open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
|
||||||
|
|
||||||
var observer: NSKeyValueObservation?
|
var observer: NSKeyValueObservation?
|
||||||
public var templateModel: TemplateModelProtocol?
|
public var templateModel: StackPageTemplateModel?
|
||||||
|
|
||||||
public func parseTemplateJSON() {
|
|
||||||
guard let templateData = templateData() else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
let decoder = JSONDecoder()
|
|
||||||
let templateModel = try decoder.decode(StackPageTemplateModel.self, from: templateData)
|
|
||||||
self.templateModel = templateModel
|
|
||||||
} catch {
|
|
||||||
MVMCoreUILoggingHandler.logDebugMessage(withDelegate: "error: \(error)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
open override var loadObject: MVMCoreLoadObject? {
|
open override var loadObject: MVMCoreLoadObject? {
|
||||||
didSet {
|
didSet {
|
||||||
@ -46,7 +32,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override func viewForTop() -> UIView? {
|
open override func viewForTop() -> UIView? {
|
||||||
guard let headerModel = (templateModel as? StackPageTemplateModel)?.header,
|
guard let headerModel = templateModel?.header,
|
||||||
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -55,7 +41,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
|
|||||||
|
|
||||||
open override func viewForMiddle() -> UIView? {
|
open override func viewForMiddle() -> UIView? {
|
||||||
|
|
||||||
guard let moleculeStackModel = (templateModel as? StackPageTemplateModel)?.moleculeStack else {
|
guard let moleculeStackModel = templateModel?.moleculeStack else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,7 +53,7 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override open func viewForBottom() -> UIView? {
|
override open func viewForBottom() -> UIView? {
|
||||||
guard let footerModel = (templateModel as? StackPageTemplateModel)?.footer,
|
guard let footerModel = templateModel?.footer,
|
||||||
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,21 +10,7 @@ import UIKit
|
|||||||
|
|
||||||
@objcMembers open class ThreeLayerTemplate: ThreeLayerViewController, TemplateProtocol {
|
@objcMembers open class ThreeLayerTemplate: ThreeLayerViewController, TemplateProtocol {
|
||||||
|
|
||||||
public var templateModel: TemplateModelProtocol?
|
public var templateModel: ThreeLayerPageTemplateModel?
|
||||||
|
|
||||||
public func parseTemplateJSON() {
|
|
||||||
guard let templateData = templateData() else {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
let decoder = JSONDecoder()
|
|
||||||
let templateModel = try decoder.decode(StackPageTemplateModel.self, from: templateData)
|
|
||||||
self.templateModel = templateModel
|
|
||||||
} catch {
|
|
||||||
MVMCoreUILoggingHandler.logDebugMessage(withDelegate: "error: \(error)")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override open func viewDidLoad() {
|
override open func viewDidLoad() {
|
||||||
super.viewDidLoad()
|
super.viewDidLoad()
|
||||||
@ -39,7 +25,7 @@ import UIKit
|
|||||||
|
|
||||||
|
|
||||||
open override func viewForTop() -> UIView? {
|
open override func viewForTop() -> UIView? {
|
||||||
guard let headerModel = (templateModel as? ThreeLayerPageTemplateModel)?.header,
|
guard let headerModel = templateModel?.header,
|
||||||
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(headerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -47,7 +33,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
open override func viewForMiddle() -> UIView? {
|
open override func viewForMiddle() -> UIView? {
|
||||||
guard let middleModel = (templateModel as? ThreeLayerPageTemplateModel)?.middle,
|
guard let middleModel = templateModel?.middle,
|
||||||
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(middleModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(middleModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -55,7 +41,7 @@ import UIKit
|
|||||||
}
|
}
|
||||||
|
|
||||||
override open func viewForBottom() -> UIView? {
|
override open func viewForBottom() -> UIView? {
|
||||||
guard let footerModel = (templateModel as? ThreeLayerPageTemplateModel)?.footer,
|
guard let footerModel = templateModel?.footer,
|
||||||
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
let molecule = MVMCoreUIMoleculeMappingObject.shared()?.createMolecule(footerModel, delegateObject() as? MVMCoreUIDelegateObject, true) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user