Merge branch 'feature/Line' into 'develop'
Adding line component See merge request BPHV_MIPS/vds_ios!50
This commit is contained in:
commit
5d47f3e188
@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
44604AD729CE196600E62B51 /* Line.swift in Sources */ = {isa = PBXBuildFile; fileRef = 44604AD629CE196600E62B51 /* Line.swift */; };
|
||||
5F21D7BF28DCEB3D003E7CD6 /* Useable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5F21D7BE28DCEB3D003E7CD6 /* Useable.swift */; };
|
||||
5FC35BE328D51405004EBEAC /* Button.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5FC35BE228D51405004EBEAC /* Button.swift */; };
|
||||
EA0FC2C62914222900DF80B4 /* ButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */; };
|
||||
@ -120,6 +121,7 @@
|
||||
/* End PBXContainerItemProxy section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
44604AD629CE196600E62B51 /* Line.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Line.swift; sourceTree = "<group>"; };
|
||||
5F21D7BE28DCEB3D003E7CD6 /* Useable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Useable.swift; sourceTree = "<group>"; };
|
||||
5FC35BE228D51405004EBEAC /* Button.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Button.swift; sourceTree = "<group>"; };
|
||||
EA0FC2C52914222900DF80B4 /* ButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ButtonGroup.swift; sourceTree = "<group>"; };
|
||||
@ -245,6 +247,14 @@
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
44604AD529CE195300E62B51 /* Line */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
44604AD629CE196600E62B51 /* Line.swift */,
|
||||
);
|
||||
path = Line;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
5FC35BE128D513EB004EBEAC /* Button */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
@ -349,6 +359,7 @@
|
||||
EA985BF3296C609E00F2FF2E /* Icon */,
|
||||
EA1F265F28B945070033E859 /* RadioSwatch */,
|
||||
EA3362412892EF700071C351 /* Label */,
|
||||
44604AD529CE195300E62B51 /* Line */,
|
||||
EA89200B28B530F0006B9984 /* RadioBox */,
|
||||
EAF7F11428A1470D00B287F5 /* RadioButton */,
|
||||
EAC925852911C9DE00091998 /* TextFields */,
|
||||
@ -798,6 +809,7 @@
|
||||
EA985C7D297DAED300F2FF2E /* Primitive.swift in Sources */,
|
||||
EAB5FEF829393A7200998C17 /* ButtonGroupConstants.swift in Sources */,
|
||||
EA3361AF288B26310071C351 /* FormFieldable.swift in Sources */,
|
||||
44604AD729CE196600E62B51 /* Line.swift in Sources */,
|
||||
EA5E3058295105A40082B959 /* Tilelet.swift in Sources */,
|
||||
EA5E304E294CC7F00082B959 /* VDSColor.swift in Sources */,
|
||||
EA89201528B56CF4006B9984 /* RadioBoxGroup.swift in Sources */,
|
||||
|
||||
67
VDS/Components/Line/Line.swift
Normal file
67
VDS/Components/Line/Line.swift
Normal file
@ -0,0 +1,67 @@
|
||||
//
|
||||
// Line.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Nadigadda, Sumanth on 24/03/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
import VDSColorTokens
|
||||
|
||||
@objc(VDSLine)
|
||||
public class Line: View {
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Enums
|
||||
//--------------------------------------------------
|
||||
public enum Style: String, CaseIterable {
|
||||
case primary, secondary
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Public Properties
|
||||
//--------------------------------------------------
|
||||
open var lineView = UIView().with {
|
||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||
}
|
||||
|
||||
open var style: Style = .primary { didSet { didChange() } }
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Lifecycle
|
||||
//--------------------------------------------------
|
||||
|
||||
open override func setup() {
|
||||
super.setup()
|
||||
|
||||
addSubview(lineView)
|
||||
lineView.height(1)
|
||||
|
||||
lineView
|
||||
.pinLeading()
|
||||
.pinTrailing()
|
||||
}
|
||||
|
||||
open override func reset() {
|
||||
super.reset()
|
||||
style = .primary
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Configuration
|
||||
//--------------------------------------------------
|
||||
private var lineViewColorConfig: AnyColorable = {
|
||||
let config = KeyedColorConfiguration<Line, Style>(keyPath: \.style)
|
||||
config.setSurfaceColors(VDSColor.elementsPrimaryOnlight, VDSColor.elementsPrimaryOndark, forKey: .primary)
|
||||
config.setSurfaceColors(VDSColor.elementsLowContrastOnLight, VDSColor.elementsLowContrastOnDark, forKey: .secondary)
|
||||
return config.eraseToAnyColorable()
|
||||
}()
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - State
|
||||
//--------------------------------------------------
|
||||
open override func updateView() {
|
||||
lineView.backgroundColor = lineViewColorConfig.getColor(self)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user