I want to be able to execute a block on the next run loop iteration. It\'s not so important whether it gets executed at the beginning or the end of the next run
Rob answer is great and informative. I'm not trying to replace it.
Just reading the UIView documentation, I found :
completion
A block object to be executed when the animation sequence ends. This block has no return value and takes a single Boolean argument that indicates whether or not the animations actually finished before the completion handler was called. If the duration of the animation is 0, this block is performed at the beginning of the next run loop cycle. This parameter may be NULL.
So an easy solution would be:
UIView.animate(withDuration: 0) {
// anything
}