Merge branch 'feature/badgeIndicator' into 'develop'
removed padding now working on ratio of pointSize See merge request BPHV_MIPS/vds_ios!82
This commit is contained in:
commit
75698740f4
@ -107,8 +107,6 @@
|
||||
EAC9258C2911C9DE00091998 /* InputField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC925872911C9DE00091998 /* InputField.swift */; };
|
||||
EAC9258F2911C9DE00091998 /* EntryField.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAC9258B2911C9DE00091998 /* EntryField.swift */; };
|
||||
EAD062A72A3B67770015965D /* UIView+CALayer.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD062A62A3B67770015965D /* UIView+CALayer.swift */; };
|
||||
EAD062A92A3B67B10015965D /* NSLayoutAnchor.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD062A82A3B67B10015965D /* NSLayoutAnchor.swift */; };
|
||||
EAD062AB2A3B67D00015965D /* NSLayoutDimension.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD062AA2A3B67D00015965D /* NSLayoutDimension.swift */; };
|
||||
EAD062B02A3B873E0015965D /* BadgeIndicator.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD062AF2A3B873E0015965D /* BadgeIndicator.swift */; };
|
||||
EAD8D2C128BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8D2C028BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift */; };
|
||||
EAF1FE9929D4850E00101452 /* Clickable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAF1FE9829D4850E00101452 /* Clickable.swift */; };
|
||||
@ -242,8 +240,6 @@
|
||||
EAC925872911C9DE00091998 /* InputField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputField.swift; sourceTree = "<group>"; };
|
||||
EAC9258B2911C9DE00091998 /* EntryField.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = EntryField.swift; sourceTree = "<group>"; };
|
||||
EAD062A62A3B67770015965D /* UIView+CALayer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIView+CALayer.swift"; sourceTree = "<group>"; };
|
||||
EAD062A82A3B67B10015965D /* NSLayoutAnchor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSLayoutAnchor.swift; sourceTree = "<group>"; };
|
||||
EAD062AA2A3B67D00015965D /* NSLayoutDimension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = NSLayoutDimension.swift; sourceTree = "<group>"; };
|
||||
EAD062AF2A3B873E0015965D /* BadgeIndicator.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BadgeIndicator.swift; sourceTree = "<group>"; };
|
||||
EAD8D2C028BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIGestureRecognizer+Publisher.swift"; sourceTree = "<group>"; };
|
||||
EAF1FE9829D4850E00101452 /* Clickable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Clickable.swift; sourceTree = "<group>"; };
|
||||
@ -438,8 +434,6 @@
|
||||
EAF7F0992899B17200B287F5 /* CATransaction.swift */,
|
||||
EA33622D2891EA3C0071C351 /* DispatchQueue+Once.swift */,
|
||||
EABFEB632A26473700C4C106 /* NSAttributedString.swift */,
|
||||
EAD062A82A3B67B10015965D /* NSLayoutAnchor.swift */,
|
||||
EAD062AA2A3B67D00015965D /* NSLayoutDimension.swift */,
|
||||
EAB2376529E9952D00AABE9A /* UIApplication.swift */,
|
||||
EA3361A7288B23300071C351 /* UIColor.swift */,
|
||||
EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */,
|
||||
@ -904,7 +898,6 @@
|
||||
EA33624728931B050071C351 /* Initable.swift in Sources */,
|
||||
EAF7F0A4289B017C00B287F5 /* LabelAttributeModel.swift in Sources */,
|
||||
EA5F86D02A1F936100BC83E4 /* TabsContainer.swift in Sources */,
|
||||
EAD062A92A3B67B10015965D /* NSLayoutAnchor.swift in Sources */,
|
||||
EAF7F0B1289B177F00B287F5 /* ColorLabelAttribute.swift in Sources */,
|
||||
EAC9258F2911C9DE00091998 /* EntryField.swift in Sources */,
|
||||
EAB1D2EA28AE84AA00DAE764 /* UIControlPublisher.swift in Sources */,
|
||||
@ -949,7 +942,6 @@
|
||||
EAB2376629E9952D00AABE9A /* UIApplication.swift in Sources */,
|
||||
EAB5FED429267EB300998C17 /* UIView.swift in Sources */,
|
||||
EAB2376829E9992800AABE9A /* TooltipAlertViewController.swift in Sources */,
|
||||
EAD062AB2A3B67D00015965D /* NSLayoutDimension.swift in Sources */,
|
||||
EA33623E2892EE950071C351 /* UIDevice.swift in Sources */,
|
||||
EA985C692971B90B00F2FF2E /* IconSize.swift in Sources */,
|
||||
EA985C672970C21600F2FF2E /* VDSLayout.swift in Sources */,
|
||||
@ -1114,7 +1106,7 @@
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 22;
|
||||
CURRENT_PROJECT_VERSION = 24;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
@ -1147,7 +1139,7 @@
|
||||
buildSettings = {
|
||||
BUILD_LIBRARY_FOR_DISTRIBUTION = YES;
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
CURRENT_PROJECT_VERSION = 22;
|
||||
CURRENT_PROJECT_VERSION = 24;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = "";
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
|
||||
@ -59,7 +59,23 @@ open class BadgeIndicator: View {
|
||||
case medium = "Medium"
|
||||
case small = "Small"
|
||||
|
||||
public var minimumSize: CGFloat {
|
||||
public var inset: CGFloat {
|
||||
return textStyle.pointSize * 0.3333
|
||||
// switch self {
|
||||
// case .xxlarge:
|
||||
// return 8
|
||||
// case .xlarge:
|
||||
// return 6
|
||||
// case .large:
|
||||
// return 6
|
||||
// case .medium:
|
||||
// return 6
|
||||
// case .small:
|
||||
// return 4
|
||||
// }
|
||||
}
|
||||
|
||||
public var lineHeight: CGFloat {
|
||||
switch self {
|
||||
case .xxlarge:
|
||||
return 29
|
||||
@ -73,26 +89,10 @@ open class BadgeIndicator: View {
|
||||
return 16
|
||||
}
|
||||
}
|
||||
|
||||
public var padding: CGFloat {
|
||||
switch self {
|
||||
case .xxlarge:
|
||||
return 8
|
||||
case .xlarge:
|
||||
return 6
|
||||
case .large:
|
||||
return 6
|
||||
case .medium:
|
||||
return 6
|
||||
case .small:
|
||||
return 4
|
||||
}
|
||||
}
|
||||
|
||||
public var textStyle: TextStyle {
|
||||
let style = TextStyle.bodySmall
|
||||
var pointSize: CGFloat = VDSTypography.fontSizeBody12
|
||||
|
||||
switch self {
|
||||
case .xxlarge:
|
||||
pointSize = VDSTypography.fontSizeTitle24
|
||||
@ -110,11 +110,21 @@ open class BadgeIndicator: View {
|
||||
pointSize = VDSTypography.fontSizeBody12
|
||||
|
||||
}
|
||||
// var ratio: CGFloat = 1.3333 // less than 14
|
||||
// if pointSize > 13 && pointSize < 16 {
|
||||
// ratio = 1.28
|
||||
// } else if pointSize > 15 && pointSize < 19 {
|
||||
// ratio = 1.25
|
||||
// } else if pointSize > 19 {
|
||||
// ratio = 1.20
|
||||
// }
|
||||
|
||||
let calculatedLineHeight = pointSize * 1.265//ratio
|
||||
print("lineHeight\noriginal: \(lineHeight)\ncalculated:\(calculatedLineHeight)")
|
||||
return TextStyle(rawValue: "\(self.rawValue)BadgeIndicator",
|
||||
fontFace: style.fontFace,
|
||||
pointSize: pointSize,
|
||||
lineHeight: style.lineHeight,
|
||||
lineHeight: calculatedLineHeight,
|
||||
letterSpacing: style.letterSpacing)
|
||||
}
|
||||
|
||||
@ -257,7 +267,7 @@ open class BadgeIndicator: View {
|
||||
backgroundColor = backgroundColorConfiguration.getColor(self)
|
||||
|
||||
label.useAttributedText = true
|
||||
label.edgeInset = .init(top: 0, left: textSize.padding, bottom: 0, right: textSize.padding)
|
||||
label.edgeInset = .init(top: 0, left: textSize.inset, bottom: 0, right: textSize.inset)
|
||||
label.font = textSize.textStyle.font
|
||||
label.textColor = textColorConfiguration.getColor(self)
|
||||
label.textColorConfiguration = textColorConfiguration.eraseToAnyColorable()
|
||||
@ -298,8 +308,9 @@ open class BadgeIndicator: View {
|
||||
|
||||
open override func layoutSubviews() {
|
||||
super.layoutSubviews()
|
||||
labelWidthConstraint?.constant = textSize.minimumSize
|
||||
labelHeightConstraint?.constant = textSize.minimumSize
|
||||
let size = textSize.textStyle.lineHeight
|
||||
labelWidthConstraint?.constant = size
|
||||
labelHeightConstraint?.constant = size
|
||||
layer.cornerRadius = frame.size.height / 2
|
||||
|
||||
if hideBorder {
|
||||
|
||||
@ -1,58 +0,0 @@
|
||||
//
|
||||
// NSLayoutAnchor.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 6/15/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - NSLayoutAnchor
|
||||
//--------------------------------------------------
|
||||
extension NSLayoutAnchor {
|
||||
// These methods return an inactive constraint of the form thisAnchor = otherAnchor.
|
||||
@discardableResult
|
||||
@objc public func constraint(equalTo anchor: NSLayoutAnchor, identifier: String) -> NSLayoutConstraint {
|
||||
let constraint = self.constraint(equalTo: anchor)
|
||||
constraint.identifier = identifier
|
||||
return constraint
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(greaterThanOrEqualTo anchor: NSLayoutAnchor, identifier: String) -> NSLayoutConstraint {
|
||||
let constraint = self.constraint(greaterThanOrEqualTo: anchor)
|
||||
constraint.identifier = identifier
|
||||
return constraint
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(lessThanOrEqualTo anchor: NSLayoutAnchor, identifier: String) -> NSLayoutConstraint {
|
||||
let constraint = self.constraint(lessThanOrEqualTo: anchor)
|
||||
constraint.identifier = identifier
|
||||
return constraint
|
||||
}
|
||||
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(equalTo anchor: NSLayoutAnchor, constant: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let constraint = self.constraint(equalTo: anchor, constant: constant)
|
||||
constraint.identifier = identifier
|
||||
return constraint
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(greaterThanOrEqualTo anchor: NSLayoutAnchor, constant: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let constraint = self.constraint(greaterThanOrEqualTo: anchor, constant: constant)
|
||||
constraint.identifier = identifier
|
||||
return constraint
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(lessThanOrEqualTo anchor: NSLayoutAnchor, constant: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let constraint = self.constraint(lessThanOrEqualTo: anchor, constant: constant)
|
||||
constraint.identifier = identifier
|
||||
return constraint
|
||||
}
|
||||
}
|
||||
@ -1,84 +0,0 @@
|
||||
//
|
||||
// NSLayoutDimension.swift
|
||||
// VDS
|
||||
//
|
||||
// Created by Matt Bruce on 6/15/23.
|
||||
//
|
||||
|
||||
import Foundation
|
||||
import UIKit
|
||||
|
||||
//--------------------------------------------------
|
||||
// MARK: - NSLayoutDimension
|
||||
//--------------------------------------------------
|
||||
extension NSLayoutDimension {
|
||||
// These methods return an inactive constraint of the form thisVariable = constant.
|
||||
@discardableResult
|
||||
@objc public func constraint(equalToConstant c: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(equalToConstant: c)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(greaterThanOrEqualToConstant c: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(greaterThanOrEqualToConstant: c)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(lessThanOrEqualToConstant c: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(lessThanOrEqualToConstant: c)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
|
||||
// These methods return an inactive constraint of the form thisAnchor = otherAnchor * multiplier.
|
||||
@discardableResult
|
||||
@objc public func constraint(equalTo anchor: NSLayoutDimension, multiplier m: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(equalTo: anchor, multiplier: m)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(greaterThanOrEqualTo anchor: NSLayoutDimension, multiplier m: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(greaterThanOrEqualTo: anchor ,multiplier: m)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(lessThanOrEqualTo anchor: NSLayoutDimension, multiplier m: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(lessThanOrEqualTo: anchor, multiplier: m)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
|
||||
// These methods return an inactive constraint of the form thisAnchor = otherAnchor * multiplier + constant.
|
||||
@discardableResult
|
||||
@objc public func constraint(equalTo anchor: NSLayoutDimension, multiplier m: CGFloat, constant c: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(equalTo: anchor, multiplier: m, constant: c)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(greaterThanOrEqualTo anchor: NSLayoutDimension, multiplier m: CGFloat, constant c: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(greaterThanOrEqualTo: anchor, multiplier: m, constant: c)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
@discardableResult
|
||||
@objc public func constraint(lessThanOrEqualTo anchor: NSLayoutDimension, multiplier m: CGFloat, constant c: CGFloat, identifier: String) -> NSLayoutConstraint {
|
||||
let lc = constraint(lessThanOrEqualTo: anchor, multiplier: m, constant: c)
|
||||
lc.identifier = identifier
|
||||
return lc
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -72,7 +72,7 @@ extension UIView {
|
||||
// MARK: - CALayer
|
||||
//--------------------------------------------------
|
||||
extension CALayer {
|
||||
func remove(layerName: String) {
|
||||
public func remove(layerName: String) {
|
||||
guard let sublayers = sublayers else {
|
||||
return
|
||||
}
|
||||
|
||||
@ -1,3 +1,8 @@
|
||||
1.0.23
|
||||
=======
|
||||
- Added Badge Indicator
|
||||
- Refactored the TextStyle system to support Badge Indicator
|
||||
|
||||
1.0.22
|
||||
=======
|
||||
- CXTDT-423133 - Tabs - Indicator should overlap Border
|
||||
|
||||
Loading…
Reference in New Issue
Block a user