merge from develop
This commit is contained in:
commit
c46ec10e76
@ -128,7 +128,6 @@
|
||||
9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */; };
|
||||
9458C3172406C8FD00930963 /* UIFont+FontWrapping.h in Headers */ = {isa = PBXBuildFile; fileRef = 9458C3152406C8FD00930963 /* UIFont+FontWrapping.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
9458C3182406C8FD00930963 /* UIFont+FontWrapping.m in Sources */ = {isa = PBXBuildFile; fileRef = 9458C3162406C8FD00930963 /* UIFont+FontWrapping.m */; };
|
||||
946EE1BA237B66D80036751F /* MoleculeModelHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */; };
|
||||
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 948DB67D2326DCD90011F916 /* MultiProgress.swift */; };
|
||||
94AF4A3E23E9D13900676048 /* MFCaretButton.h in Headers */ = {isa = PBXBuildFile; fileRef = 94AF4A3C23E9D13900676048 /* MFCaretButton.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
94AF4A3F23E9D13900676048 /* MFCaretButton.m in Sources */ = {isa = PBXBuildFile; fileRef = 94AF4A3D23E9D13900676048 /* MFCaretButton.m */; };
|
||||
@ -183,6 +182,7 @@
|
||||
D22D1F562204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
D22D1F572204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */; };
|
||||
D243859923A16B1800332775 /* Container.swift in Sources */ = {isa = PBXBuildFile; fileRef = D243859823A16B1800332775 /* Container.swift */; };
|
||||
D256E9932412880000360572 /* Header.swift in Sources */ = {isa = PBXBuildFile; fileRef = D256E9922412880000360572 /* Header.swift */; };
|
||||
D260105323CEA61600764D80 /* ToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105223CEA61600764D80 /* ToggleModel.swift */; };
|
||||
D260105523CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */; };
|
||||
D260105923D0A92900764D80 /* ContainerProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = D260105823D0A92900764D80 /* ContainerProtocol.swift */; };
|
||||
@ -479,7 +479,6 @@
|
||||
9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MVMAnimationFramework.framework; path = ../SharedFrameworks/MVMAnimationFramework.framework; sourceTree = "<group>"; };
|
||||
9458C3152406C8FD00930963 /* UIFont+FontWrapping.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "UIFont+FontWrapping.h"; sourceTree = "<group>"; };
|
||||
9458C3162406C8FD00930963 /* UIFont+FontWrapping.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = "UIFont+FontWrapping.m"; sourceTree = "<group>"; };
|
||||
946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeModelHelper.swift; sourceTree = "<group>"; };
|
||||
948DB67D2326DCD90011F916 /* MultiProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgress.swift; sourceTree = "<group>"; };
|
||||
94AF4A3C23E9D13900676048 /* MFCaretButton.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MFCaretButton.h; sourceTree = "<group>"; };
|
||||
94AF4A3D23E9D13900676048 /* MFCaretButton.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MFCaretButton.m; sourceTree = "<group>"; };
|
||||
@ -532,6 +531,7 @@
|
||||
D22D1F542204CE5D0077CEC0 /* MVMCoreUIStackableViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MVMCoreUIStackableViewController.h; sourceTree = "<group>"; };
|
||||
D22D1F552204CE5D0077CEC0 /* MVMCoreUIStackableViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MVMCoreUIStackableViewController.m; sourceTree = "<group>"; };
|
||||
D243859823A16B1800332775 /* Container.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Container.swift; sourceTree = "<group>"; };
|
||||
D256E9922412880000360572 /* Header.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Header.swift; sourceTree = "<group>"; };
|
||||
D260105223CEA61600764D80 /* ToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ToggleModel.swift; sourceTree = "<group>"; };
|
||||
D260105423CEA7DC00764D80 /* MVMCoreUISwitch+Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "MVMCoreUISwitch+Model.swift"; sourceTree = "<group>"; };
|
||||
D260105823D0A92900764D80 /* ContainerProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ContainerProtocol.swift; sourceTree = "<group>"; };
|
||||
@ -768,7 +768,6 @@
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
||||
946EE1B5237B663A0036751F /* Extensions */,
|
||||
);
|
||||
path = Models;
|
||||
sourceTree = "<group>";
|
||||
@ -842,14 +841,6 @@
|
||||
path = LockUps;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
946EE1B5237B663A0036751F /* Extensions */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
946EE1B9237B66D80036751F /* MoleculeModelHelper.swift */,
|
||||
);
|
||||
path = Extensions;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
94C2D9822386F3E30006CF46 /* Label */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -1212,6 +1203,7 @@
|
||||
D224798E2316A995003FCCF9 /* HorizontalCombinationViews */,
|
||||
D224798D2316A988003FCCF9 /* VerticalCombinationViews */,
|
||||
01EB368C23609801006832FA /* HeaderModel.swift */,
|
||||
D256E9922412880000360572 /* Header.swift */,
|
||||
D2D90B41240463E100DD6EC9 /* MoleculeHeaderModel.swift */,
|
||||
D2A514662213885800345BFB /* MoleculeHeaderView.swift */,
|
||||
012A88EB238F084D00FE3DA1 /* FooterModel.swift */,
|
||||
@ -1866,6 +1858,7 @@
|
||||
D29DF18321E69E54003B2FB9 /* SeparatorView.m in Sources */,
|
||||
D29DF17A21E69E1F003B2FB9 /* MFCustomButton.m in Sources */,
|
||||
017BEB7B236763000024EF95 /* LineModel.swift in Sources */,
|
||||
D256E9932412880000360572 /* Header.swift in Sources */,
|
||||
94C2D9A523872C350006CF46 /* LabelAttributeFontModel.swift in Sources */,
|
||||
011D95AF2407266E000E3791 /* RadioButtonModel.swift in Sources */,
|
||||
017BEB7F23676E870024EF95 /* MoleculeObjectMapping.swift in Sources */,
|
||||
@ -1990,7 +1983,6 @@
|
||||
D22D1F1B220341F60077CEC0 /* MVMCoreUICheckBox.m in Sources */,
|
||||
C695A69823C990C200BFB94E /* DoughnutChartView.swift in Sources */,
|
||||
D29DF2CB21E7BFCC003B2FB9 /* MFSizeThreshold.m in Sources */,
|
||||
946EE1BA237B66D80036751F /* MoleculeModelHelper.swift in Sources */,
|
||||
01509D932327ECFB00EF99AA /* ProgressBar.swift in Sources */,
|
||||
D260106523D0CEA700764D80 /* StackModel.swift in Sources */,
|
||||
D29770F521F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsViewController.m in Sources */,
|
||||
|
||||
@ -75,7 +75,7 @@ public class ButtonModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
action = try typeContainer.decodeModel(codingKey: .action)
|
||||
required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required)
|
||||
requiredGroups = try typeContainer.decodeIfPresent([String].self, forKey: .requiredGroups)
|
||||
if let style = try typeContainer.decodeIfPresent(ButtonStyle.self, forKey: .style) {
|
||||
|
||||
@ -46,7 +46,7 @@ public class CaretLinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
||||
self.enabled = enabled
|
||||
}
|
||||
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
action = try typeContainer.decodeModel(codingKey: .action)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@ -55,7 +55,7 @@ open class LinkModel: ButtonModelProtocol, MoleculeModelProtocol {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
title = try typeContainer.decode(String.self, forKey: .title)
|
||||
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
action = try typeContainer.decodeModel(codingKey: .action)
|
||||
|
||||
if let enabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .enabled) {
|
||||
self.enabled = enabled
|
||||
|
||||
@ -83,7 +83,7 @@ import Foundation
|
||||
isAnimated = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAnimated) ?? true
|
||||
isRound = try typeContainer.decodeIfPresent(Bool.self, forKey: .isRound) ?? false
|
||||
isEnabled = try typeContainer.decodeIfPresent(Bool.self, forKey: .isEnabled) ?? true
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@ -25,7 +25,7 @@ open class LabelAttributeActionModel: LabelAttributeModel {
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
action = try typeContainer.decodeModel(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
action = try typeContainer.decodeModel(codingKey: .action)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ import Foundation
|
||||
fontName = try typeContainer.decodeIfPresent(String.self, forKey: .fontName)
|
||||
fontSize = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .fontSize)
|
||||
textAlignment = try typeContainer.decodeIfPresent(String.self, forKey: .textAlignment)
|
||||
attributes = try typeContainer.decodeModelsIfPresent(codingKey: .attributes, typeCodingKey: AttributeTypeKey.type) as? [LabelAttributeModel]
|
||||
attributes = try typeContainer.decodeModelsIfPresent(codingKey: .attributes)
|
||||
html = try typeContainer.decodeIfPresent(String.self, forKey: .html)
|
||||
hero = try typeContainer.decodeIfPresent(Int.self, forKey: .hero)
|
||||
makeWholeViewClickable = try typeContainer.decodeIfPresent(Bool.self, forKey: .makeWholeViewClickable)
|
||||
@ -91,10 +91,7 @@ import Foundation
|
||||
try container.encodeIfPresent(fontName, forKey: .fontName)
|
||||
try container.encodeIfPresent(fontSize, forKey: .fontSize)
|
||||
try container.encodeIfPresent(textAlignment, forKey: .textAlignment)
|
||||
var attributeContainer = container.nestedUnkeyedContainer(forKey: .attributes)
|
||||
try attributes?.forEach { attributeModel in
|
||||
try attributeContainer.encode(attributeModel)
|
||||
}
|
||||
try container.encodeModelsIfPresent(attributes, forKey: .attributes)
|
||||
try container.encodeIfPresent(html, forKey: .html)
|
||||
try container.encodeIfPresent(hero, forKey: .hero)
|
||||
try container.encodeIfPresent(makeWholeViewClickable, forKey: .makeWholeViewClickable)
|
||||
|
||||
@ -36,8 +36,8 @@ public class ToggleModel: MoleculeModelProtocol {
|
||||
if let state = try typeContainer.decodeIfPresent(Bool.self, forKey: .state) {
|
||||
self.state = state
|
||||
}
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction, typeCodingKey: ActionCodingKey.actionType)
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||
alternateAction = try typeContainer.decodeModelIfPresent(codingKey: .alternateAction)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
required = try typeContainer.decodeIfPresent(Bool.self, forKey: .required)
|
||||
fieldKey = try typeContainer.decodeIfPresent(String.self, forKey: .fieldKey)
|
||||
|
||||
@ -22,7 +22,7 @@ public class MoleculeContainerModel: ContainerModel, MoleculeContainerModelProto
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
|
||||
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
|
||||
@ -1,53 +0,0 @@
|
||||
//
|
||||
// MoleculeModelHelper.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Ryan on 11/12/19.
|
||||
// Copyright © 2019 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
|
||||
extension KeyedDecodingContainer where Key: CodingKey {
|
||||
|
||||
private enum TypeCodingKey: String, CodingKey {
|
||||
case moleculeName
|
||||
}
|
||||
|
||||
/// Decodes the molecule model with the given coding key based on moleculeName
|
||||
public func decodeMolecule(codingKey: KeyedDecodingContainer<K>.Key) throws -> MoleculeModelProtocol {
|
||||
return try decodeModel(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName)
|
||||
}
|
||||
|
||||
/// Decodes the molecule model with the given coding key based on moleculeName, optional
|
||||
public func decodeMoleculeIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> MoleculeModelProtocol? {
|
||||
return try decodeModelIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName)
|
||||
}
|
||||
|
||||
/// Decodes the list of molecule models with the given coding key based on moleculeName
|
||||
public func decodeMolecules(codingKey: KeyedDecodingContainer<K>.Key) throws -> [MoleculeModelProtocol] {
|
||||
guard let models = try decodeModels(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeModelProtocol] else {
|
||||
throw ModelRegistry.Error.decoderError
|
||||
}
|
||||
return models
|
||||
}
|
||||
|
||||
/// Decodes the list of molecule models with the given coding key based on moleculeName, optional
|
||||
public func decodeMoleculesIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> [MoleculeModelProtocol]? {
|
||||
return try decodeModelsIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [MoleculeModelProtocol]
|
||||
}
|
||||
|
||||
/// Decodes an array with arrays of molecules based on the identifiers, optional.
|
||||
public func decodeMolecules2DIfPresent(codingKey: KeyedDecodingContainer<K>.Key) throws -> [[MoleculeModelProtocol]]? {
|
||||
return try decodeModels2DIfPresent(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [[MoleculeModelProtocol]]
|
||||
}
|
||||
|
||||
/// Decodes an array with arrays of models based on the identifiers.
|
||||
public func decodeMolecules2D(codingKey: KeyedDecodingContainer<K>.Key) throws -> [[MoleculeModelProtocol]] {
|
||||
guard let models = try decodeModels2D(codingKey: codingKey, typeCodingKey: TypeCodingKey.moleculeName) as? [[MoleculeModelProtocol]] else {
|
||||
throw ModelRegistry.Error.decoderError
|
||||
}
|
||||
return models
|
||||
}
|
||||
}
|
||||
63
MVMCoreUI/Molecules/Header.swift
Normal file
63
MVMCoreUI/Molecules/Header.swift
Normal file
@ -0,0 +1,63 @@
|
||||
//
|
||||
// Header.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 3/6/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
open class HeaderView: Container {
|
||||
public let line = Line()
|
||||
|
||||
/// Convenience for doing some default setting
|
||||
open var molecule: (UIView & MVMCoreUIMoleculeViewProtocol)?
|
||||
|
||||
var headerModel: HeaderModel? {
|
||||
get { return model as? HeaderModel }
|
||||
}
|
||||
|
||||
/// Convenience function to add a molecule to the view.
|
||||
open func addMolecule(_ molecule: UIView & MVMCoreUIMoleculeViewProtocol) {
|
||||
addSubview(molecule)
|
||||
containerHelper.constrainView(molecule)
|
||||
self.molecule = molecule
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
line.updateView(size)
|
||||
molecule?.updateView(size)
|
||||
}
|
||||
|
||||
public override func setupView() {
|
||||
super.setupView()
|
||||
line.setStyle(.heavy)
|
||||
addSubview(line)
|
||||
NSLayoutConstraint.pinViewBottom(toSuperview: line, useMargins: false, constant: 0).isActive = true
|
||||
NSLayoutConstraint.pinViewLeft(toSuperview: line, useMargins: true, constant: 0).isActive = true
|
||||
NSLayoutConstraint.pinViewRight(toSuperview: line, useMargins: true, constant: 0).isActive = true
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
line.setStyle(.heavy)
|
||||
molecule?.reset?()
|
||||
}
|
||||
|
||||
// MARK: - ModelMoleculeViewProtocol
|
||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.set(with: model, delegateObject, additionalData)
|
||||
guard let headerModel = headerModel else { return }
|
||||
if let lineModel = headerModel.line {
|
||||
line.set(with: lineModel, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
open override class func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return PaddingDefaultVerticalSpacing + PaddingDefaultVerticalSpacing
|
||||
}
|
||||
}
|
||||
@ -29,10 +29,7 @@ class AccordionListItemModel: MoleculeListItemModel {
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
guard let molecules = try typeContainer.decodeMolecules(codingKey: .molecules) as? [ListItemModelProtocol & MoleculeModelProtocol] else {
|
||||
throw DecodingError.typeMismatch([ListItemModelProtocol & MoleculeModelProtocol].self, DecodingError.Context(codingPath: decoder.codingPath, debugDescription: "Casting failed"))
|
||||
}
|
||||
self.molecules = molecules
|
||||
molecules = try typeContainer.decodeModels(codingKey: .molecules)
|
||||
if let hideLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideLineWhenExpanded) {
|
||||
hideLineWhenExpanded = hideLine
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ import Foundation
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
molecules = try typeContainer.decodeMolecules2D(codingKey: .molecules) as? [[ListItemModelProtocol & MoleculeModelProtocol]] ?? [[]]
|
||||
molecules = try typeContainer.decodeModels2D(codingKey: .molecules)
|
||||
dropDown = try typeContainer.decode(ItemDropdownEntryFieldModel.self, forKey: .dropDown)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ import Foundation
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action, typeCodingKey: ActionCodingKey.actionType)
|
||||
action = try typeContainer.decodeModelIfPresent(codingKey: .action)
|
||||
hideArrow = try typeContainer.decodeIfPresent(Bool.self, forKey: .hideArrow)
|
||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||
style = try typeContainer.decodeIfPresent(String.self, forKey: .style)
|
||||
|
||||
@ -27,7 +27,7 @@ import MVMCore
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
|
||||
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ public class TabsListItemModel: ListItemModel, MoleculeModelProtocol {
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
tabs = try typeContainer.decode(TabsModel.self, forKey: .tabs)
|
||||
molecules = try typeContainer.decodeMolecules2D(codingKey: .molecules) as! [[ListItemModelProtocol & MoleculeModelProtocol]]
|
||||
molecules = try typeContainer.decodeModels2D(codingKey: .molecules)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ public class CornerLabelsModel: MoleculeModelProtocol {
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
molecule = try typeContainer.decodeMoleculeIfPresent(codingKey: .molecule)
|
||||
molecule = try typeContainer.decodeModelIfPresent(codingKey: .molecule)
|
||||
topLeftLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .topLeftLabel)
|
||||
topRightLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .topRightLabel)
|
||||
bottomLeftLabel = try typeContainer.decodeIfPresent(LabelModel.self, forKey: .bottomLeftLabel)
|
||||
|
||||
@ -24,7 +24,7 @@ import Foundation
|
||||
|
||||
required public init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
|
||||
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
||||
try super.init(from: decoder)
|
||||
}
|
||||
|
||||
|
||||
@ -23,7 +23,7 @@ import Foundation
|
||||
public required init(from decoder: Decoder) throws {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
let list = try typeContainer.decodeMolecules(codingKey: .list)
|
||||
let list: [MoleculeModelProtocol] = try typeContainer.decodeModels(codingKey: .list)
|
||||
var models: [MoleculeStackItemModel] = []
|
||||
for (index, molecule) in list.enumerated() {
|
||||
models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: "\(index+1).", molecule: molecule)))
|
||||
|
||||
@ -30,7 +30,7 @@ public class StringAndMoleculeModel: MoleculeModelProtocol {
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
||||
string = try typeContainer.decode(String.self, forKey: .string)
|
||||
molecule = try typeContainer.decodeMolecule(codingKey: .molecule)
|
||||
molecule = try typeContainer.decodeModel(codingKey: .molecule)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@ -28,7 +28,7 @@ import Foundation
|
||||
self.bulletChar = bulletChar
|
||||
}
|
||||
|
||||
let list = try typeContainer.decodeMolecules(codingKey: .list)
|
||||
let list: [MoleculeModelProtocol] = try typeContainer.decodeModels(codingKey: .list)
|
||||
var models: [MoleculeStackItemModel] = []
|
||||
for molecule in list {
|
||||
models.append(MoleculeStackItemModel(with: StringAndMoleculeModel(string: bulletChar, molecule: molecule)))
|
||||
|
||||
@ -48,7 +48,7 @@ import UIKit
|
||||
self.height = try typeContainer.decode(Float.self, forKey: .height)
|
||||
self.itemWidthPercent = try typeContainer.decode(Float.self, forKey: .itemWidthPercent)
|
||||
self.itemAlignment = try typeContainer.decode(String.self, forKey: .itemAlignment)
|
||||
self.pagingMolecule = try typeContainer.decodeMoleculeIfPresent(codingKey: .pagingMolecule) as? CarouselPagingModelProtocol
|
||||
self.pagingMolecule = try typeContainer.decodeModelIfPresent(codingKey: .pagingMolecule)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@ -57,10 +57,10 @@ import Foundation
|
||||
let typeContainer = try decoder.container(keyedBy: CodingKeys.self)
|
||||
pageType = try typeContainer.decode(String.self, forKey: .pageType)
|
||||
screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading)
|
||||
molecules = try typeContainer.decodeMoleculesIfPresent(codingKey: .molecules) as? [ListItemModelProtocol & MoleculeModelProtocol]
|
||||
molecules = try typeContainer.decodeModelsIfPresent(codingKey: .molecules)
|
||||
isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs)
|
||||
header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header)
|
||||
footer = try typeContainer.decodeMoleculeIfPresent(codingKey: .footer)
|
||||
header = try typeContainer.decodeModelIfPresent(codingKey: .header)
|
||||
footer = try typeContainer.decodeModelIfPresent(codingKey: .footer)
|
||||
line = try typeContainer.decodeIfPresent(LineModel.self, forKey: .line)
|
||||
}
|
||||
|
||||
|
||||
@ -40,8 +40,8 @@ import Foundation
|
||||
moleculeStack = try typeContainer.decode(MoleculeStackModel.self, forKey: .stack)
|
||||
screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading)
|
||||
isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs)
|
||||
header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header)
|
||||
footer = try typeContainer.decodeMoleculeIfPresent(codingKey: .footer)
|
||||
header = try typeContainer.decodeModelIfPresent(codingKey: .header)
|
||||
footer = try typeContainer.decodeModelIfPresent(codingKey: .footer)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
@ -40,9 +40,9 @@ import Foundation
|
||||
pageType = try typeContainer.decode(String.self, forKey: .pageType)
|
||||
screenHeading = try typeContainer.decodeIfPresent(String.self, forKey: .screenHeading)
|
||||
isAtomicTabs = try typeContainer.decodeIfPresent(Bool.self, forKey: .isAtomicTabs)
|
||||
header = try typeContainer.decodeMoleculeIfPresent(codingKey: .header)
|
||||
middle = try typeContainer.decodeMoleculeIfPresent(codingKey: .middle)
|
||||
footer = try typeContainer.decodeMoleculeIfPresent(codingKey: .footer)
|
||||
header = try typeContainer.decodeModelIfPresent(codingKey: .header)
|
||||
middle = try typeContainer.decodeModelIfPresent(codingKey: .middle)
|
||||
footer = try typeContainer.decodeModelIfPresent(codingKey: .footer)
|
||||
}
|
||||
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user