Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum TextAttribute {
- case foregroundColor(NSColor)
- case link(URL)
- case kerning(Int)
- case underline(NSUnderlineStyle)
- var name: String {
- switch self {
- case .foregroundColor:
- return "NSForegroundColorAttributeName"
- case .link:
- return "NSLinkAttributeName"
- case .kerning:
- return "NSKernAttributeName"
- case .underline:
- return "NSUnderlineStyleAttributeName"
- }
- }
- }
- let string = NSAttributedString(string: "My underlined link", attributes: [
- .underline(.single),
- .link(myWebsiteURL)
- ])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement