DSClickableURLTextField

0.4

DSClickableURLTextField allow links to be clicked on and opened.
catlan/DSClickableURLTextField

What's New

v0.4

2022-11-06T13:32:08Z
  • Replace soft deprecated API usage with modern replacements
  • For container size take cell.wraps into account
  • Update container size before updating tracking area
  • Overrode isEditable and isSelectable to explicitly set non-editable and non-selectable.
  • Swift

DSClickableURLTextField

NSTextField subclass that does one thing: allow links to be clicked on and opened.

DSClickableURLTextField Example Screenshot

To use this class, all you need to do is set the text field's attributed string value, with some portion of it being a link, and the text field will do the rest. You'll get the “pointy hand” cursor over the link, and clicking on it will open that link.

let termsAndPolicy = "[Terms of Service](https://example.com) | [Privacy Policy](https://example.com)"
do {
    label.attributedStringValue = try NSAttributedString(markdown: termsAndPolicy)
} catch {
}

Note that the class only works if it is non-editable and non-selectable. This is setup by default, but I wanted to mention it so nobody wastes time trying to figure out why the text field is acting the way it is.

Forked from DSClickableURLTextField

Description

  • Swift Tools 5.7.0
View More Packages from this Author

Dependencies

  • None
Last updated: Mon Oct 21 2024 08:00:34 GMT-0900 (Hawaii-Aleutian Daylight Time)