more models
This commit is contained in:
parent
4d155b9f97
commit
943799d462
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
01004F3022721C3800991ECC /* RadioButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01004F2F22721C3800991ECC /* RadioButton.swift */; };
|
01004F3022721C3800991ECC /* RadioButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 01004F2F22721C3800991ECC /* RadioButton.swift */; };
|
||||||
|
0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */; };
|
||||||
0105618D224BBE7700E1557D /* FormValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618A224BBE7700E1557D /* FormValidator.swift */; };
|
0105618D224BBE7700E1557D /* FormValidator.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618A224BBE7700E1557D /* FormValidator.swift */; };
|
||||||
0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */; };
|
0105618E224BBE7700E1557D /* FormValidator+TextFields.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */; };
|
||||||
0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */; };
|
0105618F224BBE7700E1557D /* FormValidator+FormParams.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */; };
|
||||||
@ -310,6 +311,7 @@
|
|||||||
|
|
||||||
/* Begin PBXFileReference section */
|
/* Begin PBXFileReference section */
|
||||||
01004F2F22721C3800991ECC /* RadioButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButton.swift; sourceTree = "<group>"; };
|
01004F2F22721C3800991ECC /* RadioButton.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButton.swift; sourceTree = "<group>"; };
|
||||||
|
0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyToggleModel.swift; sourceTree = "<group>"; };
|
||||||
0105618A224BBE7700E1557D /* FormValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidator.swift; sourceTree = "<group>"; };
|
0105618A224BBE7700E1557D /* FormValidator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = FormValidator.swift; sourceTree = "<group>"; };
|
||||||
0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+TextFields.swift"; sourceTree = "<group>"; };
|
0105618B224BBE7700E1557D /* FormValidator+TextFields.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+TextFields.swift"; sourceTree = "<group>"; };
|
||||||
0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+FormParams.swift"; sourceTree = "<group>"; };
|
0105618C224BBE7700E1557D /* FormValidator+FormParams.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "FormValidator+FormParams.swift"; sourceTree = "<group>"; };
|
||||||
@ -809,6 +811,7 @@
|
|||||||
01C851D223CF9E740021F976 /* LabelToggleModel.swift */,
|
01C851D223CF9E740021F976 /* LabelToggleModel.swift */,
|
||||||
D22479892314445E003FCCF9 /* LabelSwitch.swift */,
|
D22479892314445E003FCCF9 /* LabelSwitch.swift */,
|
||||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
||||||
|
0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */,
|
||||||
);
|
);
|
||||||
path = SwitchMolecules;
|
path = SwitchMolecules;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -1540,6 +1543,7 @@
|
|||||||
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
||||||
D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */,
|
D29DF12B21E6851E003B2FB9 /* MVMCoreUITopAlertExpandableView.m in Sources */,
|
||||||
94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */,
|
94C2D9A723872DA90006CF46 /* LabelAttributeColorModel.swift in Sources */,
|
||||||
|
0103B84E23D7E33A009C315C /* HeadlineBodyToggleModel.swift in Sources */,
|
||||||
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
D2755D7B23689C7500485468 /* TableViewCell.swift in Sources */,
|
||||||
0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */,
|
0A21DB85235E06EF00C160A2 /* MFTextField.m in Sources */,
|
||||||
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
|
014AA72623C501E2006F3E93 /* ContainerModelProtocol.swift in Sources */,
|
||||||
|
|||||||
@ -14,6 +14,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
|||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
public var state: Bool = true
|
public var state: Bool = true
|
||||||
public var action: ActionModelProtocol?
|
public var action: ActionModelProtocol?
|
||||||
|
public var alternateAction: ActionModelProtocol?
|
||||||
public var required: Bool?
|
public var required: Bool?
|
||||||
public var fieldKey: String?
|
public var fieldKey: String?
|
||||||
|
|
||||||
@ -24,6 +25,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
|||||||
case backgroundColor
|
case backgroundColor
|
||||||
case required
|
case required
|
||||||
case fieldKey
|
case fieldKey
|
||||||
|
case alternateAction
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(_ state: Bool) {
|
public init(_ state: Bool) {
|
||||||
@ -36,6 +38,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
|||||||
self.state = state
|
self.state = state
|
||||||
}
|
}
|
||||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||||
|
alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction, typeCodingKey: ActionCodingKey.actionType)
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||||
required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required)
|
required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required)
|
||||||
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
||||||
@ -45,6 +48,7 @@ public class ToggleModel: MoleculeModelProtocol {
|
|||||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||||
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(backgroundColor, forKey: .backgroundColor)
|
||||||
try container.encodeModelIfPresent(action, forKey: .action)
|
try container.encodeModelIfPresent(action, forKey: .action)
|
||||||
|
try container.encodeModelIfPresent(alternateAction, forKey: .alternateAction)
|
||||||
try container.encode(moleculeName, forKey: .moleculeName)
|
try container.encode(moleculeName, forKey: .moleculeName)
|
||||||
try container.encodeIfPresent(state, forKey: .state)
|
try container.encodeIfPresent(state, forKey: .state)
|
||||||
try container.encodeIfPresent(required, forKey: .required)
|
try container.encodeIfPresent(required, forKey: .required)
|
||||||
|
|||||||
@ -10,18 +10,18 @@ import UIKit
|
|||||||
|
|
||||||
@objcMembers open class HeadlineBodySwitch: View {
|
@objcMembers open class HeadlineBodySwitch: View {
|
||||||
public let headlineBody = HeadlineBody(frame: .zero)
|
public let headlineBody = HeadlineBody(frame: .zero)
|
||||||
public let mvmSwitch = MVMCoreUISwitch.mvmSwitchDefault()
|
public let toggle = Toggle()
|
||||||
|
|
||||||
// MARK: - MVMCoreViewProtocol
|
// MARK: - MVMCoreViewProtocol
|
||||||
open override func updateView(_ size: CGFloat) {
|
open override func updateView(_ size: CGFloat) {
|
||||||
super.updateView(size)
|
super.updateView(size)
|
||||||
headlineBody.updateView(size)
|
headlineBody.updateView(size)
|
||||||
mvmSwitch.updateView(size)
|
toggle.updateView(size)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setupView() {
|
open override func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
guard mvmSwitch.superview == nil else {
|
guard toggle.superview == nil else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
headlineBody.styleListItem()
|
headlineBody.styleListItem()
|
||||||
@ -30,8 +30,8 @@ import UIKit
|
|||||||
NSLayoutConstraint.constraintPinSubview(toSuperview: view)
|
NSLayoutConstraint.constraintPinSubview(toSuperview: view)
|
||||||
|
|
||||||
view.addSubview(headlineBody)
|
view.addSubview(headlineBody)
|
||||||
view.addSubview(mvmSwitch)
|
view.addSubview(toggle)
|
||||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: mvmSwitch)
|
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: toggle)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -39,6 +39,10 @@ import UIKit
|
|||||||
|
|
||||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||||
super.setWithModel(model, delegateObject, additionalData)
|
super.setWithModel(model, delegateObject, additionalData)
|
||||||
|
guard let headlineBodyToggleModel = model as? HeadlineBodyToggleModel else {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
setWithJSON(headlineBodyToggleModel.toJSON(), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
public class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
public class override func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
@ -50,7 +54,7 @@ import UIKit
|
|||||||
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)
|
||||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
toggle.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||||
}
|
}
|
||||||
|
|
||||||
open class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
open class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||||
@ -59,14 +63,14 @@ import UIKit
|
|||||||
|
|
||||||
open override func setAsMolecule() {
|
open override func setAsMolecule() {
|
||||||
headlineBody.setAsMolecule()
|
headlineBody.setAsMolecule()
|
||||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
(toggle as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
||||||
headlineBody.styleListItem()
|
headlineBody.styleListItem()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
open override func reset() {
|
||||||
super.reset()
|
super.reset()
|
||||||
headlineBody.reset()
|
headlineBody.reset()
|
||||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).reset?()
|
(toggle as MVMCoreUIMoleculeViewProtocol).reset?()
|
||||||
headlineBody.styleListItem()
|
headlineBody.styleListItem()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,22 @@
|
|||||||
|
//
|
||||||
|
// HeadlineBodyToggleModel.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Suresh, Kamlesh on 1/21/20.
|
||||||
|
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
|
||||||
|
|
||||||
|
open class HeadlineBodyToggleModel: MoleculeModelProtocol {
|
||||||
|
public static var identifier: String = "headlineBodyToggle"
|
||||||
|
open var backgroundColor: Color?
|
||||||
|
open var headlineBody: HeadlineBodyModel
|
||||||
|
open var toggle: ToggleModel
|
||||||
|
|
||||||
|
public init(_ headlineBody: HeadlineBodyModel, _ toggle: ToggleModel) {
|
||||||
|
self.headlineBody = headlineBody
|
||||||
|
self.toggle = toggle
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -15,9 +15,8 @@ import Foundation
|
|||||||
public var style: String?
|
public var style: String?
|
||||||
public var backgroundColor: Color?
|
public var backgroundColor: Color?
|
||||||
|
|
||||||
public init(headline: LabelModel, body: LabelModel) {
|
public init(headline: LabelModel) {
|
||||||
self.headline = headline
|
self.headline = headline
|
||||||
self.body = body
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -70,5 +70,6 @@ import Foundation
|
|||||||
ModelRegistry.register(DoughnutChartModel.self)
|
ModelRegistry.register(DoughnutChartModel.self)
|
||||||
ModelRegistry.register(NumberedListModel.self)
|
ModelRegistry.register(NumberedListModel.self)
|
||||||
ModelRegistry.register(UnOrderedListModel.self)
|
ModelRegistry.register(UnOrderedListModel.self)
|
||||||
|
ModelRegistry.register(HeadlineBodyToggleModel.self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user