merge line
This commit is contained in:
commit
7630299e69
@ -3,7 +3,7 @@
|
|||||||
archiveVersion = 1;
|
archiveVersion = 1;
|
||||||
classes = {
|
classes = {
|
||||||
};
|
};
|
||||||
objectVersion = 52;
|
objectVersion = 54;
|
||||||
objects = {
|
objects = {
|
||||||
|
|
||||||
/* Begin PBXBuildFile section */
|
/* Begin PBXBuildFile section */
|
||||||
@ -588,6 +588,7 @@
|
|||||||
EAB14BC327D9378D0012AB2C /* RuleAnyModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */; };
|
EAB14BC327D9378D0012AB2C /* RuleAnyModelProtocol.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */; };
|
||||||
EABFC1412763BB8D00E78B40 /* FormLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC1402763BB8D00E78B40 /* FormLabel.swift */; };
|
EABFC1412763BB8D00E78B40 /* FormLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC1402763BB8D00E78B40 /* FormLabel.swift */; };
|
||||||
EABFC152276913E800E78B40 /* FormLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC151276913E800E78B40 /* FormLabelModel.swift */; };
|
EABFC152276913E800E78B40 /* FormLabelModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EABFC151276913E800E78B40 /* FormLabelModel.swift */; };
|
||||||
|
EACCF38C2ABB346700E0F104 /* VDS-Interpreters.swift in Sources */ = {isa = PBXBuildFile; fileRef = EACCF38B2ABB346700E0F104 /* VDS-Interpreters.swift */; };
|
||||||
FD99130028E21E4900542CC3 /* RuleNotEqualsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */; };
|
FD99130028E21E4900542CC3 /* RuleNotEqualsModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */; };
|
||||||
/* End PBXBuildFile section */
|
/* End PBXBuildFile section */
|
||||||
|
|
||||||
@ -1176,6 +1177,7 @@
|
|||||||
EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyModelProtocol.swift; sourceTree = "<group>"; };
|
EAB14BC227D9378D0012AB2C /* RuleAnyModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleAnyModelProtocol.swift; sourceTree = "<group>"; };
|
||||||
EABFC1402763BB8D00E78B40 /* FormLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabel.swift; sourceTree = "<group>"; };
|
EABFC1402763BB8D00E78B40 /* FormLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabel.swift; sourceTree = "<group>"; };
|
||||||
EABFC151276913E800E78B40 /* FormLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabelModel.swift; sourceTree = "<group>"; };
|
EABFC151276913E800E78B40 /* FormLabelModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormLabelModel.swift; sourceTree = "<group>"; };
|
||||||
|
EACCF38B2ABB346700E0F104 /* VDS-Interpreters.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "VDS-Interpreters.swift"; sourceTree = "<group>"; };
|
||||||
FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleNotEqualsModel.swift; sourceTree = "<group>"; };
|
FD9912FF28E21E4900542CC3 /* RuleNotEqualsModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RuleNotEqualsModel.swift; sourceTree = "<group>"; };
|
||||||
/* End PBXFileReference section */
|
/* End PBXFileReference section */
|
||||||
|
|
||||||
@ -2418,6 +2420,7 @@
|
|||||||
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
011B58EE23A2AA850085F53C /* ModelProtocols */,
|
||||||
27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */,
|
27559EFB27D691D3000836C1 /* ViewMaskingProtocol.swift */,
|
||||||
EAA7801F290081320057DFDF /* VDSMoleculeViewProtocol.swift */,
|
EAA7801F290081320057DFDF /* VDSMoleculeViewProtocol.swift */,
|
||||||
|
EACCF38B2ABB346700E0F104 /* VDS-Interpreters.swift */,
|
||||||
);
|
);
|
||||||
path = Protocols;
|
path = Protocols;
|
||||||
sourceTree = "<group>";
|
sourceTree = "<group>";
|
||||||
@ -2976,6 +2979,7 @@
|
|||||||
D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */,
|
D28BA741248025A300B75CB8 /* TabBarModel.swift in Sources */,
|
||||||
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
|
D224798A2314445E003FCCF9 /* LabelToggle.swift in Sources */,
|
||||||
D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */,
|
D2A92882241AAB67004E01C6 /* ScrollingViewController.swift in Sources */,
|
||||||
|
EACCF38C2ABB346700E0F104 /* VDS-Interpreters.swift in Sources */,
|
||||||
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
|
C695A67F23C9830600BFB94E /* UnOrderedListModel.swift in Sources */,
|
||||||
0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */,
|
0AE98BB523FF18D2004C5109 /* Arrow.swift in Sources */,
|
||||||
D2FA83D22513EA6900564112 /* NotificationXButton.swift in Sources */,
|
D2FA83D22513EA6900564112 /* NotificationXButton.swift in Sources */,
|
||||||
|
|||||||
@ -7,116 +7,96 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
@objcMembers open class Line: VDS.Line, VDSMoleculeViewProtocol {
|
||||||
@objcMembers open class Line: View {
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Properties
|
// MARK: - Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
open var viewModel: LineModel!
|
||||||
var lineModel: LineModel? {
|
open var delegateObject: MVMCoreUIDelegateObject?
|
||||||
get { return model as? LineModel }
|
open var additionalData: [AnyHashable : Any]?
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Constraints
|
|
||||||
//--------------------------------------------------
|
|
||||||
|
|
||||||
public var heightConstraint: NSLayoutConstraint?
|
|
||||||
public var widthConstraint: NSLayoutConstraint?
|
|
||||||
|
|
||||||
open func updateLineConstraints(constant: CGFloat) {
|
|
||||||
if let useVerticalLine = lineModel?.useVerticalLine, useVerticalLine {
|
|
||||||
heightConstraint?.isActive = false
|
|
||||||
widthConstraint?.isActive = true
|
|
||||||
widthConstraint?.constant = constant
|
|
||||||
} else {
|
|
||||||
widthConstraint?.isActive = false
|
|
||||||
heightConstraint?.isActive = true
|
|
||||||
heightConstraint?.constant = constant
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
public convenience init(pinTo view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
public convenience init(pinTo view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
||||||
self.init(frame: .zero)
|
self.init(frame: .zero)
|
||||||
addLine(to: view, edge: edge, useMargin: useMargin)
|
addLine(to: view, edge: edge, useMargin: useMargin)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init() {
|
public required init() {
|
||||||
super.init(frame: .zero)
|
super.init()
|
||||||
model = LineModel(type: .secondary)
|
viewModel = LineModel(type: .primary)
|
||||||
setStyle(.secondary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public override init(frame: CGRect) {
|
public override init(frame: CGRect) {
|
||||||
super.init(frame: frame)
|
super.init(frame: frame)
|
||||||
model = LineModel(type: .secondary)
|
viewModel = LineModel(type: .primary)
|
||||||
setStyle(.secondary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init?(coder: NSCoder) {
|
public required init?(coder: NSCoder) {
|
||||||
super.init(coder: coder)
|
super.init(coder: coder)
|
||||||
model = LineModel(type: .secondary)
|
viewModel = LineModel(type: .primary)
|
||||||
setStyle(.secondary)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public required init(model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable : Any]?) {
|
|
||||||
super.init(model: model, delegateObject, additionalData)
|
|
||||||
}
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Methods
|
// MARK: - Methods
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|
||||||
open func setStyle(_ style: LineModel.Style) {
|
|
||||||
lineModel?.type = style
|
|
||||||
backgroundColor = lineModel?.backgroundColor?.uiColor
|
|
||||||
updateLineConstraints(constant: lineModel?.thickness ?? 1)
|
|
||||||
}
|
|
||||||
|
|
||||||
open func shouldBeVisible() -> Bool {
|
open func shouldBeVisible() -> Bool {
|
||||||
guard let type = lineModel?.type else { return false }
|
guard let type = viewModel?.type else { return false }
|
||||||
return type != .none
|
return type != .none
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
open func setStyle(_ style: LineModel.Style) {
|
||||||
// MARK: - MoleculeViewProtocol
|
viewModel.type = style
|
||||||
//--------------------------------------------------
|
update(viewModel: viewModel)
|
||||||
|
}
|
||||||
|
|
||||||
open func addLine(to view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
open func addLine(to view: UIView, edge: UIRectEdge, useMargin: Bool) {
|
||||||
view.addSubview(self)
|
view.addSubview(self)
|
||||||
NSLayoutConstraint.activate(Array(NSLayoutConstraint.pinView(toSuperview: self, useMargins: useMargin, pinTop: edge != .bottom, pinBottom: edge != .top, pinLeft: edge != .right, pinRight: edge != .left).values))
|
NSLayoutConstraint.activate(
|
||||||
|
Array(
|
||||||
|
NSLayoutConstraint.pinView(toSuperview: self,
|
||||||
|
useMargins: useMargin,
|
||||||
|
pinTop: edge != .bottom,
|
||||||
|
pinBottom: edge != .top,
|
||||||
|
pinLeft: edge != .right,
|
||||||
|
pinRight: edge != .left).values
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func setupView() {
|
open override func draw(_ rect: CGRect) {
|
||||||
super.setupView()
|
guard viewModel.type != .none else { return }
|
||||||
heightConstraint = heightAnchor.constraint(equalToConstant: 1)
|
super.draw(rect)
|
||||||
heightConstraint?.isActive = true
|
|
||||||
widthConstraint = widthAnchor.constraint(equalToConstant: 1)
|
|
||||||
widthConstraint?.isActive = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func set(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?, _ additionalData: [AnyHashable: Any]?) {
|
//--------------------------------------------------
|
||||||
super.set(with: model, delegateObject, additionalData)
|
// MARK: - VDSMoleculeViewProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
|
open func viewModelDidUpdate() {
|
||||||
|
surface = viewModel.surface
|
||||||
|
style = VDS.Line.Style(rawValue: viewModel.type.rawValue) ?? .primary
|
||||||
|
orientation = viewModel.orientation
|
||||||
|
}
|
||||||
|
|
||||||
if let lineModel = model as? LineModel {
|
//--------------------------------------------------
|
||||||
setStyle(lineModel.type)
|
// MARK: - MoleculeViewProtocol
|
||||||
}
|
//--------------------------------------------------
|
||||||
|
public func updateView(_ size: CGFloat) {
|
||||||
|
setNeedsDisplay()
|
||||||
}
|
}
|
||||||
|
|
||||||
open override func reset() {
|
public static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
||||||
setStyle(.secondary)
|
return 1
|
||||||
}
|
|
||||||
|
|
||||||
public override static func estimatedHeight(with model: MoleculeModelProtocol, _ delegateObject: MVMCoreUIDelegateObject?) -> CGFloat? {
|
|
||||||
return (model as? LineModel)?.thickness ?? 1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------------------------
|
||||||
|
// MARK: - MVMCoreUIViewConstrainingProtocol
|
||||||
|
//--------------------------------------------------
|
||||||
extension Line: MVMCoreUIViewConstrainingProtocol {
|
extension Line: MVMCoreUIViewConstrainingProtocol {
|
||||||
|
|
||||||
open func needsToBeConstrained() -> Bool {
|
open func needsToBeConstrained() -> Bool {
|
||||||
|
|||||||
@ -8,8 +8,9 @@
|
|||||||
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import VDSColorTokens
|
import VDSColorTokens
|
||||||
|
import VDS
|
||||||
|
|
||||||
@objcMembers public class LineModel: MoleculeModelProtocol {
|
@objcMembers public class LineModel: MoleculeModelProtocol, Invertable {
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Enums
|
// MARK: - Enums
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -28,23 +29,9 @@ import VDSColorTokens
|
|||||||
case between
|
case between
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
The style of the line:
|
|
||||||
- secondary (1 height, silver)
|
|
||||||
- primary (1 height, black)
|
|
||||||
- standard (1 height, silver) - deprecated
|
|
||||||
- thin (1 height, black) - deprecated
|
|
||||||
- medium (2 height, black)
|
|
||||||
- heavy (4 height, black)
|
|
||||||
- none (hidden)
|
|
||||||
*/
|
|
||||||
public enum Style: String, Codable {
|
public enum Style: String, Codable {
|
||||||
case secondary
|
case secondary
|
||||||
case primary
|
case primary
|
||||||
case standard
|
|
||||||
case thin
|
|
||||||
case medium
|
|
||||||
case heavy
|
|
||||||
case none
|
case none
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -54,53 +41,14 @@ import VDSColorTokens
|
|||||||
|
|
||||||
public static var identifier: String = "line"
|
public static var identifier: String = "line"
|
||||||
public var id: String = UUID().uuidString
|
public var id: String = UUID().uuidString
|
||||||
|
public var backgroundColor: Color?
|
||||||
public var type: Style = .secondary
|
|
||||||
|
public var type: Style = .primary
|
||||||
public var frequency: Frequency? = .allExceptTop
|
public var frequency: Frequency? = .allExceptTop
|
||||||
|
|
||||||
//TODO: use color insted of backgroundColor. Needs server changes
|
|
||||||
// public var color: Color?
|
|
||||||
private var _backgroundColor: Color?
|
|
||||||
public var backgroundColor: Color? {
|
|
||||||
get {
|
|
||||||
if let backgroundColor = _backgroundColor { return backgroundColor }
|
|
||||||
if inverted {
|
|
||||||
if type == .secondary || type == .standard { return Color(uiColor: VDSColor.paletteGray20) }
|
|
||||||
return Color(uiColor: VDSColor.elementsPrimaryOndark)
|
|
||||||
}
|
|
||||||
if type == .secondary || type == .standard { return Color(uiColor: VDSColor.paletteGray85) }
|
|
||||||
return Color(uiColor: VDSColor.elementsPrimaryOnlight)
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_backgroundColor = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private var _thickness: CGFloat?
|
|
||||||
public var thickness: CGFloat {
|
|
||||||
get {
|
|
||||||
if let thickness = _thickness { return thickness }
|
|
||||||
switch type {
|
|
||||||
case .heavy:
|
|
||||||
return 4
|
|
||||||
case .medium:
|
|
||||||
return 2
|
|
||||||
case .none:
|
|
||||||
return 0
|
|
||||||
default:
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
}
|
|
||||||
set {
|
|
||||||
_thickness = newValue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public var inverted: Bool = false
|
public var inverted: Bool = false
|
||||||
|
|
||||||
// Use this to show vertical line
|
public var orientation: VDS.Line.Orientation = .horizontal
|
||||||
// Default is false
|
|
||||||
public var useVerticalLine: Bool?
|
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
// MARK: - Initializer
|
// MARK: - Initializer
|
||||||
@ -108,13 +56,10 @@ import VDSColorTokens
|
|||||||
|
|
||||||
public init(type: Style) {
|
public init(type: Style) {
|
||||||
self.type = type
|
self.type = type
|
||||||
self.useVerticalLine = false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(verticalLineOf type: Style, backgroundColor: Color? = nil) {
|
public init(verticalLineOf type: Style, backgroundColor: Color? = nil) {
|
||||||
self.type = type
|
self.type = type
|
||||||
self.backgroundColor = backgroundColor
|
|
||||||
self.useVerticalLine = true
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -125,13 +70,10 @@ import VDSColorTokens
|
|||||||
case id
|
case id
|
||||||
case moleculeName
|
case moleculeName
|
||||||
case type
|
case type
|
||||||
case backgroundColor
|
|
||||||
case backgroundColor_inverted
|
|
||||||
case color
|
|
||||||
case frequency
|
case frequency
|
||||||
case inverted
|
case inverted
|
||||||
case useVerticalLine
|
case useVerticalLine
|
||||||
case thickness
|
case orientation
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
@ -155,9 +97,12 @@ import VDSColorTokens
|
|||||||
self.inverted = inverted
|
self.inverted = inverted
|
||||||
}
|
}
|
||||||
|
|
||||||
backgroundColor = try typeContainer.decodeIfPresent(Color.self, forKey: .backgroundColor)
|
/// adding code to look for the old useVerticalLine or the new orientation
|
||||||
useVerticalLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .useVerticalLine)
|
if let useVerticalLine = try typeContainer.decodeIfPresent(Bool.self, forKey: .useVerticalLine) {
|
||||||
_thickness = try typeContainer.decodeIfPresent(CGFloat.self, forKey: .thickness)
|
orientation = useVerticalLine ? .vertical : .horizontal
|
||||||
|
}else if let orientation = try typeContainer.decodeIfPresent(VDS.Line.Orientation.self, forKey: .orientation) {
|
||||||
|
self.orientation = orientation
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -167,8 +112,6 @@ import VDSColorTokens
|
|||||||
try container.encode(type, forKey: .type)
|
try container.encode(type, forKey: .type)
|
||||||
try container.encode(inverted, forKey: .inverted)
|
try container.encode(inverted, forKey: .inverted)
|
||||||
try container.encodeIfPresent(frequency, forKey: .frequency)
|
try container.encodeIfPresent(frequency, forKey: .frequency)
|
||||||
try container.encodeIfPresent(_backgroundColor, forKey: .backgroundColor)
|
try container.encodeIfPresent(orientation == .vertical, forKey: .useVerticalLine)
|
||||||
try container.encodeIfPresent(useVerticalLine, forKey: .useVerticalLine)
|
|
||||||
try container.encodeIfPresent(_thickness, forKey: .thickness)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -22,3 +22,5 @@ extension VDS.Button.Size: RawRepresentableCodable {
|
|||||||
public static var defaultValue: VDS.Button.Size? { nil }
|
public static var defaultValue: VDS.Button.Size? { nil }
|
||||||
}
|
}
|
||||||
extension TextLink.Size: Codable {}
|
extension TextLink.Size: Codable {}
|
||||||
|
extension VDS.Line.Style: Codable {}
|
||||||
|
extension VDS.Line.Orientation: Codable {}
|
||||||
|
|||||||
@ -42,6 +42,13 @@ import Foundation
|
|||||||
return Stack<StackModel>.createStack(with: [headline, horizontalStack], spacing: 8)
|
return Stack<StackModel>.createStack(with: [headline, horizontalStack], spacing: 8)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
||||||
|
//-------------------------------------------------------
|
||||||
|
// MARK: - Constraints
|
||||||
|
//-------------------------------------------------------
|
||||||
|
public var verticalLine1HeightConstraint: NSLayoutConstraint?
|
||||||
|
public var verticalLine2HeightConstraint: NSLayoutConstraint?
|
||||||
|
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
// MARK: - Lifecycle
|
// MARK: - Lifecycle
|
||||||
//-------------------------------------------------------
|
//-------------------------------------------------------
|
||||||
@ -51,11 +58,10 @@ import Foundation
|
|||||||
body.lineBreakMode = .byTruncatingTail
|
body.lineBreakMode = .byTruncatingTail
|
||||||
body2.lineBreakMode = .byTruncatingTail
|
body2.lineBreakMode = .byTruncatingTail
|
||||||
body3.lineBreakMode = .byTruncatingTail
|
body3.lineBreakMode = .byTruncatingTail
|
||||||
|
|
||||||
verticalLine1.widthConstraint?.isActive = true
|
// setup lines
|
||||||
verticalLine1.backgroundColor = .mvmBlack
|
verticalLine1.orientation = .vertical
|
||||||
verticalLine2.widthConstraint?.isActive = true
|
verticalLine2.orientation = .vertical
|
||||||
verticalLine2.backgroundColor = .mvmBlack
|
|
||||||
|
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
stack.restack()
|
stack.restack()
|
||||||
@ -80,13 +86,13 @@ import Foundation
|
|||||||
}
|
}
|
||||||
|
|
||||||
open func setLineHeight() {
|
open func setLineHeight() {
|
||||||
verticalLine1.heightConstraint?.isActive = false
|
verticalLine1HeightConstraint?.isActive = false
|
||||||
verticalLine1.heightConstraint = verticalLine1.heightAnchor.constraint(equalTo: body2.heightAnchor, multiplier: 1)
|
verticalLine1HeightConstraint = verticalLine1.heightAnchor.constraint(equalTo: body2.heightAnchor, multiplier: 1)
|
||||||
verticalLine1.heightConstraint?.isActive = true
|
verticalLine1HeightConstraint?.isActive = true
|
||||||
|
|
||||||
verticalLine2.heightConstraint?.isActive = false
|
verticalLine2HeightConstraint?.isActive = false
|
||||||
verticalLine2.heightConstraint = verticalLine2.heightAnchor.constraint(equalTo: body3.heightAnchor, multiplier: 1)
|
verticalLine2HeightConstraint = verticalLine2.heightAnchor.constraint(equalTo: body3.heightAnchor, multiplier: 1)
|
||||||
verticalLine2.heightConstraint?.isActive = true
|
verticalLine2HeightConstraint?.isActive = true
|
||||||
}
|
}
|
||||||
|
|
||||||
//----------------------------------------------------
|
//----------------------------------------------------
|
||||||
|
|||||||
@ -102,7 +102,7 @@
|
|||||||
leftHeadline.styleB1(true)
|
leftHeadline.styleB1(true)
|
||||||
leftBody.styleB2(true)
|
leftBody.styleB2(true)
|
||||||
rightLabel.styleB2(true)
|
rightLabel.styleB2(true)
|
||||||
rightBar.setStyle(.medium)
|
rightBar.setStyle(.primary)
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------
|
//------------------------------------------------------
|
||||||
|
|||||||
@ -39,7 +39,7 @@ public class ListProgressBarThinModel: ListItemModel, MoleculeModelProtocol {
|
|||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
|
|
||||||
rightBar.type = .medium
|
rightBar.type = .primary
|
||||||
|
|
||||||
if rightBar.backgroundColor == nil {
|
if rightBar.backgroundColor == nil {
|
||||||
rightBar.backgroundColor = Color(uiColor: .gray)
|
rightBar.backgroundColor = Color(uiColor: .gray)
|
||||||
|
|||||||
@ -44,7 +44,7 @@
|
|||||||
|
|
||||||
override open func setupView() {
|
override open func setupView() {
|
||||||
super.setupView()
|
super.setupView()
|
||||||
bar.setStyle(.heavy)
|
bar.setStyle(.primary)
|
||||||
bar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
bar.widthAnchor.constraint(equalToConstant: 20).isActive = true
|
||||||
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
rightLabel.setContentCompressionResistancePriority(UILayoutPriority(rawValue: 900), for: .horizontal)
|
||||||
addMolecule(stack)
|
addMolecule(stack)
|
||||||
@ -74,7 +74,7 @@
|
|||||||
super.reset()
|
super.reset()
|
||||||
leftLabel.setFontStyle(.BoldBodySmall)
|
leftLabel.setFontStyle(.BoldBodySmall)
|
||||||
rightLabel.setFontStyle(.RegularBodySmall)
|
rightLabel.setFontStyle(.RegularBodySmall)
|
||||||
bar.setStyle(.heavy)
|
bar.setStyle(.primary)
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
|
|||||||
@ -24,7 +24,7 @@ public class ListRightVariableTotalDataModel: ListItemModel, MoleculeModelProtoc
|
|||||||
override public func setDefaults() {
|
override public func setDefaults() {
|
||||||
super.setDefaults()
|
super.setDefaults()
|
||||||
rightLabel.hero = 0
|
rightLabel.hero = 0
|
||||||
bar.type = .heavy
|
bar.type = .primary
|
||||||
|
|
||||||
if bar.backgroundColor == nil {
|
if bar.backgroundColor == nil {
|
||||||
bar.backgroundColor = Color(uiColor: .mvmBlue)
|
bar.backgroundColor = Color(uiColor: .mvmBlue)
|
||||||
|
|||||||
@ -50,7 +50,7 @@ import VDSColorTokens
|
|||||||
setItems(tabs, animated: false)
|
setItems(tabs, animated: false)
|
||||||
selectedItem = tabs[model.selectedTab]
|
selectedItem = tabs[model.selectedTab]
|
||||||
|
|
||||||
guard let lineModel = line.lineModel else { return }
|
guard let lineModel = line.viewModel else { return }
|
||||||
lineModel.inverted = model.style == .dark
|
lineModel.inverted = model.style == .dark
|
||||||
line.set(with: lineModel, delegateObject, additionalData)
|
line.set(with: lineModel, delegateObject, additionalData)
|
||||||
}
|
}
|
||||||
|
|||||||
@ -174,7 +174,7 @@ import VDSColorTokens
|
|||||||
self.additionalData = additionalData
|
self.additionalData = additionalData
|
||||||
selectedIndex = tabsModel?.selectedIndex ?? 0
|
selectedIndex = tabsModel?.selectedIndex ?? 0
|
||||||
selectionLine.backgroundColor = tabsModel?.selectedBarColor.uiColor
|
selectionLine.backgroundColor = tabsModel?.selectedBarColor.uiColor
|
||||||
let lineModel = bottomLine.lineModel ?? LineModel(type: .secondary)
|
let lineModel = bottomLine.viewModel ?? LineModel(type: .secondary)
|
||||||
lineModel.inverted = tabsModel?.style == .dark
|
lineModel.inverted = tabsModel?.style == .dark
|
||||||
bottomLine.set(with: lineModel, delegateObject, additionalData)
|
bottomLine.set(with: lineModel, delegateObject, additionalData)
|
||||||
reloadData()
|
reloadData()
|
||||||
|
|||||||
18
MVMCoreUI/Atomic/Protocols/VDS-Interpreters.swift
Normal file
18
MVMCoreUI/Atomic/Protocols/VDS-Interpreters.swift
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// VDS-Interpreters.swift
|
||||||
|
// MVMCoreUI
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 9/20/23.
|
||||||
|
// Copyright © 2023 Verizon Wireless. All rights reserved.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import VDS
|
||||||
|
|
||||||
|
public protocol Invertable {
|
||||||
|
var inverted: Bool { get set }
|
||||||
|
}
|
||||||
|
|
||||||
|
extension Invertable {
|
||||||
|
public var surface: Surface { return inverted ? .dark : .light }
|
||||||
|
}
|
||||||
@ -28,5 +28,9 @@ extension VDSMoleculeViewProtocol {
|
|||||||
viewModel = castedModel
|
viewModel = castedModel
|
||||||
viewModelDidUpdate()
|
viewModelDidUpdate()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func update(viewModel: ViewModel){
|
||||||
|
set(with: viewModel, delegateObject, additionalData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -84,9 +84,9 @@ public extension UINavigationController {
|
|||||||
|
|
||||||
/// Returns a ShadowImage based on the line property of NavigationItemModelProtocol
|
/// Returns a ShadowImage based on the line property of NavigationItemModelProtocol
|
||||||
func getNavigationBarShadowImage(for navigationItemModel: NavigationItemModelProtocol) -> UIImage? {
|
func getNavigationBarShadowImage(for navigationItemModel: NavigationItemModelProtocol) -> UIImage? {
|
||||||
guard let thickness = navigationItemModel.line?.thickness,
|
guard let model = navigationItemModel.line else { return nil }
|
||||||
let backgroundColor = navigationItemModel.line?.backgroundColor else { return nil }
|
let line = Line(model: model, nil, nil)
|
||||||
return backgroundColor.uiColor.image(CGSize(width: thickness, height: thickness))
|
return line.lineColor.image(CGSize(width: line.lineWidth, height: line.lineWidth))
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convenience function for setting the navigation bar ui
|
/// Convenience function for setting the navigation bar ui
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user