add caret view model and dash line model

This commit is contained in:
panxi 2019-11-20 15:30:42 -05:00
parent 5fd74b695f
commit dde5f1d1a4
6 changed files with 86 additions and 2 deletions

View File

@ -48,6 +48,8 @@
943784F6236B77BB006A1E82 /* GraphViewAnimationHandler.swift in Sources */ = {isa = PBXBuildFile; fileRef = 943784F4236B77BB006A1E82 /* GraphViewAnimationHandler.swift */; };
9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445890B2385BCE300DE9FD4 /* ProgressBarModel.swift */; };
9445890E2385C3F800DE9FD4 /* MultiProgressModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445890D2385C3F800DE9FD4 /* MultiProgressModel.swift */; };
9445891F2385D2E900DE9FD4 /* CaretViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9445891E2385D2E900DE9FD4 /* CaretViewModel.swift */; };
944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 944589202385D6E900DE9FD4 /* DashLineModel.swift */; };
9455B19C234F8A0400A574DB /* MVMAnimationFramework.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */; };
946EE1BA237B66D80036751F /* ModelHelper.swift in Sources */ = {isa = PBXBuildFile; fileRef = 946EE1B9237B66D80036751F /* ModelHelper.swift */; };
948DB67E2326DCD90011F916 /* MultiProgress.swift in Sources */ = {isa = PBXBuildFile; fileRef = 948DB67D2326DCD90011F916 /* MultiProgress.swift */; };
@ -264,6 +266,8 @@
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>"; };
9445890D2385C3F800DE9FD4 /* MultiProgressModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgressModel.swift; sourceTree = "<group>"; };
9445891E2385D2E900DE9FD4 /* CaretViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CaretViewModel.swift; sourceTree = "<group>"; };
944589202385D6E900DE9FD4 /* DashLineModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashLineModel.swift; sourceTree = "<group>"; };
9455B19B234F8A0400A574DB /* MVMAnimationFramework.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MVMAnimationFramework.framework; path = ../SharedFrameworks/MVMAnimationFramework.framework; sourceTree = "<group>"; };
946EE1B9237B66D80036751F /* ModelHelper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ModelHelper.swift; sourceTree = "<group>"; };
948DB67D2326DCD90011F916 /* MultiProgress.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MultiProgress.swift; sourceTree = "<group>"; };
@ -800,7 +804,9 @@
948DB67D2326DCD90011F916 /* MultiProgress.swift */,
9445890D2385C3F800DE9FD4 /* MultiProgressModel.swift */,
DBC4391622442196001AB423 /* CaretView.swift */,
9445891E2385D2E900DE9FD4 /* CaretViewModel.swift */,
DBC4391722442197001AB423 /* DashLine.swift */,
944589202385D6E900DE9FD4 /* DashLineModel.swift */,
DB06250A2293456500B72DD3 /* LeftRightLabelView.swift */,
D29DF17E21E69E2E003B2FB9 /* MFView.h */,
D29DF17F21E69E2E003B2FB9 /* MFView.m */,
@ -1151,6 +1157,7 @@
017BEB442362192F0024EF95 /* MVMCoreUIMoleculeMappingObject+ModelExtension.swift in Sources */,
9445890C2385BCE300DE9FD4 /* ProgressBarModel.swift in Sources */,
D29DF17C21E69E1F003B2FB9 /* MFTextButton.m in Sources */,
9445891F2385D2E900DE9FD4 /* CaretViewModel.swift in Sources */,
D29DF2C521E7BF57003B2FB9 /* MFTabBarSwipeAnimator.m in Sources */,
D29DF2B421E7B76D003B2FB9 /* MFLoadingSpinner.m in Sources */,
01EB369423609801006832FA /* HeadlineBodyModel.swift in Sources */,
@ -1200,6 +1207,7 @@
D29DF2BF21E7BEA4003B2FB9 /* MVMCoreUITabBarPageControlViewController.m in Sources */,
D29DF28321E7AB24003B2FB9 /* MVMCoreUICommonViewsUtility.m in Sources */,
D206997821FB8A0B00CAE0DE /* MVMCoreUINavigationController.m in Sources */,
944589212385D6E900DE9FD4 /* DashLineModel.swift in Sources */,
D29DF27A21E7A533003B2FB9 /* MVMCoreUISession.m in Sources */,
01DF55E021F8FAA800CC099B /* MFTextFieldListView.swift in Sources */,
D2A5146B2214905000345BFB /* ThreeLayerViewController.swift in Sources */,

