Simply two line of code:

viewRound.layer.cornerRadius = viewRound.frame.size.height/2
viewRound.clipsToBounds = true

Make sure you are using same height and width like:

For example, if your view size is (10*10),(50*50),(100*100), etc. then your view becomes perfect squire else not

Here Auto Layout also matters.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Mr.Javed Multani

Mr.Javed Multani

296 Followers

iOS Developer, Triple graduated, Passionate, Love workout, blogger