smerTDima smerTDima - 1 year ago 225
Swift Question

How to draw a circle in Swift 3

Swift 3
How to make a circle? The circle should be located at the center. Was certain radius. The background - blackblur. Thank you

Answer Source

In order to make a circle draw a square and add a cornerRadius equal at width / 2:

let circle = UIView(frame: CGRect(x: 0.0, y: 0.0, width: 100.0, height: 100.0)) =
circle.layer.cornerRadius = 50
circle.backgroundColor =

var darkBlur = UIBlurEffect(style: UIBlurEffectStyle.dark)
var blurView = UIVisualEffectView(effect: darkBlur)

blurView.frame = circle.bounds


Good luck! :)

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download