View File

@ -8,7 +8,8 @@
//
open class CaretView: MFView {
open class CaretView: MFView, ModelMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
@ -132,4 +133,25 @@ open class CaretView: MFView {
open override func alignment() -> UIStackView.Alignment {
return UIStackView.Alignment.leading;
}
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
guard let caretModel = model as? CaretViewModel else {
return
}
if let strokeColorHex = caretModel.strokeColor {
strokeColor = UIColor.mfGet(forHex: strokeColorHex)
}
if let isHiddenValue = caretModel.isHidden {
isHidden = isHiddenValue
}
if let isOpaqueValue = caretModel.isOpaque {
isOpaque = isOpaqueValue
}
if let lineWidthValue = caretModel.lineWidth {
lineWidth = lineWidthValue
}
}
}

View File

@ -0,0 +1,19 @@
//
// CaretViewModel.swift
// MVMCoreUI
//
// Created by Ryan on 11/20/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers public class CaretViewModel: MoleculeProtocol {
public static var identifier: String = "caretView"
public var moleculeName: String
public var strokeColor: String?
public var isHidden: Bool?
public var isOpaque: Bool?
public var lineWidth: CGFloat?
}

View File

@ -10,12 +10,13 @@
import MVMCore
open class DashLine: MFView {
open class DashLine: MFView, ModelMoleculeViewProtocol {
//------------------------------------------------------
// MARK: - Properties
//------------------------------------------------------
@objc public var dashColor: UIColor?
@objc public var dashLayer: CAShapeLayer?
//------------------------------------------------------
// MARK: - Lifecycle
@ -55,6 +56,7 @@ open class DashLine: MFView {
dashLayer.strokeColor = dashColor?.cgColor ?? UIColor.mfLighterGray().cgColor
dashLayer.fillColor = UIColor.clear.cgColor
dashLayer.backgroundColor = backgroundColor?.cgColor ?? UIColor.white.cgColor
self.dashLayer = dashLayer
}
//------------------------------------------------------
@ -82,4 +84,17 @@ open class DashLine: MFView {
dashColor = UIColor.mfGet(forHex: dashColorHex)
}
}
public func setWithModel(_ model: MoleculeProtocol?, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [String : AnyHashable]?) {
guard let dashLineModel = model as? DashLineModel else {
return
}
dashColor = UIColor.mfGet(forHex: dashLineModel.dashColor)
if let isHiddenValue = dashLineModel.isHidden {
isHidden = isHiddenValue
}
if let backgroundColor = dashLineModel.backgroundColor {
dashLayer?.backgroundColor = UIColor.mfGet(forHex: backgroundColor).cgColor
}
}
}

View File

@ -0,0 +1,18 @@
//
// DashLineModel.swift
// MVMCoreUI
//
// Created by Ryan on 11/20/19.
// Copyright © 2019 Verizon Wireless. All rights reserved.
//
import Foundation
@objcMembers public class DashLineModel: MoleculeProtocol {
public static var identifier: String = "dashLine"
public var moleculeName: String
public var dashColor: String
public var isHidden: Bool?
public var backgroundColor: String?
}

View File

@ -20,5 +20,7 @@ import Foundation
ModelRegistry.register(LineModel.self)
ModelRegistry.register(ProgressBarModel.self)
ModelRegistry.register(MultiProgressBarModel.self)
ModelRegistry.register(CaretViewModel.self)
ModelRegistry.register(DashLineModel.self)
}
}