Here I have a simple snippet to use simple animation with my defined UIView.
UIView.animateWithDuration(0.1) { [weak self] in
self?.popOverView.center = gesture.locationInView(self?.view)
}
Here [weak self] is to avoid reference cycle,and I also use trailing closure to simply the code.Howerver,the compiler is unhappy with that and gives me the wrong message.
Cannot invoke 'animateWithDuration' with an argument list of type '(FloatLiteralConvertible, () -> () -> $T2)'
What does $T2 stands for ? And the strange thing is that when there is two or more statements in the closure body, it compiles correctly.
UIView.animateWithDuration(0.1) { [weak self] in
println()
self?.popOverView.center = gesture.locationInView(self?.view)
}
And I know that if there is only one statement in the closure body, it is automatically returned.