Last active
May 11, 2022 04:57
-
-
Save kiarashvosough1999/13efc9229b3765ae5a997f0bc91a4e28 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
public struct CocoStringAttributeHolder { | |
internal let key: NSAttributedString.Key | |
internal let value: Any | |
internal let range: Range<String.Index>? | |
fileprivate init(key: NSAttributedString.Key, value: Any, range: Range<String.Index>?) { | |
self.key = key | |
self.value = value | |
self.range = range | |
} | |
} | |
extension CocoStringAttributeHolder { | |
public static func attribute(key: NSAttributedString.Key, value: Any) -> Self { | |
.init(key: key, value: value, range: nil) | |
} | |
public static func rangedAttribute(key: NSAttributedString.Key, value: Any, range: Range<String.Index>) -> Self { | |
.init(key: key, value: value, range: range) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment