refactore first step of TextPosition -> TextAlignment
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
e3f791960a
commit
99340c616e
@ -93,7 +93,7 @@
|
||||
EAA5EEF328F5C909003B3210 /* VDSFormControlsTokens.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = EAA5EEEE28F5C908003B3210 /* VDSFormControlsTokens.xcframework */; };
|
||||
EAB1D29C28A5618900DAE764 /* RadioButtonGroup.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D29B28A5618900DAE764 /* RadioButtonGroup.swift */; };
|
||||
EAB1D2CD28ABE76100DAE764 /* Withable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2CC28ABE76000DAE764 /* Withable.swift */; };
|
||||
EAB1D2CF28ABEF2B00DAE764 /* Typography.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2CE28ABEF2B00DAE764 /* Typography.swift */; };
|
||||
EAB1D2CF28ABEF2B00DAE764 /* Typography+Base.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2CE28ABEF2B00DAE764 /* Typography+Base.swift */; };
|
||||
EAB1D2EA28AE84AA00DAE764 /* UIControlPublisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB1D2E928AE84AA00DAE764 /* UIControlPublisher.swift */; };
|
||||
EAB2375D29E8789100AABE9A /* Tooltip.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB2375C29E8789100AABE9A /* Tooltip.swift */; };
|
||||
EAB2376229E9880400AABE9A /* TrailingTooltipLabel.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB2376129E9880400AABE9A /* TrailingTooltipLabel.swift */; };
|
||||
@ -240,7 +240,7 @@
|
||||
EAA5EEEE28F5C908003B3210 /* VDSFormControlsTokens.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; name = VDSFormControlsTokens.xcframework; path = ../SharedFrameworks/VDSFormControlsTokens.xcframework; sourceTree = "<group>"; };
|
||||
EAB1D29B28A5618900DAE764 /* RadioButtonGroup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RadioButtonGroup.swift; sourceTree = "<group>"; };
|
||||
EAB1D2CC28ABE76000DAE764 /* Withable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Withable.swift; sourceTree = "<group>"; };
|
||||
EAB1D2CE28ABEF2B00DAE764 /* Typography.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Typography.swift; sourceTree = "<group>"; };
|
||||
EAB1D2CE28ABEF2B00DAE764 /* Typography+Base.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Typography+Base.swift"; sourceTree = "<group>"; };
|
||||
EAB1D2E928AE84AA00DAE764 /* UIControlPublisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UIControlPublisher.swift; sourceTree = "<group>"; };
|
||||
EAB2375C29E8789100AABE9A /* Tooltip.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Tooltip.swift; sourceTree = "<group>"; };
|
||||
EAB2376129E9880400AABE9A /* TrailingTooltipLabel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TrailingTooltipLabel.swift; sourceTree = "<group>"; };
|
||||
@ -663,7 +663,7 @@
|
||||
EAB1D2D028ABEF3100DAE764 /* Typography */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
EAB1D2CE28ABEF2B00DAE764 /* Typography.swift */,
|
||||
EAB1D2CE28ABEF2B00DAE764 /* Typography+Base.swift */,
|
||||
EA0D1C402A6AD61C00E5C127 /* Typography+Additional.swift */,
|
||||
EA0D1C3E2A6AD5E200E5C127 /* Typography+ContentSizeCategory.swift */,
|
||||
EA0D1C3C2A6AD57600E5C127 /* Typography+Enums.swift */,
|
||||
@ -965,7 +965,7 @@
|
||||
EAF7F0B9289C139800B287F5 /* ColorConfiguration.swift in Sources */,
|
||||
EA3361BD288B2C760071C351 /* TypeAlias.swift in Sources */,
|
||||
EA471F3A2A95587500CE9E58 /* LayoutConstraintable.swift in Sources */,
|
||||
EAB1D2CF28ABEF2B00DAE764 /* Typography.swift in Sources */,
|
||||
EAB1D2CF28ABEF2B00DAE764 /* Typography+Base.swift in Sources */,
|
||||
EA0D1C3B2A6AD51B00E5C127 /* Typogprahy+Styles.swift in Sources */,
|
||||
EAF7F09A2899B17200B287F5 /* CATransaction.swift in Sources */,
|
||||
EA0D1C3D2A6AD57600E5C127 /* Typography+Enums.swift in Sources */,
|
||||
|
||||
@ -28,13 +28,13 @@ public struct TextStyleLabelAttribute: LabelAttributeModel {
|
||||
public var length: Int
|
||||
public var textStyle: TextStyle
|
||||
public var textColor: UIColor?
|
||||
public var textPosition: TextPosition
|
||||
public var textPosition: TextAlignment
|
||||
public var lineBreakMode: NSLineBreakMode
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - Initializer
|
||||
//--------------------------------------------------
|
||||
public init(location: Int, length: Int, textStyle: TextStyle, textColor: UIColor? = nil, textPosition: TextPosition = .left, lineBreakMode: NSLineBreakMode = .byWordWrapping) {
|
||||
public init(location: Int, length: Int, textStyle: TextStyle, textColor: UIColor? = nil, textPosition: TextAlignment = .left, lineBreakMode: NSLineBreakMode = .byWordWrapping) {
|
||||
self.location = location
|
||||
self.length = length
|
||||
self.textStyle = textStyle
|
||||
@ -68,7 +68,7 @@ public struct TextStyleLabelAttribute: LabelAttributeModel {
|
||||
let paragraph = NSMutableParagraphStyle().with {
|
||||
$0.maximumLineHeight = lineHeight
|
||||
$0.minimumLineHeight = lineHeight
|
||||
$0.alignment = textPosition.textAlignment
|
||||
$0.alignment = textPosition.value
|
||||
$0.lineBreakMode = lineBreakMode
|
||||
}
|
||||
attributedString.removeAttribute(.baselineOffset, range: range)
|
||||
@ -78,7 +78,7 @@ public struct TextStyleLabelAttribute: LabelAttributeModel {
|
||||
|
||||
} else if textPosition != .left {
|
||||
let paragraph = NSMutableParagraphStyle().with {
|
||||
$0.alignment = textPosition.textAlignment
|
||||
$0.alignment = textPosition.value
|
||||
$0.lineBreakMode = lineBreakMode
|
||||
}
|
||||
attributedString.removeAttribute(.paragraphStyle, range: range)
|
||||
|
||||
@ -119,7 +119,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
||||
open var textStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() }}
|
||||
|
||||
/// The alignment of the text within the label.
|
||||
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() }}
|
||||
open var textPosition: TextAlignment = .left { didSet { setNeedsUpdate() }}
|
||||
|
||||
open var userInfo = [String: Primitive]()
|
||||
|
||||
@ -201,7 +201,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
||||
textStyle: textStyle,
|
||||
useScaledFont: useScaledFont,
|
||||
textColor: textColorConfiguration.getColor(self),
|
||||
alignment: textPosition.textAlignment,
|
||||
alignment: textPosition.value,
|
||||
lineBreakMode: lineBreakMode)
|
||||
|
||||
applyAttributes(mutableText)
|
||||
|
||||
@ -69,7 +69,7 @@ extension Tabs {
|
||||
open var size: Tabs.Size = .medium { didSet { setNeedsUpdate() } }
|
||||
|
||||
///Text position left or center
|
||||
open var textPosition: TextPosition = .left { didSet { setNeedsUpdate() } }
|
||||
open var textPosition: TextAlignment = .left { didSet { setNeedsUpdate() } }
|
||||
|
||||
///Sets the Position of the Selected/Hover Border Accent for All Tabs.
|
||||
open var indicatorPosition: Tabs.IndicatorPosition = .bottom { didSet { setNeedsUpdate() } }
|
||||
|
||||
@ -154,7 +154,7 @@ open class Tabs: View {
|
||||
orientation == .horizontal && overflow == .scroll
|
||||
}
|
||||
|
||||
private var textPosition: TextPosition {
|
||||
private var textPosition: TextAlignment {
|
||||
orientation == .horizontal && fillContainer ? .center : .left
|
||||
}
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ open class TitleLockup: View {
|
||||
public enum TextPosition: String, EnumSubset {
|
||||
case left, center
|
||||
|
||||
public var defaultValue: VDS.TextPosition { .left }
|
||||
public var defaultValue: VDS.TextAlignment { .left }
|
||||
}
|
||||
|
||||
//--------------------------------------------------
|
||||
|
||||
@ -50,7 +50,7 @@ open class TrailingTooltipLabel: View, TooltipLaunchable {
|
||||
open var labelTextStyle: TextStyle = .defaultStyle { didSet { setNeedsUpdate() } }
|
||||
|
||||
/// Text position used to render the label.
|
||||
open var labelTextPosition: TextPosition = .left { didSet { setNeedsUpdate() } }
|
||||
open var labelTextPosition: TextAlignment = .left { didSet { setNeedsUpdate() } }
|
||||
|
||||
/// Color configuration set for the label.
|
||||
public lazy var textColorConfiguration: AnyColorable = {
|
||||
|
||||
@ -13,7 +13,7 @@ import VDSTypographyTokens
|
||||
extension TextStyle {
|
||||
|
||||
/// Alignments Available for the TextStyle
|
||||
public var aligments: [TextPosition] {
|
||||
public var aligments: [TextAlignment] {
|
||||
return [.left, .center]
|
||||
}
|
||||
}
|
||||
|
||||
@ -77,10 +77,10 @@ extension TextStyle {
|
||||
}
|
||||
|
||||
/// Enum used to describe the alignment of text.
|
||||
public enum TextPosition: String, CaseIterable {
|
||||
public enum TextAlignment: String, CaseIterable {
|
||||
case left, right, center
|
||||
|
||||
var textAlignment: NSTextAlignment {
|
||||
var value: NSTextAlignment {
|
||||
switch self {
|
||||
case .left:
|
||||
return NSTextAlignment.left
|
||||
|
||||
Loading…
Reference in New Issue
Block a user