change model name to containerModel to avoid compiling error

This commit is contained in:
panxi 2019-12-20 15:00:42 -05:00
parent ca1a6f8c83
commit e36d487d32
4 changed files with 24 additions and 24 deletions

View File

@ -185,7 +185,7 @@ public class ContainerHelper: NSObject {
} }
open class Container: View { open class Container: View {
var model: ContainerModelProtocol? var containerModel: ContainerModelProtocol?
var view: UIView? var view: UIView?
let containerHelper = ContainerHelper() let containerHelper = ContainerHelper()
@ -198,7 +198,7 @@ public extension Container {
override func updateView(_ size: CGFloat) { override func updateView(_ size: CGFloat) {
super.updateView(size) super.updateView(size)
(view as? MVMCoreViewProtocol)?.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) MFStyler.setMarginsFor(self, size: size, defaultHorizontal: containerModel?.useHorizontalMargins ?? true, top: containerModel?.useHorizontalMargins ?? true ? topMarginPadding : 0, bottom: containerModel?.useHorizontalMargins ?? true ? bottomMarginPadding : 0)
} }
/// Will be called only once. /// Will be called only once.

View File

@ -20,12 +20,12 @@ open class StackItemModel: ContainerModelProtocol {
init(with view: StackItem) { init(with view: StackItem) {
self.view = view self.view = view
view.model = self view.containerModel = self
} }
init(with view: StackItem, json: [AnyHashable: Any]?) { init(with view: StackItem, json: [AnyHashable: Any]?) {
self.view = view self.view = view
view.model = self view.containerModel = self
update(with: json) update(with: json)
} }

View File

@ -18,7 +18,7 @@ struct ModuleMoleculeModel: ContainerModelProtocol {
open class ModuleMolecule: Container { open class ModuleMolecule: Container {
public override func setupView() { public override func setupView() {
super.setupView() super.setupView()
model = ModuleMoleculeModel() containerModel = ModuleMoleculeModel()
} }
// MARK: - MVMCoreUIMoleculeViewProtocol // MARK: - MVMCoreUIMoleculeViewProtocol

View File

@ -40,25 +40,25 @@ public class StandardHeaderView: MoleculeContainer {
} }
} }
open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) { // open func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
//TODO: Need to create setWithModel in ViewConstraining View // //TODO: Need to create setWithModel in ViewConstraining View
//
#warning("This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.") // #warning("This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.")
//TODO: This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView. // //TODO: This below call should be repaced with super.setWithModel once we get rid of ViewConstrainingView.
setUpWithModel(model, delegateObject, additionalData) // setUpWithModel(model, delegateObject, additionalData)
//
// This molecule will by default handle margins. // // This molecule will by default handle margins.
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetHorizontalMargins?(false) // (molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetHorizontalMargins?(false)
(molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(false) // (molecule as? MVMCoreUIViewConstrainingProtocol)?.shouldSetVerticalMargins?(false)
//
guard let headerModel = model as? HeaderModel else { // guard let headerModel = model as? HeaderModel else {
return // return
} // }
//
if let seperatorModel = headerModel.seperator as? LineModel { // if let seperatorModel = headerModel.seperator as? LineModel {
line?.setWithJSON(seperatorModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData) // line?.setWithJSON(seperatorModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData)
} // }
} // }
open override func reset() { open override func reset() {
super.reset() super.reset()