Sharing image using UIActivityViewController
Just create a button and it's action. And install the button's action like this.
Note: You have to log in your facebook or twitter by going to setting. Then do like this.
@IBAction func onShareTouched(sender: AnyObject) {
print("share")
let myShare = "My beautiful photo! <3 <3"
let image: UIImage = UIImage(named: "yourImageNameHere")
let shareVC: UIActivityViewController = UIActivityViewController(activityItems: [(image), myShare], applicationActivities: nil)
self.presentViewController(shareVC, animated: true, completion: nil)
}
let activityItem: [AnyObject] = [self.imageView.image as! AnyObject]
let avc = UIActivityViewController(activityItems: activityItem as [AnyObject], applicationActivities: nil)
self.presentViewController(avc, animated: true, completion: nil)
Note : The above code tested in Xcode 6.3 simulator