From 43e9642de65cfd776b03efe4964aa48e7419208d Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Tue, 30 May 2023 14:58:24 -0500 Subject: [PATCH] refactored to use new spacer extension Signed-off-by: Matt Bruce --- .../Label/Attributes/TooltipLabelAttribute.swift | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift b/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift index 5d5baa8d..b061d747 100644 --- a/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/TooltipLabelAttribute.swift @@ -50,24 +50,17 @@ public class TooltipLabelAttribute: ActionLabelAttributeModel, TooltipLaunchable frame = CGRect(x: 0, y: -1, width: size.value.dimensions.width, height: size.value.dimensions.height) } } - - //create the frame in which to hold the icon - let spacerframe = CGRect(x: 0, y: 0, width: VDSLayout.Spacing.space1X.value, height: size.value.dimensions.height) - + //create the image icon and match the color of the text let tooltipAttribute = ImageLabelAttribute(location: location, imageName: "info", frame: frame, tintColor: imageTintColor) - let spacerAttribute = ImageLabelAttribute(location: location, - imageName: "info", - frame: spacerframe, - tintColor: .clear) + let spacer = NSAttributedString.spacer(for: VDSLayout.Spacing.space1X.value) - guard let tooltip = try? tooltipAttribute.getAttachment(), - let spacer = try? spacerAttribute.getAttachment() else { return } - attributedString.append(NSAttributedString(attachment: spacer)) + guard let tooltip = try? tooltipAttribute.getAttachment() else { return } + attributedString.append(spacer) attributedString.append(NSAttributedString(attachment: tooltip)) addHandler(on: attributedString) }