How to show tooltip on a point click in swift
<p>I am drawing the lines using the following code. The line edges have dots and i want to show the tooltip when user click on the end dots. 
The code snippet is below,</p>

<pre><code> override func drawRect(rect: CGRect) {
        // Drawing code
      UIColor.brownColor().set()
    let context = UIGraphicsGetCurrentContext()
    //CGContextSetLineWidth(context, 5)
    CGContextMoveToPoint(context, 50, 50)
    CGContextAddLineToPoint(context,100, 200)
    CGContextStrokePath(context)

    // now add the circle on at the line edges

        var point = CGPoint(x:50 , y:50)
        point.x -= 5.0/2
        point.y -= 5.0/2
        var circle = UIBezierPath(ovalInRect: CGRect(origin: point, size: CGSize(width: 5.0,height: 5.0)))
        circle.fill()

        point = CGPoint(x:100 , y:200)
        point.x -= 5.0/2
        point.y -= 5.0/2
        circle = UIBezierPath(ovalInRect: CGRect(origin: point, size: CGSize(width: 5.0,height: 5.0)))
        circle.fill()

    }
</code></pre>

<p>It is currently displaying the following image,
<a href="https://i.stack.imgur.com/pbOKA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pbOKA.png" alt="enter image description here"></a></p>

<p>and i want to show the tooltip like below,
<a href="https://i.stack.imgur.com/lE4As.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/lE4As.png" alt="enter image description here"></a></p>

<p>Does anybody have an idea how will i recognise that this particular dot is clicked and also how will i show the tooltip.
I am looking for a solution in swift.</p>