Refactor event loop into UIView.