Merge branch 'develop' into feature/pagination

This commit is contained in:
Krishna Kishore Bandaru 2024-03-14 11:35:52 +05:30
commit 2d7bdf9a8f
4 changed files with 50 additions and 19 deletions

View File

@ -139,6 +139,7 @@
EAD068922A560B65002E3A2D /* LoaderViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAD068912A560B65002E3A2D /* LoaderViewController.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 */; };
EAE785312BA0A438009428EA /* UIImage+Helper.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAE785302BA0A438009428EA /* UIImage+Helper.swift */; };
EAEEEC922B1F807300531FC2 /* BadgeChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC912B1F807300531FC2 /* BadgeChangeLog.txt */; };
EAEEEC962B1F893B00531FC2 /* ButtonChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC952B1F893B00531FC2 /* ButtonChangeLog.txt */; };
EAEEEC982B1F8DD100531FC2 /* LineChangeLog.txt in Resources */ = {isa = PBXBuildFile; fileRef = EAEEEC972B1F8DD100531FC2 /* LineChangeLog.txt */; };
@ -317,6 +318,7 @@
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>"; };
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>"; };
EAEEEC952B1F893B00531FC2 /* ButtonChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = ButtonChangeLog.txt; sourceTree = "<group>"; };
EAEEEC972B1F8DD100531FC2 /* LineChangeLog.txt */ = {isa = PBXFileReference; lastKnownFileType = text; path = LineChangeLog.txt; sourceTree = "<group>"; };
@ -564,6 +566,7 @@
EA81410F2A127066004F60D2 /* UIColor+VDSColor.swift */,
EA33623D2892EE950071C351 /* UIDevice.swift */,
EA0B18092AA78F9000F2D0CD /* UIEdgeInsets.swift */,
EAE785302BA0A438009428EA /* UIImage+Helper.swift */,
EAF7F0B6289C12A600B287F5 /* UITapGestureRecognizer.swift */,
EA8E40902A7D3F6300934ED3 /* UIView+Accessibility.swift */,
EAB5FED329267EB300998C17 /* UIView+NSLayoutConstraint.swift */,
@ -1057,6 +1060,7 @@
EAF7F0AF289B144C00B287F5 /* UnderlineLabelAttribute.swift in Sources */,
EA0D1C412A6AD61C00E5C127 /* Typography+Additional.swift in Sources */,
EAC925842911C63100091998 /* Colorable.swift in Sources */,
EAE785312BA0A438009428EA /* UIImage+Helper.swift in Sources */,
EAB5FEF5292D371F00998C17 /* ButtonBase.swift in Sources */,
EA978EC5291D6AFE00ACC883 /* AnyLabelAttribute.swift in Sources */,
71ACE89C2BA0451200FB6ADC /* PaginationContainerView.swift in Sources */,

View File

@ -44,7 +44,7 @@ open class Icon: View {
//--------------------------------------------------
/// UIImageView used to render the icon.
open var imageView = UIImageView().with {
$0.isAccessibilityElement = false
$0.isAccessibilityElement = false
$0.translatesAutoresizingMaskIntoConstraints = false
$0.contentMode = .scaleAspectFill
$0.clipsToBounds = true
@ -109,8 +109,8 @@ open class Icon: View {
//get the image name
//set the image
if let name, let image = getImage(for: name.rawValue) {
setImage(image: image, imageColor: imageColor)
if let name, let image = UIImage.image(for: name, color: imageColor) {
imageView.image = image
} else {
imageView.image = nil
}
@ -129,17 +129,17 @@ open class Icon: View {
super.updateAccessibility()
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)
}
}

View File

@ -133,10 +133,12 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
open override var lineBreakMode: NSLineBreakMode { didSet { setNeedsUpdate() }}
/// Text that will be used in the label.
private var _text: String!
override open var text: String! {
get { super.text }
get { _text }
set {
textSetMode = .text
_text = newValue
styleText(newValue)
}
}
@ -278,7 +280,7 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
//--------------------------------------------------
private func restyleText() {
if textSetMode == .text {
styleText(text)
styleText(_text)
} else {
styleAttributedText(attributedText)
}
@ -304,10 +306,9 @@ open class Label: UILabel, ViewProtocol, UserInfoable {
lineBreakMode: lineBreakMode)
applyAttributes(mutableText)
// Set attributed text to match typography
super.attributedText = mutableText
}
private func styleAttributedText(_ newValue: NSAttributedString?) {

View 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)
}
}