Add some missing models
This commit is contained in:
parent
d22715585e
commit
c6ba48397c
@ -300,6 +300,11 @@
|
||||
D2E1FADF2268B8E700AEFD8C /* ThreeLayerTableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */; };
|
||||
D2E1FAE12268E81D00AEFD8C /* MoleculeListTemplate.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */; };
|
||||
D2E2A98323D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A98223D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift */; };
|
||||
D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99323D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift */; };
|
||||
D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99523D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift */; };
|
||||
D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */; };
|
||||
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */; };
|
||||
D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2E2A99B23D8D975000B42E6 /* ImageHeadlineBodyModel.swift */; };
|
||||
D2FB151B23A2B65B00C20E10 /* MoleculeContainer.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2FB151A23A2B65B00C20E10 /* MoleculeContainer.swift */; };
|
||||
D2FB151D23A40F1500C20E10 /* MoleculeStackItem.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2FB151C23A40F1500C20E10 /* MoleculeStackItem.swift */; };
|
||||
DB06250B2293456500B72DD3 /* LeftRightLabelView.swift in Sources */ = {isa = PBXBuildFile; fileRef = DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */; };
|
||||
@ -608,6 +613,11 @@
|
||||
D2E1FADE2268B8E700AEFD8C /* ThreeLayerTableViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreeLayerTableViewController.swift; sourceTree = "<group>"; };
|
||||
D2E1FAE02268E81D00AEFD8C /* MoleculeListTemplate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeListTemplate.swift; sourceTree = "<group>"; };
|
||||
D2E2A98223D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EyebrowHeadlineBodyLinkModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99323D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyLinkModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99523D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyLinkToggleModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActionDetailWithImageModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = HeadlineBodyButtonModel.swift; sourceTree = "<group>"; };
|
||||
D2E2A99B23D8D975000B42E6 /* ImageHeadlineBodyModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ImageHeadlineBodyModel.swift; sourceTree = "<group>"; };
|
||||
D2F4DDE52371A4CB00CD28BB /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = "<group>"; };
|
||||
D2FB151A23A2B65B00C20E10 /* MoleculeContainer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeContainer.swift; sourceTree = "<group>"; };
|
||||
D2FB151C23A40F1500C20E10 /* MoleculeStackItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MoleculeStackItem.swift; sourceTree = "<group>"; };
|
||||
@ -798,11 +808,12 @@
|
||||
D224798823142BF2003FCCF9 /* SwitchMolecules */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2E2A99523D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift */,
|
||||
01509D942327ED1900EF99AA /* HeadlineBodyTextButtonSwitch.swift */,
|
||||
01C851D223CF9E740021F976 /* LabelToggleModel.swift */,
|
||||
D22479892314445E003FCCF9 /* LabelSwitch.swift */,
|
||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
||||
0103B84D23D7E33A009C315C /* HeadlineBodyToggleModel.swift */,
|
||||
D224798B231450C8003FCCF9 /* HeadlineBodySwitch.swift */,
|
||||
);
|
||||
path = SwitchMolecules;
|
||||
sourceTree = "<group>";
|
||||
@ -813,11 +824,14 @@
|
||||
D29E28D423D1FFFA00ACEA85 /* Lists */,
|
||||
01EB368D23609801006832FA /* HeadlineBodyModel.swift */,
|
||||
D2A638FC22CA98280052ED1F /* HeadlineBody.swift */,
|
||||
D2E2A99323D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift */,
|
||||
D22479952316AF6D003FCCF9 /* HeadlineBodyTextButton.swift */,
|
||||
D2E2A98223D8B32D000B42E6 /* EyebrowHeadlineBodyLinkModel.swift */,
|
||||
D27CD40F2339057800C1DC07 /* EyebrowHeadlineBodyLink.swift */,
|
||||
D28A839223CE828900DFE4FC /* HeadlineBodyCaretLinkImageModel.swift */,
|
||||
C7192E7C23C301750050C2A0 /* HeadLineBodyCaretLinkImage.swift */,
|
||||
D2E2A99923D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift */,
|
||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||
);
|
||||
path = VerticalCombinationViews;
|
||||
sourceTree = "<group>";
|
||||
@ -825,6 +839,7 @@
|
||||
D224798E2316A995003FCCF9 /* HorizontalCombinationViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2E2A99B23D8D975000B42E6 /* ImageHeadlineBodyModel.swift */,
|
||||
D2B1E3E422F37D6A0065F95C /* ImageHeadlineBody.swift */,
|
||||
D28A838E23CCDEDE00DFE4FC /* TwoButtonViewModel.swift */,
|
||||
D20A9A5D2243D3E300ADE781 /* TwoButtonView.swift */,
|
||||
@ -836,6 +851,8 @@
|
||||
D224798F2316A99F003FCCF9 /* LeftRightViews */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
D2E2A99723D8D63C000B42E6 /* ActionDetailWithImageModel.swift */,
|
||||
0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */,
|
||||
D28A839023CD4FD400DFE4FC /* CornerLabelsModel.swift */,
|
||||
01509D902327ECE600EF99AA /* CornerLabels.swift */,
|
||||
D224798823142BF2003FCCF9 /* SwitchMolecules */,
|
||||
@ -986,7 +1003,6 @@
|
||||
D224798F2316A99F003FCCF9 /* LeftRightViews */,
|
||||
D224798E2316A995003FCCF9 /* HorizontalCombinationViews */,
|
||||
D224798D2316A988003FCCF9 /* VerticalCombinationViews */,
|
||||
0A12149F22C11A17007C7030 /* ActionDetailWithImage.swift */,
|
||||
01EB368C23609801006832FA /* HeaderModel.swift */,
|
||||
D2A514662213885800345BFB /* HeaderView.swift */,
|
||||
012A88EB238F084D00FE3DA1 /* FooterModel.swift */,
|
||||
@ -996,7 +1012,6 @@
|
||||
D29B770F22C281F400D6ACE0 /* ModuleMolecule.swift */,
|
||||
D28A838423CCCA8900DFE4FC /* ScrollerModel.swift */,
|
||||
D2D6CD3F22E78C1A00D701B8 /* Scroller.swift */,
|
||||
0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */,
|
||||
017BEB372360C6AC0024EF95 /* RadioButtonLabel.swift */,
|
||||
017BEB47236230DB0024EF95 /* MoleculeViewProtocol.swift */,
|
||||
017BEB49236235BA0024EF95 /* ModelMoleculeViewProtocol.swift */,
|
||||
@ -1495,6 +1510,7 @@
|
||||
D27CD40E2322EEAF00C1DC07 /* TabsTableViewCell.swift in Sources */,
|
||||
D224799B231965AD003FCCF9 /* AccordionMoleculeTableViewCell.swift in Sources */,
|
||||
D22D1F1F220343560077CEC0 /* MVMCoreUICheckMarkView.m in Sources */,
|
||||
D2E2A99423D8CCBC000B42E6 /* HeadlineBodyLinkModel.swift in Sources */,
|
||||
01004F3022721C3800991ECC /* RadioButton.swift in Sources */,
|
||||
D268C70E238C22D7007F2C1C /* DropDownFilterTableViewCell.swift in Sources */,
|
||||
017BEB3C2361EA1D0024EF95 /* MFViewController+Model.swift in Sources */,
|
||||
@ -1515,6 +1531,7 @@
|
||||
012A88AD238C418100FE3DA1 /* TemplateProtocol.swift in Sources */,
|
||||
D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */,
|
||||
D260106323D0C05000764D80 /* StackItemModel.swift in Sources */,
|
||||
D2E2A99823D8D63C000B42E6 /* ActionDetailWithImageModel.swift in Sources */,
|
||||
01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */,
|
||||
0A21DB7F235DECC500C160A2 /* EntryField.swift in Sources */,
|
||||
D2C5001921F8ECDD001DA659 /* MVMCoreUIViewControllerMappingObject.m in Sources */,
|
||||
@ -1533,6 +1550,7 @@
|
||||
D260106123D0C02A00764D80 /* StackItemModelProtocol.swift in Sources */,
|
||||
012A88C4238D86E600FE3DA1 /* CarouselItemModelProtocol.swift in Sources */,
|
||||
94C2D9AB23872EB50006CF46 /* LabelAttributeActionModel.swift in Sources */,
|
||||
D2E2A99A23D8D6B4000B42E6 /* HeadlineBodyButtonModel.swift in Sources */,
|
||||
014AA73123C5059B006F3E93 /* ListPageTemplateModel.swift in Sources */,
|
||||
017BEB4023620A230024EF95 /* TextFieldModel.swift in Sources */,
|
||||
D29DF2A221E7AF4E003B2FB9 /* MVMCoreUIUtility.m in Sources */,
|
||||
@ -1548,6 +1566,7 @@
|
||||
944589232385DA9600DE9FD4 /* ImageViewModel.swift in Sources */,
|
||||
D213347723843825008E41B3 /* Line.swift in Sources */,
|
||||
D28A837723C79FC600DFE4FC /* MFCustomButton+ActionModel.swift in Sources */,
|
||||
D2E2A99C23D8D975000B42E6 /* ImageHeadlineBodyModel.swift in Sources */,
|
||||
D28A837F23CCA96400DFE4FC /* TabsModel.swift in Sources */,
|
||||
012A88EC238F084D00FE3DA1 /* FooterModel.swift in Sources */,
|
||||
D2A514672213885800345BFB /* HeaderView.swift in Sources */,
|
||||
@ -1600,6 +1619,7 @@
|
||||
011B58F223A2AE2C0085F53C /* DropDownListItemModel.swift in Sources */,
|
||||
94C2D9842386F3F80006CF46 /* LabelAttributeModel.swift in Sources */,
|
||||
944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */,
|
||||
D2E2A99623D8CF85000B42E6 /* HeadlineBodyLinkToggleModel.swift in Sources */,
|
||||
C6FA7D5323C77A4A00A3614A /* StringAndMoleculeStack.swift in Sources */,
|
||||
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
|
||||
D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */,
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers open class ImageHeadlineBody: ViewConstrainingView {
|
||||
@objcMembers open class ImageHeadlineBody: View {
|
||||
let headlineBody = HeadlineBody(frame: .zero)
|
||||
let imageView = MFLoadImageView()
|
||||
var constraintBetweenImageLabelsConstant: CGFloat = 16
|
||||
@ -23,27 +23,24 @@ import UIKit
|
||||
headlineBody.headlineLabel.styleB1(true)
|
||||
headlineBody.spaceBetweenLabelsConstant = 0
|
||||
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
pinView(toSuperView: view)
|
||||
view.addSubview(headlineBody)
|
||||
view.addSubview(imageView)
|
||||
addSubview(headlineBody)
|
||||
addSubview(imageView)
|
||||
|
||||
headlineBody.topAnchor.constraint(equalTo: view.topAnchor).isActive = true
|
||||
view.rightAnchor.constraint(equalTo: headlineBody.rightAnchor).isActive = true
|
||||
view.bottomAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor).isActive = true
|
||||
var constraint = view.bottomAnchor.constraint(equalTo: headlineBody.bottomAnchor)
|
||||
headlineBody.topAnchor.constraint(equalTo: topAnchor).isActive = true
|
||||
rightAnchor.constraint(equalTo: headlineBody.rightAnchor).isActive = true
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: headlineBody.bottomAnchor).isActive = true
|
||||
var constraint = bottomAnchor.constraint(equalTo: headlineBody.bottomAnchor)
|
||||
constraint.priority = .defaultLow
|
||||
constraint.isActive = true
|
||||
|
||||
imageView.centerYAnchor.constraint(equalTo: view.centerYAnchor).isActive = true
|
||||
imageView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
imageView.topAnchor.constraint(greaterThanOrEqualTo: view.topAnchor).isActive = true
|
||||
view.bottomAnchor.constraint(greaterThanOrEqualTo: imageView.bottomAnchor).isActive = true
|
||||
constraint = view.bottomAnchor.constraint(equalTo: imageView.bottomAnchor)
|
||||
imageView.centerYAnchor.constraint(equalTo: centerYAnchor).isActive = true
|
||||
imageView.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
|
||||
imageView.topAnchor.constraint(greaterThanOrEqualTo: topAnchor).isActive = true
|
||||
bottomAnchor.constraint(greaterThanOrEqualTo: imageView.bottomAnchor).isActive = true
|
||||
constraint = bottomAnchor.constraint(equalTo: imageView.bottomAnchor)
|
||||
constraint.priority = UILayoutPriority(rawValue: 200)
|
||||
constraint.isActive = true
|
||||
constraint = imageView.topAnchor.constraint(equalTo: view.topAnchor)
|
||||
constraint = imageView.topAnchor.constraint(equalTo: topAnchor)
|
||||
constraint.priority = UILayoutPriority(rawValue: 200)
|
||||
constraint.isActive = true
|
||||
|
||||
@ -58,22 +55,6 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
let imageJSON = json?.optionalDictionaryForKey("image")
|
||||
imageView.setWithJSON(imageJSON, delegateObject: delegateObject, additionalData: additionalData)
|
||||
constraintBetweenImageLabels?.constant = imageJSON != nil ? constraintBetweenImageLabelsConstant : 0
|
||||
}
|
||||
|
||||
open override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
headlineBody.setAsMolecule()
|
||||
imageView.setAsMolecule()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
headlineBody.reset()
|
||||
@ -82,7 +63,15 @@ import UIKit
|
||||
imageView.reset()
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 95
|
||||
}
|
||||
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? ImageHeadlineBodyModel else { return }
|
||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
||||
imageView.setWithModel(model.image, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
//
|
||||
// File.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ImageHeadlineBodyModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "imageHeadlineBody"
|
||||
public var backgroundColor: Color?
|
||||
public var image: ImageViewModel
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
}
|
||||
@ -8,7 +8,7 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
public class TwoButtonViewModel: MoleculeModelProtocol {
|
||||
public struct TwoButtonViewModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "twoButtonView"
|
||||
public var backgroundColor: Color?
|
||||
public var primaryButton: ButtonModel?
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
import UIKit
|
||||
|
||||
|
||||
@objcMembers open class ActionDetailWithImage: ViewConstrainingView {
|
||||
@objcMembers open class ActionDetailWithImage: View {
|
||||
//------------------------------------------------------
|
||||
// MARK: - Outlets
|
||||
//------------------------------------------------------
|
||||
@ -91,10 +91,6 @@ import UIKit
|
||||
imageLoader.updateView(size)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
return 197
|
||||
}
|
||||
|
||||
//------------------------------------------------------
|
||||
// MARK: - Methods
|
||||
//------------------------------------------------------
|
||||
@ -117,20 +113,15 @@ import UIKit
|
||||
setDefaultState()
|
||||
}
|
||||
|
||||
open override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
|
||||
headlineBodyButton.setAsMolecule()
|
||||
imageLoader.setAsMolecule()
|
||||
setDefaultState()
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 197
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
guard let dictionary = json else { return }
|
||||
|
||||
headlineBodyButton.setWithJSON(dictionary.optionalDictionaryForKey("headlineBodyButton"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
imageLoader.setWithJSON(dictionary.optionalDictionaryForKey("image"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? ActionDetailWithImageModel else { return }
|
||||
headlineBodyButton.setWithModel(model.headlineBodyButton, delegateObject, additionalData)
|
||||
imageLoader.setWithModel(model.image, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
//
|
||||
// ActionDetailWithImageModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct ActionDetailWithImageModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "actionDetailWithImage"
|
||||
public var backgroundColor: Color?
|
||||
public var headlineBodyButton: HeadlineBodyButtonModel
|
||||
public var image: ImageViewModel
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
//
|
||||
// HeadlineBodyLinkToggleModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
public struct HeadlineBodyLinkToggleModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyLinkToggle"
|
||||
public var backgroundColor: Color?
|
||||
public var headlineBodyLink: HeadlineBodyLinkModel
|
||||
public var toggle: ToggleModel
|
||||
|
||||
public init(_ headlineBodyLink: HeadlineBodyLinkModel, _ toggle: ToggleModel) {
|
||||
self.headlineBodyLink = headlineBodyLink
|
||||
self.toggle = toggle
|
||||
}
|
||||
}
|
||||
@ -8,55 +8,45 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class HeadlineBodyTextButtonSwitch: ViewConstrainingView {
|
||||
let headlineBodyTextButton = HeadlineBodyTextButton(frame: .zero)
|
||||
let mvmSwitch = MVMCoreUISwitch.mvmSwitchDefault()
|
||||
@objcMembers public class HeadlineBodyTextButtonSwitch: View {
|
||||
let headlineBodyLink = HeadlineBodyTextButton(frame: .zero)
|
||||
let toggle = Toggle()
|
||||
|
||||
// MARK: - MVMCoreViewProtocol
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
headlineBodyTextButton.updateView(size)
|
||||
mvmSwitch.updateView(size)
|
||||
headlineBodyLink.updateView(size)
|
||||
toggle.updateView(size)
|
||||
}
|
||||
|
||||
public override func setupView() {
|
||||
super.setupView()
|
||||
guard mvmSwitch.superview == nil else {
|
||||
guard toggle.superview == nil else {
|
||||
return
|
||||
}
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
pinView(toSuperView: view)
|
||||
|
||||
headlineBodyTextButton.headlineBody.styleListItem()
|
||||
view.addSubview(headlineBodyTextButton)
|
||||
view.addSubview(mvmSwitch)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBodyTextButton, rightView: mvmSwitch)
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
public override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBodyTextButton.setWithJSON(json?.optionalDictionaryForKey("headlineBodyLink"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("toggle"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
return HeadlineBodyTextButton.estimatedHeight(forRow: json, delegateObject: delegateObject)
|
||||
}
|
||||
|
||||
public override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
headlineBodyTextButton.setAsMolecule()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
|
||||
headlineBodyTextButton.headlineBody.styleListItem()
|
||||
headlineBodyLink.headlineBody.styleListItem()
|
||||
addSubview(headlineBodyLink)
|
||||
addSubview(toggle)
|
||||
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBodyLink, rightView: toggle)
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtoco
|
||||
public override func reset() {
|
||||
super.reset()
|
||||
headlineBodyTextButton.reset()
|
||||
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).reset?()
|
||||
headlineBodyTextButton.headlineBody.styleListItem()
|
||||
headlineBodyLink.reset()
|
||||
toggle.reset()
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadlineBodyLinkToggleModel else { return }
|
||||
headlineBodyLink.setWithModel(model.headlineBodyLink, delegateObject, additionalData)
|
||||
toggle.setWithModel(model.toggle, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return HeadlineBodyTextButton.estimatedHeight(forRow: (molecule as? HeadlineBodyLinkToggleModel)?.headlineBodyLink, delegateObject: delegateObject)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,16 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
stack.reset()
|
||||
stack.stackModel?.spacing = 0
|
||||
eyebrow.styleB3(true)
|
||||
headline.styleB1(true)
|
||||
body.styleB2(true)
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
eyebrow.setWithModel(casteModel?.eyeBrow, delegateObject, additionalData)
|
||||
@ -50,20 +59,6 @@ import UIKit
|
||||
stack.restack()
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
|
||||
guard let json = json, let model = try? Self.decodeJSONToModel(json: json, type: EyebrowHeadlineBodyLinkModel.self) else { return }
|
||||
setWithModel(model, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
stack.reset()
|
||||
stack.stackModel?.spacing = 0
|
||||
eyebrow.styleB3(true)
|
||||
headline.styleB1(true)
|
||||
body.styleB2(true)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 65
|
||||
}
|
||||
|
||||
@ -75,6 +75,7 @@ import Foundation
|
||||
backgroundImageView.reset()
|
||||
}
|
||||
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 320
|
||||
}
|
||||
|
||||
@ -107,29 +107,16 @@ import UIKit
|
||||
defaultState()
|
||||
}
|
||||
|
||||
open override func setAsMolecule() {
|
||||
super.setAsMolecule()
|
||||
|
||||
headlineBody.setAsMolecule()
|
||||
button.setAsMolecule()
|
||||
defaultState()
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 320
|
||||
}
|
||||
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
guard let dictionary = json else { return }
|
||||
|
||||
if let padding = dictionary.optionalCGFloatForKey("buttonHeadlinePadding") {
|
||||
buttonHeadlinePadding = padding
|
||||
}
|
||||
|
||||
headlineBody.setWithJSON(dictionary.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
|
||||
if let buttonDictionary = dictionary.optionalDictionaryForKey("button") {
|
||||
button.setWithJSON(buttonDictionary, delegateObject: delegateObject, additionalData: additionalData)
|
||||
} else {
|
||||
button.isHidden = true
|
||||
}
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadlineBodyButtonModel else { return }
|
||||
buttonHeadlinePadding = model.buttonHeadlinePadding
|
||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
||||
button.setWithModel(model.button, delegateObject, additionalData)
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
//
|
||||
// HeadlineBodyButtonModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct HeadlineBodyButtonModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyButton"
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
public var button: ButtonModel
|
||||
public var buttonHeadlinePadding: CGFloat
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
//
|
||||
// HeadlineBodyLinkModel.swift
|
||||
// MVMCoreUI
|
||||
//
|
||||
// Created by Scott Pfeil on 1/22/20.
|
||||
// Copyright © 2020 Verizon Wireless. All rights reserved.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
|
||||
public struct HeadlineBodyLinkModel: MoleculeModelProtocol {
|
||||
public static var identifier: String = "headlineBodyLink"
|
||||
public var headlineBody: HeadlineBodyModel
|
||||
public var link: LinkModel
|
||||
public var backgroundColor: Color?
|
||||
|
||||
public init(headlineBody: HeadlineBodyModel, link: LinkModel) {
|
||||
self.headlineBody = headlineBody
|
||||
self.link = link
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,10 +8,10 @@
|
||||
|
||||
import UIKit
|
||||
|
||||
@objcMembers public class HeadlineBodyTextButton: ViewConstrainingView {
|
||||
@objcMembers public class HeadlineBodyTextButton: View {
|
||||
|
||||
let headlineBody = HeadlineBody(frame: .zero)
|
||||
let textButton = MFTextButton(nil, constrainHeight: true, forWidth: MVMCoreUIUtility.getWidth())
|
||||
let link = Link()
|
||||
var spaceBetweenConstant: CGFloat = 0.0
|
||||
var spaceBetween: NSLayoutConstraint?
|
||||
|
||||
@ -19,7 +19,7 @@ import UIKit
|
||||
open override func updateView(_ size: CGFloat) {
|
||||
super.updateView(size)
|
||||
headlineBody.updateView(size)
|
||||
textButton.updateView(size)
|
||||
link.updateView(size)
|
||||
setSpacing()
|
||||
}
|
||||
|
||||
@ -28,34 +28,30 @@ import UIKit
|
||||
guard subviews.count == 0 else {
|
||||
return
|
||||
}
|
||||
let view = MVMCoreUICommonViewsUtility.commonView()
|
||||
addSubview(view)
|
||||
pinView(toSuperView: view)
|
||||
|
||||
view.addSubview(headlineBody)
|
||||
view.addSubview(textButton)
|
||||
addSubview(headlineBody)
|
||||
addSubview(link)
|
||||
headlineBody.styleListItem()
|
||||
|
||||
headlineBody.topAnchor.constraint(equalTo: view.topAnchor, constant: 0).isActive = true
|
||||
headlineBody.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
var constraint = view.rightAnchor.constraint(equalTo: headlineBody.rightAnchor)
|
||||
headlineBody.topAnchor.constraint(equalTo: topAnchor, constant: 0).isActive = true
|
||||
headlineBody.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
|
||||
var constraint = rightAnchor.constraint(equalTo: headlineBody.rightAnchor)
|
||||
constraint.priority = .defaultHigh
|
||||
constraint.isActive = true
|
||||
|
||||
spaceBetween = textButton.topAnchor.constraint(equalTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant)
|
||||
spaceBetween = link.topAnchor.constraint(equalTo: headlineBody.bottomAnchor, constant: spaceBetweenConstant)
|
||||
spaceBetween?.isActive = true
|
||||
|
||||
textButton.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true
|
||||
view.bottomAnchor.constraint(equalTo: textButton.bottomAnchor).isActive = true
|
||||
view.rightAnchor.constraint(greaterThanOrEqualTo: textButton.rightAnchor).isActive = true
|
||||
constraint = view.rightAnchor.constraint(equalTo: textButton.rightAnchor)
|
||||
link.leftAnchor.constraint(equalTo: leftAnchor).isActive = true
|
||||
bottomAnchor.constraint(equalTo: link.bottomAnchor).isActive = true
|
||||
rightAnchor.constraint(greaterThanOrEqualTo: link.rightAnchor).isActive = true
|
||||
constraint = rightAnchor.constraint(equalTo: link.rightAnchor)
|
||||
constraint.priority = .defaultHigh
|
||||
constraint.isActive = true
|
||||
}
|
||||
|
||||
// MARK: - Constraining
|
||||
public func setSpacing() {
|
||||
if headlineBody.hasText() && (textButton.titleLabel?.text?.count ?? 0) > 0 {
|
||||
if headlineBody.hasText() && (link.titleLabel?.text?.count ?? 0) > 0 {
|
||||
spaceBetween?.constant = spaceBetweenConstant
|
||||
} else {
|
||||
spaceBetween?.constant = 0
|
||||
@ -63,20 +59,22 @@ import UIKit
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
open override func setWithJSON(_ json: [AnyHashable: Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
|
||||
headlineBody.setWithJSON(json?.optionalDictionaryForKey("headlineBody"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
textButton.setWithJSON(json?.optionalDictionaryForKey("link"), delegateObject: delegateObject, additionalData: additionalData)
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
headlineBody.reset()
|
||||
headlineBody.styleListItem()
|
||||
textButton.reset()
|
||||
link.reset()
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
|
||||
// MARK:- ModelMoleculeViewProtocol
|
||||
open override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let model = model as? HeadlineBodyLinkModel else { return }
|
||||
headlineBody.setWithModel(model.headlineBody, delegateObject, additionalData)
|
||||
link.setWithModel(model.link, delegateObject, additionalData)
|
||||
}
|
||||
|
||||
public override class func estimatedHeight(forRow molecule: MoleculeModelProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||
return 60
|
||||
}
|
||||
}
|
||||
|
||||
@ -83,7 +83,6 @@ open class Carousel: View {
|
||||
}
|
||||
|
||||
// MARK: - MVMCoreUIMoleculeViewProtocol
|
||||
//TODO: Model, Change to model
|
||||
public override func setWithModel(_ model: MoleculeModelProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
||||
super.setWithModel(model, delegateObject, additionalData)
|
||||
guard let carouselModel = model as? CarouselModel else { return }
|
||||
|
||||
@ -47,17 +47,22 @@ import Foundation
|
||||
|
||||
// Horizontal Combination Molecules
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: StringAndMoleculeView.self, viewModelClass: StringAndMoleculeModel.self)
|
||||
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ImageHeadlineBody.self, viewModelClass: ImageHeadlineBodyModel.self)
|
||||
|
||||
// Vertical Combination Molecules
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBody.self, viewModelClass: HeadlineBodyModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadLineBodyCaretLinkImage.self, viewModelClass: HeadlineBodyCaretLinkImageModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: EyebrowHeadlineBodyLink.self, viewModelClass: EyebrowHeadlineBodyLinkModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyTextButton.self, viewModelClass: HeadlineBodyLinkModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyButton.self, viewModelClass: HeadlineBodyButtonModel.self)
|
||||
|
||||
// Left Right Molecules
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: CornerLabels.self, viewModelClass: CornerLabelsModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LeftRightLabelView.self, viewModelClass: LeftRightLabelModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: LabelSwitch.self, viewModelClass: LabelToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodySwitch.self, viewModelClass: HeadlineBodyToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: HeadlineBodyTextButtonSwitch.self, viewModelClass: HeadlineBodyLinkToggleModel.self)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: ActionDetailWithImage.self, viewModelClass: ActionDetailWithImageModel.self)
|
||||
|
||||
// List items
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.register(viewClass: MoleculeTableViewCell.self, viewModelClass: ListItemModel.self)
|
||||
@ -89,12 +94,7 @@ import Foundation
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(CheckboxWithLabelView.self, forKey: "checkboxLabel" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButton.self, forKey: "radioButton" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(RadioButtonLabel.self, forKey: "radioButtonLabel" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(ActionDetailWithImage.self, forKey: "actionDetailWithImage" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(MVMCoreUIPageControl.self, forKey: "barsPager" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(ImageHeadlineBody.self, forKey: "imageHeadlineBody" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(HeadlineBodyTextButton.self, forKey: "headlineBodyLink" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(HeadlineBodyTextButtonSwitch.self, forKey: "headlineBodyLinkToggle" as NSString)
|
||||
MVMCoreUIMoleculeMappingObject.shared()?.moleculeMapping.setObject(HeadlineBodyButton.self, forKey: "headlineBodyButton" as NSString)
|
||||
|
||||
// TODO: Need View
|
||||
ModelRegistry.register(TabsModel.self)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user