Such a thing already exists for `UITextField` and `UITextView`. They both conform to a protocol which requires the implementation of `-hasText`.