I created a simple textfield to experiment with cornerRadius and maskToBounds and thought that if I wanted to round the corner of the textfield I would need to also set the layer´s maskToBounds to true in addition to setting the cornerRadius of the layer, like so:
myTextField.layer.borderWidth = 1
myTextField.layer.cornerRadius = 3
myTextField.layer.masksToBounds = true
myTextField.textAlignment = .center
However when I commented out myTextField.layer.masksToBounds = true
, the textfield still presented on the screen with rounded corners.
So when exactly would it be necessary to use maskToBounds, and why is it not necessary here? The background colour of the entire screen is white and there are no images of any other elements inside the textField.