Share the text to all the apps swift iOS

First you have to store the string to the String Variable.Then use the below code to share the text
let string: String = "Sharing Text"
let activityViewController = UIActivityController(activityItems: [string],applicationActivities:nil)
self.navigationController?.presentViewController(activityViewController, animated: true)

 
if you dont want some apps in the list then try the following.

activityViewController.excludedActivityTypes = [UIActivityTypePostToFacebook]

 Use the activityviewcontroller to display the sharing apps inside the popup window.If the user selected the app he want to share the text then it will be processed to the selected app he wants to share.

    Comments

    Popular posts from this blog

    Invalid bundle error while upload the app to the app Store

    Saved Image in document directory and save path in coredata not able to fetch the image file iOS swift