I want to highlight all matches word with searching. I wrote code but I couldn't use a loop. When i search a word, my app find words and highlight only first word. here is my code 

```
var count = 0
let attributedText = NSMutableAttributedString(attributedString: txtMetin2.attributedText)
let text2 = txtArama.text as NSString
let text = txtMetin2.text as NSString
var range:NSRange
var checker:NSString = ""

for(var i=0 ; i<text.length - text2.length-1 ; i++)
{        
    range = NSMakeRange(i, text2.length)
    checker = text.substringWithRange(range)
    if(text2 == checker)
    {
        count++    
        let highlightedRange = text.rangeOfString("\(text2)")
        attributedText.addAttribute(NSBackgroundColorAttributeName, value: UIColor.blueColor(), range: highlightedRange)
        let textAttachment = NSTextAttachment()
        let textAttachmentString = NSAttributedString(attachment: textAttachment)
        attributedText.appendAttributedString(textAttachmentString)
        txtMetin2.attributedText = attributedText                               
    }
}
println("\(count)")

```

i am very new at swift. sorry for bad coding. my codes find matches count but how can i highlight all matches thank you