added defaults for image attribute
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
This commit is contained in:
parent
6d34211042
commit
ee8ce73208
@ -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
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user