Merge branch 'develop' of https://gitlab.verizon.com/BPHV_MIPS/vds_ios into vasavk/breadcrumbs
This commit is contained in:
commit
8c3e8f1b7a
@ -136,6 +136,7 @@
|
|||||||
EAD068922A560B65002E3A2D /* LoaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD068912A560B65002E3A2D /* LoaderViewController.swift */; };
|
EAD068922A560B65002E3A2D /* LoaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD068912A560B65002E3A2D /* LoaderViewController.swift */; };
|
||||||
EAD068942A560C13002E3A2D /* LoaderLaunchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD068932A560C13002E3A2D /* LoaderLaunchable.swift */; };
|
EAD068942A560C13002E3A2D /* LoaderLaunchable.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD068932A560C13002E3A2D /* LoaderLaunchable.swift */; };
|
||||||
EAD8D2C128BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8D2C028BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift */; };
|
EAD8D2C128BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD8D2C028BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift */; };
|
||||||
|
EAE785312BA0A438009428EA /* UIImage+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAE785302BA0A438009428EA /* UIImage+Helper.swift */; };
|
||||||
EAEEEC922B1F807300531FC2 /* BadgeChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC912B1F807300531FC2 /* BadgeChangeLog.txt */; };
|
EAEEEC922B1F807300531FC2 /* BadgeChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC912B1F807300531FC2 /* BadgeChangeLog.txt */; };
|
||||||
EAEEEC962B1F893B00531FC2 /* ButtonChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC952B1F893B00531FC2 /* ButtonChangeLog.txt */; };
|
EAEEEC962B1F893B00531FC2 /* ButtonChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC952B1F893B00531FC2 /* ButtonChangeLog.txt */; };
|
||||||
EAEEEC982B1F8DD100531FC2 /* LineChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC972B1F8DD100531FC2 /* LineChangeLog.txt */; };
|
EAEEEC982B1F8DD100531FC2 /* LineChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC972B1F8DD100531FC2 /* LineChangeLog.txt */; };
|
||||||
@ -311,6 +312,7 @@
|
|||||||
EAD068912A560B65002E3A2D /* LoaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoaderViewController.swift; sourceTree = "<group>"; };
|
EAD068912A560B65002E3A2D /* LoaderViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoaderViewController.swift; sourceTree = "<group>"; };
|
||||||
EAD068932A560C13002E3A2D /* LoaderLaunchable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoaderLaunchable.swift; sourceTree = "<group>"; };
|
EAD068932A560C13002E3A2D /* LoaderLaunchable.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoaderLaunchable.swift; sourceTree = "<group>"; };
|
||||||
EAD8D2C028BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIGestureRecognizer+Publisher.swift"; sourceTree = "<group>"; };
|
EAD8D2C028BFDE8B006EB6A6 /* UIGestureRecognizer+Publisher.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIGestureRecognizer+Publisher.swift"; sourceTree = "<group>"; };
|
||||||
|
EAE785302BA0A438009428EA /* UIImage+Helper.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "UIImage+Helper.swift"; sourceTree = "<group>"; };
|
||||||
EAEEEC912B1F807300531FC2 /* BadgeChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = BadgeChangeLog.txt; sourceTree = "<group>"; };
|
EAEEEC912B1F807300531FC2 /* BadgeChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = BadgeChangeLog.txt; sourceTree = "<group>"; };
|
||||||
EAEEEC952B1F893B00531FC2 /* ButtonChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ButtonChangeLog.txt; sourceTree = "<group>"; };
|
EAEEEC952B1F893B00531FC2 /* ButtonChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ButtonChangeLog.txt; sourceTree = "<group>"; };
|
||||||
EAEEEC972B1F8DD100531FC2 /* LineChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LineChangeLog.txt; sourceTree = "<group>"; };
|
EAEEEC972B1F8DD100531FC2 /* LineChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LineChangeLog.txt; sourceTree = "<group>"; };
|
||||||
@ -556,6 +558,7 @@
|
|||||||
EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */,
|
EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */,
|
||||||
EA33623D2892EE950071C351 /* UIDevice.swift */,
|
EA33623D2892EE950071C351 /* UIDevice.swift */,
|
||||||
EA0B18092AA78F9000F2D0CD /* UIEdgeInsets.swift */,
|
EA0B18092AA78F9000F2D0CD /* UIEdgeInsets.swift */,
|
||||||
|
EAE785302BA0A438009428EA /* UIImage+Helper.swift */,
|
||||||
EAF7F0B6289C12A600B287F5 /* UITapGestureRecognizer.swift */,
|
EAF7F0B6289C12A600B287F5 /* UITapGestureRecognizer.swift */,
|
||||||
EA8E40902A7D3F6300934ED3 /* UIView+Accessibility.swift */,
|
EA8E40902A7D3F6300934ED3 /* UIView+Accessibility.swift */,
|
||||||
EAB5FED329267EB300998C17 /* UIView+NSLayoutConstraint.swift */,
|
EAB5FED329267EB300998C17 /* UIView+NSLayoutConstraint.swift */,
|
||||||
@ -1049,6 +1052,7 @@
|
|||||||
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
|
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
|
||||||
EA0D1C412A6AD61C00E5C127 /* Typography+Additional.swift in Sources */,
|
EA0D1C412A6AD61C00E5C127 /* Typography+Additional.swift in Sources */,
|
||||||
EAC925842911C63100091998 /* Colorable.swift in Sources */,
|
EAC925842911C63100091998 /* Colorable.swift in Sources */,
|
||||||
|
EAE785312BA0A438009428EA /* UIImage+Helper.swift in Sources */,
|
||||||
EAB5FEF5292D371F00998C17 /* ButtonBase.swift in Sources */,
|
EAB5FEF5292D371F00998C17 /* ButtonBase.swift in Sources */,
|
||||||
EA978EC5291D6AFE00ACC883 /* AnyLabelAttribute.swift in Sources */,
|
EA978EC5291D6AFE00ACC883 /* AnyLabelAttribute.swift in Sources */,
|
||||||
EAC71A1F2A2E173D00E47A9F /* RadioButton.swift in Sources */,
|
EAC71A1F2A2E173D00E47A9F /* RadioButton.swift in Sources */,
|
||||||
|
|||||||
@ -44,7 +44,7 @@ open class Icon: View {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// UIImageView used to render the icon.
|
/// UIImageView used to render the icon.
|
||||||
open var imageView = UIImageView().with {
|
open var imageView = UIImageView().with {
|
||||||
$0.isAccessibilityElement = false
|
$0.isAccessibilityElement = false
|
||||||
$0.translatesAutoresizingMaskIntoConstraints = false
|
$0.translatesAutoresizingMaskIntoConstraints = false
|
||||||
$0.contentMode = .scaleAspectFill
|
$0.contentMode = .scaleAspectFill
|
||||||
$0.clipsToBounds = true
|
$0.clipsToBounds = true
|
||||||
@ -109,8 +109,8 @@ open class Icon: View {
|
|||||||
|
|
||||||
//get the image name
|
//get the image name
|
||||||
//set the image
|
//set the image
|
||||||
if let name, let image = getImage(for: name.rawValue) {
|
if let name, let image = UIImage.image(for: name, color: imageColor) {
|
||||||
setImage(image: image, imageColor: imageColor)
|
imageView.image = image
|
||||||
} else {
|
} else {
|
||||||
imageView.image = nil
|
imageView.image = nil
|
||||||
}
|
}
|
||||||
@ -129,17 +129,17 @@ open class Icon: View {
|
|||||||
super.updateAccessibility()
|
super.updateAccessibility()
|
||||||
accessibilityLabel = name?.rawValue ?? "icon"
|
accessibilityLabel = name?.rawValue ?? "icon"
|
||||||
}
|
}
|
||||||
|
|
||||||
//--------------------------------------------------
|
|
||||||
// MARK: - Private Methods
|
|
||||||
//--------------------------------------------------
|
|
||||||
private func getImage(for imageName: String) -> UIImage? {
|
|
||||||
|
|
||||||
return BundleManager.shared.image(for: imageName)
|
|
||||||
}
|
|
||||||
|
|
||||||
private func setImage(image: UIImage, imageColor: UIColor) {
|
|
||||||
imageView.image = image.withTintColor(imageColor)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extension UIImage {
|
||||||
|
|
||||||
|
/// UIImage helper for finding images based on the Icon.Name which uses the internal BundleManager.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - name: Icon.Name rawRepresentable.
|
||||||
|
/// - color: Color to Tint the image with
|
||||||
|
/// - renderingMode: UIImage Rendering mode.
|
||||||
|
/// - Returns: UIImage for this proecess
|
||||||
|
public static func image(for iconName: Icon.Name, color: UIColor? = nil, renderingMode: UIImage.RenderingMode = .alwaysOriginal) -> UIImage? {
|
||||||
|
image(representing: iconName, color: color, renderingMode: renderingMode)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@ -108,14 +108,14 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
// MARK: - Public Properties
|
// MARK: - Public Properties
|
||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
/// Key of whether or not updateView() is called in setNeedsUpdate()
|
||||||
open var shouldUpdateView: Bool = true
|
open var shouldUpdateView: Bool = true
|
||||||
|
|
||||||
/// Will determine if a scaled font should be used for the font.
|
/// Will determine if a scaled font should be used for the font.
|
||||||
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
open var useScaledFont: Bool = false { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
open var surface: Surface = .light { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
/// Array of LabelAttributeModel objects used in rendering the text.
|
/// Array of LabelAttributeModel objects used in rendering the text.
|
||||||
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
open var attributes: [any LabelAttributeModel]? { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
/// TextStyle used on the this label.
|
/// TextStyle used on the this label.
|
||||||
@ -133,20 +133,20 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
open override var lineBreakMode: NSLineBreakMode { didSet { setNeedsUpdate() }}
|
open override var lineBreakMode: NSLineBreakMode { didSet { setNeedsUpdate() }}
|
||||||
|
|
||||||
/// Text that will be used in the label.
|
/// Text that will be used in the label.
|
||||||
|
private var _text: String!
|
||||||
override open var text: String! {
|
override open var text: String! {
|
||||||
get { super.text }
|
didSet {
|
||||||
set {
|
_text = text
|
||||||
textSetMode = .text
|
textSetMode = .text
|
||||||
styleText(newValue)
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
///AttributedText that will be used in the label.
|
///AttributedText that will be used in the label.
|
||||||
override open var attributedText: NSAttributedString? {
|
override open var attributedText: NSAttributedString? {
|
||||||
get { super.attributedText }
|
didSet {
|
||||||
set {
|
|
||||||
textSetMode = .attributedText
|
textSetMode = .attributedText
|
||||||
styleAttributedText(newValue)
|
setNeedsUpdate()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -278,7 +278,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
//--------------------------------------------------
|
//--------------------------------------------------
|
||||||
private func restyleText() {
|
private func restyleText() {
|
||||||
if textSetMode == .text {
|
if textSetMode == .text {
|
||||||
styleText(text)
|
styleText(_text)
|
||||||
} else {
|
} else {
|
||||||
styleAttributedText(attributedText)
|
styleAttributedText(attributedText)
|
||||||
}
|
}
|
||||||
@ -286,7 +286,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
|
|
||||||
private func styleText(_ newValue: String!) {
|
private func styleText(_ newValue: String!) {
|
||||||
defer { invalidateIntrinsicContentSize() }
|
defer { invalidateIntrinsicContentSize() }
|
||||||
guard let newValue else {
|
guard let newValue, !newValue.isEmpty else {
|
||||||
// We don't need to use attributed text
|
// We don't need to use attributed text
|
||||||
super.attributedText = nil
|
super.attributedText = nil
|
||||||
super.text = newValue
|
super.text = newValue
|
||||||
@ -304,15 +304,14 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
lineBreakMode: lineBreakMode)
|
lineBreakMode: lineBreakMode)
|
||||||
|
|
||||||
applyAttributes(mutableText)
|
applyAttributes(mutableText)
|
||||||
|
|
||||||
// Set attributed text to match typography
|
// Set attributed text to match typography
|
||||||
super.attributedText = mutableText
|
super.attributedText = mutableText
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private func styleAttributedText(_ newValue: NSAttributedString?) {
|
private func styleAttributedText(_ newValue: NSAttributedString?) {
|
||||||
defer { invalidateIntrinsicContentSize() }
|
defer { invalidateIntrinsicContentSize() }
|
||||||
guard let newValue = newValue else {
|
guard let newValue, !newValue.string.isEmpty else {
|
||||||
// We don't need any additional styling
|
// We don't need any additional styling
|
||||||
super.attributedText = newValue
|
super.attributedText = newValue
|
||||||
return
|
return
|
||||||
@ -321,7 +320,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
let mutableText = NSMutableAttributedString(attributedString: newValue)
|
let mutableText = NSMutableAttributedString(attributedString: newValue)
|
||||||
|
|
||||||
applyAttributes(mutableText)
|
applyAttributes(mutableText)
|
||||||
|
|
||||||
// Modify attributed text to match typography
|
// Modify attributed text to match typography
|
||||||
super.attributedText = mutableText
|
super.attributedText = mutableText
|
||||||
}
|
}
|
||||||
@ -423,3 +422,5 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
26
VDS/Extensions/UIImage+Helper.swift
Normal file
26
VDS/Extensions/UIImage+Helper.swift
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
//
|
||||||
|
// UIImage+Icon.swift
|
||||||
|
// VDS
|
||||||
|
//
|
||||||
|
// Created by Matt Bruce on 3/11/24.
|
||||||
|
//
|
||||||
|
|
||||||
|
import Foundation
|
||||||
|
import UIKit
|
||||||
|
|
||||||
|
extension UIImage {
|
||||||
|
|
||||||
|
/// UIImage helper for finding images based on the Icon.Name which uses the internal BundleManager.
|
||||||
|
/// - Parameters:
|
||||||
|
/// - name: RawRepresentable.
|
||||||
|
/// - color: Color to Tint the image with
|
||||||
|
/// - renderingMode: UIImage Rendering mode.
|
||||||
|
/// - Returns: UIImage for this proecess
|
||||||
|
public static func image<T: RawRepresentable>(representing representable: T, color: UIColor? = nil, renderingMode: UIImage.RenderingMode = .alwaysOriginal) -> UIImage? where T.RawValue == String {
|
||||||
|
guard let image = BundleManager.shared.image(for: representable.rawValue) else { return nil }
|
||||||
|
|
||||||
|
guard let color else { return image }
|
||||||
|
|
||||||
|
return image.withTintColor(color, renderingMode: renderingMode)
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user