I am developing my application in swift
. I want a feature like android or like airdrop
. IT should work similar to the Airbnb application. On click of share button i want to show the list of all the app installed in the device and user can select anyone and share the data.
I tried to search on google for the same but did not got any specific results.Any help would be appreciated
Thanx.
you can use UIActivityViewController
for sharing purpose:
@IBAction func shareButtonClicked(sender: UIButton)
{
let textToShare = "Swift is awesome! Check out this website about it!"
if let myWebsite = NSURL(string: "http://www.google.com/")
{
let objectsToShare = [textToShare, myWebsite]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
self.presentViewController(activityVC, animated: true, completion: nil)
}
}