change from viewconstrainingview to view

This commit is contained in:
panxi 2019-12-12 15:28:47 -05:00
parent 9a4a5139ed
commit 8d811f229f
14 changed files with 92 additions and 17 deletions

View File

@ -63,6 +63,7 @@
0A7BAD74232A8DC700FB8E22 /* HeadlineBodyButton.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAD73232A8DC700FB8E22 /* HeadlineBodyButton.swift */; };
0A7BAFA1232BE61800FB8E22 /* Checkbox.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */; };
0AA33B34239813C50067DD0F /* UIColor+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0AA33B33239813C50067DD0F /* UIColor+Extension.swift */; };
9402C35023A2CEA3004B974C /* LeftRightLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */; };
943784F5236B77BB006A1E82 /* GraphView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F3236B77BB006A1E82 /* GraphView.swift */; };
943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */; };
9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445890B2385BCE300DE9FD4 /* ProgressBarModel.swift */; };
@ -311,6 +312,7 @@
0A7BAFA0232BE61800FB8E22 /* Checkbox.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Checkbox.swift; sourceTree = "<group>"; };
0A7BAFA2232BE63400FB8E22 /* CheckboxWithLabelView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CheckboxWithLabelView.swift; sourceTree = "<group>"; };
0AA33B33239813C50067DD0F /* UIColor+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIColor+Extension.swift"; sourceTree = "<group>"; };
9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LeftRightLabelModel.swift; sourceTree = "<group>"; };
943784F3236B77BB006A1E82 /* GraphView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphView.swift; sourceTree = "<group>"; };
943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GraphViewAnimationHandler.swift; sourceTree = "<group>"; };
9445890B2385BCE300DE9FD4 /* ProgressBarModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ProgressBarModel.swift; sourceTree = "<group>"; };
@ -949,6 +951,7 @@
DBC4391722442197001AB423 /* DashLine.swift */,
944589202385D6E900DE9FD4 /* DashLineModel.swift */,
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */,
9402C34F23A2CEA3004B974C /* LeftRightLabelModel.swift */,
012CA99D2385A2D3003F810F /* MFView+ModelExtension.swift */,
D29DF28721E7AC2B003B2FB9 /* ViewConstrainingView.h */,
D29DF28821E7AC2B003B2FB9 /* ViewConstrainingView.m */,
@ -1268,6 +1271,7 @@
files = (
943784F5236B77BB006A1E82 /* GraphView.swift in Sources */,
012CA9E423888B1B003F810F /* ThreeLayerPageTemplateModel.swift in Sources */,
9402C35023A2CEA3004B974C /* LeftRightLabelModel.swift in Sources */,
D29DF32121ED0CBA003B2FB9 /* LabelView.m in Sources */,
DBC4391822442197001AB423 /* CaretView.swift in Sources */,
D29770F221F7C6D600B2F0D0 /* TopLabelsAndBottomButtonsTableViewController.m in Sources */,

View File

@ -125,7 +125,9 @@ open class CaretView: View {
}
}
//MARK: - MVMCoreMoleculeViewProtocol
override public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
super.setWithModel(model, delegateObject, additionalData)
guard let caretModel = model as? CaretViewModel else {
return
}

View File

@ -10,7 +10,9 @@ import Foundation
@objcMembers public class CaretViewModel: MoleculeProtocol {
public static var identifier: String = "caretView"
public static var identifier: String {
get{ return "caretView" }
}
public var backgroundColor: String?
public var strokeColor: String?

View File

@ -84,7 +84,9 @@ open class DashLine: View {
}
}
//MARK: - MVMCoreMoleculeViewProtocol
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
super.setWithModel(model, delegateObject, additionalData)
guard let dashLineModel = model as? DashLineModel else {
return
}

View File

@ -9,10 +9,12 @@
import Foundation
@objcMembers public class DashLineModel: MoleculeProtocol {
public static var identifier: String = "dashLine"
public var moleculeName: String
public static var identifier: String {
get { return "dashLine" }
}
public var moleculeName: String = ""
public var backgroundColor: String?
public var dashColor: String
public var dashColor: String = ""
public var isHidden: Bool?
}

View File

@ -0,0 +1,19 @@
//
// LeftRightLabelModel.swift
// MVMCoreUI
//
// Created by Ryan on 12/12/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import UIKit
@objcMembers public class LeftRightLabelModel: MoleculeProtocol {
public var backgroundColor: String?
public var leftText: LabelModel
public var rightText: LabelModel
public static var identifier: String {
get{ return "leftRightLabel" }
}
}

View File

@ -9,7 +9,7 @@
import Foundation
@objcMembers open class LeftRightLabelView: ViewConstrainingView {
@objcMembers open class LeftRightLabelView: View {
//------------------------------------------------------
// MARK: - Outlets
//------------------------------------------------------
@ -28,7 +28,7 @@ import Foundation
// MARK: - Initialization
//------------------------------------------------------
public init() {
public override init() {
super.init(frame: .zero)
}
@ -176,4 +176,20 @@ import Foundation
constrainLeftLabel()
}
}
//MARK: - MVMCoreMoleculeViewProtocol
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
super.setWithModel(model, delegateObject, additionalData)
guard let leftRightLabelModel = model as? LeftRightLabelModel else {
return
}
leftTextLabel.setWithModel(leftRightLabelModel.leftText, delegateObject, additionalData)
rightTextLabel.setWithModel(leftRightLabelModel.rightText, delegateObject, additionalData)
if !leftTextLabel.hasText {
constrainRightLabel()
} else if !rightTextLabel.hasText {
constrainLeftLabel()
}
}
}

