Mannopson
Mannopson

Reputation: 2684

How to create a URL for an Image using Swift

I have used following line of code for picking an image from the Photo Library. Now I want to create a URL for those images, if it's possible.

func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {

    let image = info[UIImagePickerControllerOriginalImage] as! UIImage
    self.imageView.image = image

    picker.dismiss(animated: true) {
        // Completion block
    }
}

How to create a URL for an UIImage?

Upvotes: 1

Views: 672

Answers (1)

Coder-256
Coder-256

Reputation: 5618

Try using let url = info[UIImagePickerControllerMediaURL] as! URL

Upvotes: 1

Related Questions