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.
Asked
Active
Viewed 1,016 times
0

Shruti
- 1,849
- 1
- 13
- 21
2 Answers
1
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)
}
}

KDeogharkar
- 10,939
- 7
- 51
- 95
1
You can't get access to other apps except in controlled ways.
Look at UIActivityViewController
for ways to communicate with various social sites, and at UIActivity
for customization tips.
The more general way to do data sharing with other apps on the device is through URLs. Here's a link on inter-app communication.

Phillip Mills
- 30,888
- 4
- 42
- 57