each template must parse themselves...

This commit is contained in:
Pfeil, Scott Robert 2020-01-10 09:55:42 -05:00
parent 99a258c0f8
commit 90d7b188d1
5 changed files with 11 additions and 22 deletions

View File

@ -33,8 +33,5 @@ extension MFViewController: MoleculeDelegateProtocol {
public extension MFViewController {
@objc func parsePageJSON() {
(self as? TemplateProtocol)?.parseTemplateJSON()
}
}
//MoleculeDelegateProtocol

View File

@ -8,18 +8,14 @@
import Foundation
public protocol TemplateProtocol {
public protocol TemplateProtocol: class {
associatedtype TemplateModel: TemplateModelProtocol
var templateModel: TemplateModel? { get set }
}
public extension TemplateProtocol {
}
public extension TemplateProtocol where Self: MFViewController {
mutating func parseTemplateJSON() {
guard let pageJSON = loadObject?.pageJSON as? [String: AnyHashable] else { return }
func parseTemplateJSON() {
guard let pageJSON = self.loadObject?.pageJSON as? [String: AnyHashable] else { return }
do {
let data = try JSONSerialization.data(withJSONObject: pageJSON)
let decoder = JSONDecoder()
@ -30,12 +26,3 @@ public extension TemplateProtocol where Self: MFViewController {
}
}
}
class Testing: MFViewController, TemplateProtocol {
typealias TemplateModel = StackPageTemplateModel
var templateModel: StackPageTemplateModel?
public func parsePageJSON() {
parseTemplateJSON()
}
}

View File

@ -14,8 +14,7 @@ open class MoleculeListTemplate: ThreeLayerTableViewController, TemplateProtocol
var observer: NSKeyValueObservation?
public var templateModel: ListPageTemplateModel?
public func parsePageJSON() {
public override func parsePageJSON() {
parseTemplateJSON()
}

View File

@ -12,6 +12,9 @@ open class MoleculeStackTemplate: ThreeLayerViewController, TemplateProtocol {
var observer: NSKeyValueObservation?
public var templateModel: StackPageTemplateModel?
public override func parsePageJSON() {
parseTemplateJSON()
}
open override var loadObject: MVMCoreLoadObject? {
didSet {

View File

@ -11,7 +11,10 @@ import UIKit
@objcMembers open class ThreeLayerTemplate: ThreeLayerViewController, TemplateProtocol {
public var templateModel: ThreeLayerPageTemplateModel?
public override func parsePageJSON() {
parseTemplateJSON()
}
override open func viewDidLoad() {
super.viewDidLoad()
bottomViewOutsideOfScroll = true