Make UIImage Corners Rounded

This code snipped demonstrates how to:

  • Make UIImage corners rounded
  • Add a boarder around UIImage
  • Change UIImage border colour
import UIKit

class ViewController: UIViewController {
    @IBOutlet weak var profile_picture: UIImageView!
    override func viewDidLoad() {
        // Make image borders rounded
        profile_picture.layer.cornerRadius = 10
        profile_picture.clipsToBounds = true
        profile_picture.layer.borderWidth = 3
        profile_picture.layer.borderColor = UIColor.white.cgColor
    override func didReceiveMemoryWarning() {
        // Dispose of any resources that can be recreated.

Watch this video tutorial to see how to make UIImage circular in Xcode using Main storyboard.

Circular Image or Image with Rounded Corners. Example in Swift

[raw_html_snippet id=”cookbookpagecoursesheader”]

Unit Testing Swift Mobile App

Apply Test-Driven Development(TDD) process to iOS mobile app development in Swift Preview this video course.