Rounded corners of UILabel swift
try this :-
textLabel?.layer.cornerRadius = textLabel?.frame.size.height/2.0
textLabel?.layer.masksToBounds = true
if you want to set border color then :-
textLabel?.layer.borderColor = .red.cgColor
textLabel?.layer.borderWidth = 1.0
I think you should set maskToBounds for textLabel. try this:
textLabel?.layer.masksToBounds = true