ideally you would need to call animator.updateItem(usingCurrentState: square). But this is not going to work and looks like a bug in Apple's code.
To workaround this issue you would need to remove all the behaviours which contain your square, call update item and then add those behaviours back.
animator.removeBehavior(collision)
animator.removeBehavior(gravity)
animator.updateItem(usingCurrentState: square)
animator.addBehavior(collision)
animator.addBehavior(gravity)
Topic:
UI Frameworks
SubTopic:
UIKit
Tags: