Force Numerical input in text field

Is there any (relatively) sane way to restrict a text field to numbers only?

You add a number formatter to it. In fact Xcode offers a text field with number formatter ready made.