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.

Mr.Javed Multani

Software Engineer | Certified ScrumMaster® (CSM) | UX Researcher | Youtuber | Tech Writer