close
how-to-hyperlink-in-uitextview
There are many ways that shows how to hyperlink a word in TextView. There are many libraries available on github. But if you want the simplest way to do it here it is.

Before I start let me tell you that this might not be the best approach to use. As it requires some additional variable initialization so memory consumption is a bit more than usual. Again I’m not sure as I haven’t tested other ways yet.

So first place a UITextView on your ViewController and Make it’s outlet. Say in my case it’s

Then in viewDidLoad or in any method as you like do the following.
So in this text I want to hyperlink the word ‘here’. To do that we need another string as
Then we will make NSAttributedString and initialize it with String. So let do this:
Next we add the link and give it the range of the word
and finally
Tags : hyperlinksentenseuitextviewword
Chaudhary Talha

The author Chaudhary Talha

I'm an iOS developer by profession and UI/UX designer by passion. All my tutorials are based on my personal experiences and whenever I learn something new I share it with the world.