View File

@ -8,7 +8,7 @@
import UIKit
@objcMembers open class MultiProgress: ViewConstrainingView, ModelMoleculeViewProtocol {
@objcMembers open class MultiProgress: View {
///passing value to progressList creates corresponding progress bars
var progressList: Array<SingleProgressBarModel>? {
@ -60,7 +60,9 @@ import UIKit
}
}
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
//MARK: - MVMCoreMoleculeViewProtocol
public override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
super.setWithModel(model, delegateObject, additionalData)
guard let multiProgressModel = model as? MultiProgressBarModel else {
return
}

View File

@ -15,7 +15,9 @@ import Foundation
}
@objcMembers public class MultiProgressBarModel: MoleculeProtocol {
public static var identifier: String = "multiProgressBar"
public static var identifier: String {
get{ return "multiProgressBar"}
}
public var moleculeName: String
public var backgroundColor: String?
public var progressList: [SingleProgressBarModel]

View File

@ -50,13 +50,14 @@ import Foundation
public func updateView(_ size: CGFloat) {
}
//MARK: - MVMCoreMoleculeViewProtocol
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String: AnyHashable]?) {
guard let progressBarModel = model as? ProgressBarModel else {
return
}
isRounded = progressBarModel.isRounded ?? false
thickness = progressBarModel.thickness ?? 8
progress = (progressBarModel.percentage ?? 0)/100.0
progress = (progressBarModel.percentage )/100.0
if let progressColor = progressBarModel.progressColor {
progressTintColor = UIColor.mfGet(forHex: progressColor)
}

View File

@ -9,7 +9,9 @@
import Foundation
@objcMembers public class ProgressBarModel: MoleculeProtocol {
public static var identifier: String = "progressbar"
public static var identifier: String {
get { return "progressbar" }
}
public var moleculeName: String
public var isRounded: Bool?

View File

@ -8,8 +8,9 @@
import UIKit
public class Control: UIControl {
public class Control: UIControl, ModelMoleculeViewProtocol {
var json: [AnyHashable: Any]?
public var model: MoleculeProtocol?
private var initialSetupPerformed = false
@ -34,6 +35,10 @@ public class Control: UIControl {
setupView()
}
}
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
self.model = model
}
}
extension Control: MVMCoreViewProtocol {

View File

@ -8,7 +8,7 @@
import UIKit
@objcMembers open class HeadlineBodySwitch: ViewConstrainingView {
@objcMembers open class HeadlineBodySwitch: View {
public let headlineBody = HeadlineBody(frame: .zero)
public let mvmSwitch = MVMCoreUISwitch.mvmSwitchDefault()
@ -27,13 +27,27 @@ import UIKit
headlineBody.styleListItem()
let view = MVMCoreUICommonViewsUtility.commonView()
addSubview(view)
pinView(toSuperView: view)
NSLayoutConstraint.constraintPinSubview(toSuperview: view)
view.addSubview(headlineBody)
view.addSubview(mvmSwitch)
NSLayoutConstraint.pinSubviewsCenter(leftView: headlineBody, rightView: mvmSwitch)
}
//MARK: - MVMCoreMoleculeViewProtocol
open override func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
super.setWithModel(model, delegateObject, additionalData)
// guard let headlineModel = model as? headlinebodyswitch
// headlineBody.setWithModel(mode, <#T##delegateObject: MVMCoreUIDelegateObject?##MVMCoreUIDelegateObject?#>, <#T##additionalData: [String : AnyHashable]?##[String : AnyHashable]?#>)
}
public static func estimatedHeight(forRow molecule: MoleculeProtocol?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
return 30
}
// MARK: - MVMCoreUIMoleculeViewProtocol
open override func setWithJSON(_ json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?, additionalData: [AnyHashable : Any]?) {
super.setWithJSON(json, delegateObject: delegateObject, additionalData: additionalData)
@ -41,12 +55,11 @@ import UIKit
mvmSwitch.setWithJSON(json?.optionalDictionaryForKey("switch"), delegateObject: delegateObject, additionalData: additionalData)
}
open override class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
open class func estimatedHeight(forRow json: [AnyHashable : Any]?, delegateObject: MVMCoreUIDelegateObject?) -> CGFloat {
return 30
}
open override func setAsMolecule() {
super.setAsMolecule()
open func setAsMolecule() {
headlineBody.setAsMolecule()
(mvmSwitch as MVMCoreUIMoleculeViewProtocol).setAsMolecule?()
headlineBody.styleListItem()

View File

@ -24,12 +24,15 @@ import Foundation
ModelRegistry.register(CaretViewModel.self)
ModelRegistry.register(DashLineModel.self)
ModelRegistry.register(ImageViewModel.self)
//need to move labelattributemodel to different method
ModelRegistry.register(LabelAttributeFontModel.self)
ModelRegistry.register(LabelAttributeColorModel.self)
ModelRegistry.register(LabelAttributeImageModel.self)
ModelRegistry.register(LabelAttributeUnderlineModel.self)
ModelRegistry.register(LabelAttributeStrikeThroughModel.self)
ModelRegistry.register(LabelAttributeActionModel.self)
//
ModelRegistry.register(ModuleMoleculeModel.self)
ModelRegistry.register(LeftRightLabelModel.self)
}
}