How to make a link in a label or a text view?
I could find different solutions for iOS but not for macOS.
For instance, this works in iOS but not in macOS:
In macOS it gives me two errors:
Value of type NSScrollView has no member textStorage
Value of type NSScrollView has no member linkTextAttributes
I could find different solutions for iOS but not for macOS.
For instance, this works in iOS but not in macOS:
Code Block let attributedString = NSMutableAttributedString(string: "Just click here to register") let range = NSRange(location: 5, length: 10) let url = URL(string: "https://www.google.com")! attributedString.setAttributes([.link: url], range: range) textView1.textStorage?.setAttributedString(attributedString) textView1.linkTextAttributes = [ .foregroundColor: NSColor.blue, .underlineStyle: NSUnderlineStyle.styleSingle.rawValue ]
In macOS it gives me two errors:
Value of type NSScrollView has no member textStorage
Value of type NSScrollView has no member linkTextAttributes