override func viewDidLoad() {
super.viewDidLoad()
self.view.backgroundColor = UIColor(netHex: 0xfc3158)
fadeBackground()
NSTimer.scheduledTimerWithTimeInterval(self.fadeTime, target: self, selector: Selector("fadeBackground"), userInfo: nil, repeats: true)
}
func fadeBackground(){
UIView.animateWithDuration(self.fadeTime, delay: 0, options: UIViewAnimationOptions.AllowUserInteraction, animations: {
var randomIndex = Int(arc4random_uniform(UInt32(CONSTANTS.MainColorScheme.count)))
self.view.backgroundColor = CONSTANTS.MainColorScheme[randomIndex]
}) { (stuff Bool) -> Void in
}
}
I'm a little confused about why I need to use [unowned self]. According to this answer, I should only use [unowned self] if I don't care that self is still around when the closure is called. But I never see why that would ever be the case. Why would I not care if self is around? I want self to be around when the closure is called -- that's why I wrote the code there.
Do I need unowned self in the animations
closure?