How to Create Round or Round Corner UIView in swift 4 xcode 9

Swift n Objective-C

Hi, Guys. It is like a Tutorial kind of Post or Article. I hope it is useful or helpful for all iOS Application developers. Earlier, there is no proper or standard logic for Round corner or Round UIView in iOS. As an experienced developer, i found a simple logic or method for that, you just go through below given instructions.

To Apply Round Corner or Create Round UIView, your UIView Height & Width should be Same. (width:100, Height:100)

Declaring or creation Object to UIButton Class Component

  –>  @IBOutlet weak var basicView: UIView!

Create Below given Method as Shown…

   func applyRoundRect(_ object:AnyObject) {

        object.layer.cornerRadius = object.frame.size.width / 2

        object.layer.masksToBounds = true        


Applying Round Corner Follow Below…



Sample Source Code: RoundCornerVIEW

Leave a Reply