Circular Image or Image with Rounded Corners. Example in Swift

In this video tutorial I am going to share how to add rounded corners to an image and how to make image completely circular.


import UIKitclass ViewController: UIViewController {
@IBOutlet weak var profile_picture: UIImageView!
@IBOutlet weak var profile_picture2: UIImageView!override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.// Make image circular
profile_picture.layer.cornerRadius = profile_picture.frame.size.width / 2
profile_picture.clipsToBounds = trueprofile_picture.layer.borderWidth = 3
profile_picture.layer.borderColor = UIColor.whiteColor().CGColor// Make image borders rounded
profile_picture2.layer.cornerRadius = 10
profile_picture2.clipsToBounds = true
profile_picture2.layer.borderWidth = 3
profile_picture2.layer.borderColor = UIColor.whiteColor().CGColor
}override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated.