             self.setNeedsDisplay()
         }
     }
+    
+    private var selectedURLRange: URLRange?
+    private lazy var urlRanges = [URLRange]()
     
     public override init(frame: CGRect) {
         super.init(frame: frame)

        set {
            if let _ = self.customTextContainer,
                let layoutManager = self.customLayoutManager {
                self.customTextStorage = NSTextStorage(attributedString: newValue)
                self.customTextStorage.addLayoutManager(layoutManager)
                layoutManager.textStorage = self.customTextStorage

//  THE SOFTWARE.
//

#if os(iOS)

import SafariServices

#endif

#if os(iOS) || os(tvOS)

import UIKit

public protocol CDMarkdownLabelDelegate: class {
    func didSelect(_ url: URL)
}

typealias URLRange = (url: URL, range: NSRange)

open class CDMarkdownLabel: UILabel {
    
    open var customLayoutManager: CDMarkdownLayoutManager!
    open var customTextContainer: NSTextContainer!
    open var customTextStorage: NSTextStorage!
    open weak var delegate: CDMarkdownLabelDelegate?
    open var roundAllCorners: Bool = false {
        didSet {
            if let layoutManager = self.customLayoutManager {
