How To Set Link Color In Swift Programmatically

You can change the color of links in text views to anything you want in Swift.

The easiest way to do this is to set the tintColor of your UITextView:

textView.tintColor =

You can also do this by setting the link text attributes like so:

textView.linkTextAttributes = [NSAttributedString.Key.foregroundColor:]
If you liked this post and want to learn more, check out The Complete iOS Developer Bootcamp. Speed up your learning curve - hundreds of students have already joined. Thanks for reading!

Eddy Chung

I teach iOS development on

Similar Posts