How to put an URL in a NSTextView ?

I need an URL in a text view like an href in an HTML page…
initWithHTML, initWithPath, initWithRTF, initWithRTFD, initWithURL, …
In this particluar case, we will use
initWithHTML which takes an NSData argument to specify the HTML code to be inserted. NSString allowing easy conversion to a NSData object with dataUsingEncoding, we can write:
NSString *myHTMLString = @"my_url_here
">my_label" ;
NSDate *myData = [myHTMLString dataUsingEncoding:NSUTF8StringEncoding];
NSAttributedString *textToBeInserted = [[[NSAttributedString alloc]
initWithHTML:myData documentAttributes:nil] autorelease];
See also Apple Sample Code
The AppKit framework offers several NSAttributedString additions that will help the developer inserting various objects in a NSTextView: