From ee8ce73208575afa7eef132deb2419a732fc4a85 Mon Sep 17 00:00:00 2001 From: Matt Bruce Date: Thu, 3 Nov 2022 10:44:38 -0500 Subject: [PATCH] added defaults for image attribute Signed-off-by: Matt Bruce --- VDS/Components/Label/Attributes/ImageLabelAttribute.swift | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/VDS/Components/Label/Attributes/ImageLabelAttribute.swift b/VDS/Components/Label/Attributes/ImageLabelAttribute.swift index ca62f602..92403082 100644 --- a/VDS/Components/Label/Attributes/ImageLabelAttribute.swift +++ b/VDS/Components/Label/Attributes/ImageLabelAttribute.swift @@ -16,10 +16,10 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel { } public var id = UUID() public var location: Int - public var length: Int + public var length: Int = 1 public var imageName: String? public var image: UIImage? - public var frame: CGRect + public var frame: CGRect? public var tintColor: UIColor public static func == (lhs: ImageLabelAttribute, rhs: ImageLabelAttribute) -> Bool { lhs.isEqual(rhs) @@ -32,7 +32,7 @@ public struct ImageLabelAttribute: AttachmentLabelAttributeModel { private func imageAttachment(image: UIImage) -> NSTextAttachment { let attachment = NSTextAttachment() attachment.image = image.withTintColor(tintColor) - attachment.bounds = frame + attachment.bounds = frame ?? .init(x: 0, y: 0, width: image.size.width, height: image.size.height) return attachment }