vds_ios/VDS/Components/Label/Attributes/LabelAttributeAttachment.swift
Matt Bruce cd327a7f78 added new attribute
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-08-09 14:35:28 -05:00

27 lines
692 B
Swift

//
// LabelAttributeAttachment.swift
// VDS
//
// Created by Matt Bruce on 8/9/22.
//
import Foundation
import UIKit
public protocol LabelAttributeAttachment: LabelAttributeModel {
func getAttachment() throws -> NSTextAttachment
}
extension LabelAttributeAttachment {
public func setAttribute(on attributedString: NSMutableAttributedString) {
do {
let mutableString = NSMutableAttributedString()
let attachment = try getAttachment()
mutableString.append(NSAttributedString(attachment: attachment))
attributedString.insert(mutableString, at: location)
} catch {
//TODO: Error Handling
}
}
}