.
빠른 해결 방법은 completions:
클로저를 @objc_block
으로 캐스팅하는 것입니다.
의 ViewController :
UIView.animateWithDuration(0.3,
delay: 0.0,
options: UIViewAnimationOptions.CurveEaseInOut,
animations: {() -> Void in
self.rectangleView.alpha = 1.0
},
completion: { (complete) -> Void in
println("111 Hello ViewController 1")
} as @objc_block (Bool) -> Void
// ^^^^^^^^^^^^^^^^^^^^^^^^^^
)
ViewController2 :
UIView.animateKeyframesWithDuration(duration,
delay: 0.0,
options: UIViewKeyframeAnimationOptions.CalculationModeLinear,
animations: {() -> Void in
UIView.addKeyframeWithRelativeStartTime(0.0,
relativeDuration: (duration/2),
animations: {() -> Void in
self.rectangleView.alpha = 0.1
}
)
UIView.addKeyframeWithRelativeStartTime(
(duration/2),
relativeDuration: (duration/2),
animations: {() -> Void in
self.rectangleView.backgroundColor = UIColor.blueColor()
}
)
},
completion: { (complete) -> Void in
println("Hello ViewController 2")
} as @objc_block (Bool) -> Void
// ^^^^^^^^^^^^^^^^^^^^^^^^^^
)