How to stop the activity indicator in swift after a condition is met?
<p>I have declared a UIActivityIndicatorView as a computed property in extension of my model. I have a method configureCell where I'm trying to use activity indicator as a subview of an imageView. Here I'm able to position the indicator on certain condition but am not able to do any changes on it later. E.g I am not able to stop the activity indicator, not able to change the color, not able to even hide it.  </p>

<pre><code>extension TranscationModel: UITableViewDataSource, UITableViewDelegate
{

 var activityIN: UIActivityIndicatorView {
    var act = UIActivityIndicatorView(activityIndicatorStyle: UIActivityIndicatorViewStyle.Gray)
    act.color = UIColor.redColor()
    act.hidden = false
    act.startAnimating()
    return act
}

func configureTransactionCell(cell : TransactionCell?, indexPath: NSIndexPath) {
    if transaction.tid == "Something" {
        activityIN.color = UIColor.greenColor() //Even this doesn't work
        activityIN.center = cell.imgTransactionBill.center
        cell.imgTransactionBill.addSubview(activityIN)
        let delayTime = dispatch_time(DISPATCH_TIME_NOW, Int64(10 * Double(NSEC_PER_SEC)))
        dispatch_after(delayTime, dispatch_get_main_queue()) {
             activityIN.stopAnimating() //Not working
             activityIN.hidden = true   //Not working
        }
    }
}
</code></pre>