How To Set Link Color In Swift Programmatically

By Eddy Chung

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, you'll love my free guide: Secrets To iOS Development. Speed up your learning curve - hundreds of students have already downloaded. Thanks for reading!
Profile Picture of Eddy Chung

Eddy Chung

I am a professional iOS developer in Silicon Valley. I teach iOS development on If you'd like to learn more about me click here or you can contact me at:

Similar Posts