I'm making an app that needs to access users image gallery and when he chooses an image for his profile image should become rounded. 
Here is the screenshot of the problem:

and a sample code used in the project
@objc func makeImageRounded(image: UIImageView){
        image.layer.cornerRadius = image.frame.size.width / 2
        image.clipsToBounds = true
    }
this function is called in
   imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]){
            self.perform(#selector(makeImageRounded(image:)), with: profilePicture, afterDelay: 0)
    }
 
     
     
     
    