Copy image option from other apps to my app iOS swift.

 Problem:

I want to copy one image from other apps like whatsapp, chrome and others in my iphone and paste inside my app.How can i achieve that?


Solution:

        if let pastedImage = UIPasteboard.general.image {

            

            let pasteActionButton = UIAlertAction(title:"paste", style: .default) { action -> Void in

                // paste action here

            }

            alert.addAction(pasteActionButton)

        }


The above code will check that pasting content is image and then proceed that to show paste option in alert.


Inside paste action you can you can use pastedImage to get the copied image from other apps.

Comments

Popular posts from this blog

Invalid bundle error while upload the app to the app Store

Convert NsNumber, NSDate to String in iOS Swift

Global LocationManager Singleton class iOS Swift