vds_ios/VDS/Components/Label/Attributes/AttachmentLabelAttributeModel.swift
Matt Bruce 02a3bd9e78 refactored names of XXXLabelAttribute
Signed-off-by: Matt Bruce <matt.bruce@verizon.com>
2022-10-04 15:08:03 -05:00

27 lines
702 B
Swift

//
// LabelAttributeAttachment.swift
// VDS
//
// Created by Matt Bruce on 8/9/22.
//
import Foundation
import UIKit
public protocol AttachmentLabelAttributeModel: LabelAttributeModel {
func getAttachment() throws -> NSTextAttachment
}
extension AttachmentLabelAttributeModel {
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
}
}
}