refactored to use new spacer extension

Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
Matt Bruce 2023-05-30 14:58:24 -05:00
parent 8b9b83791a
commit 43e9642de6

View File

@ -51,23 +51,16 @@ public class TooltipLabelAttribute: ActionLabelAttributeModel, TooltipLaunchable
} }
} }
//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 //create the image icon and match the color of the text
let tooltipAttribute = ImageLabelAttribute(location: location, let tooltipAttribute = ImageLabelAttribute(location: location,
imageName: "info", imageName: "info",
frame: frame, frame: frame,
tintColor: imageTintColor) tintColor: imageTintColor)
let spacerAttribute = ImageLabelAttribute(location: location, let spacer = NSAttributedString.spacer(for: VDSLayout.Spacing.space1X.value)
imageName: "info",
frame: spacerframe,
tintColor: .clear)
guard let tooltip = try? tooltipAttribute.getAttachment(), guard let tooltip = try? tooltipAttribute.getAttachment() else { return }
let spacer = try? spacerAttribute.getAttachment() else { return } attributedString.append(spacer)
attributedString.append(NSAttributedString(attachment: spacer))
attributedString.append(NSAttributedString(attachment: tooltip)) attributedString.append(NSAttributedString(attachment: tooltip))
addHandler(on: attributedString) addHandler(on: attributedString)
} }