I would like to add a shadow effect to my UITextField currently what I\'m achieving is this: As you can see the shadow is not rounded in the corners. My code:
You can use this extension
extension ViewController { func setShadow(_ view: UIView) { view.layer.masksToBounds = false; view.layer.shadowRadius = 3.0; view.layer.shadowColor = UIColor.black.cgColor; view.layer.shadowOffset = CGSize(width: 2.0, height: 4.0); view.layer.shadowOpacity = 1.0; } }