mirror of
https://github.com/divkit/divkit.git
synced 2026-06-06 20:07:59 +00:00
21 lines
562 B
Swift
21 lines
562 B
Swift
import CoreGraphics
|
|
import Foundation
|
|
|
|
public final class RunWithBoundsAttribute {
|
|
public static let Key = NSAttributedString.Key("DKActions")
|
|
|
|
public let actions: [UserInterfaceAction]
|
|
public let mask: TextMask?
|
|
|
|
public init(actions: [UserInterfaceAction], mask: TextMask?) {
|
|
self.actions = actions
|
|
self.mask = mask
|
|
}
|
|
|
|
public func apply(to str: CFMutableAttributedString, at range: CFRange) {
|
|
if !actions.isEmpty || mask != nil {
|
|
CFAttributedStringSetAttribute(str, range, RunWithBoundsAttribute.Key as CFString, self)
|
|
}
|
|
}
|
|
}
|