私は、発生したい2つの主要なアクションを含む次の小さな関数を持っています。3 秒間のアニメーションと、そのアニメーションの完了時に別の関数呼び出し。ただし、UIView アニメーションが完了する前に、別の関数を呼び出すコード行が実行されています。
func switchToNormalState() {
print("Switching to Normal State")
currentState = "normal"
intervalCounter = intervalCounter + 1
setVisualsForState()
UIView.animateWithDuration(Double(normalDuration), animations: { () -> Void in
self.ProgressBar.setProgress(1.0, animated: true)
}, completion: { _ in
self.switchToFastState()
})
}
解決策を探して他の同様の投稿を調査しましたが、どの解決策も私のパズルを解決していません。これらのアクションを同時ではなくシーケンスにするために、完了ブロックで何が間違っていますか?