1

I want to share a url like what Safari do in my own iOS app, How can i do this? Use socail framework can share in some specified social plartform, but in my case ,I just want to share url like Safari.

Michael Yang
  • 1,403
  • 2
  • 18
  • 27
  • share url like safari?? what do you mean by this? are you talking about deep links which opens app when hit from safari. – Ellen Jul 26 '17 at 11:41

1 Answers1

3

Do you think on UIActivityViewController?

enter image description here

@IBAction func shareTextButton(_ sender: UIButton) {

    // image to share
    let link = "https://www.google.rs/"

    // set up activity view controller
    let activityViewController = UIActivityViewController(activityItems: [link], applicationActivities: nil)
    activityViewController.popoverPresentationController?.sourceView = self.view // so that iPads won't crash

    // exclude some activity types from the list (optional)
    activityViewController.excludedActivityTypes = [ UIActivityType.airDrop, UIActivityType.postToFacebook ]

    // present the view controller
    self.present(activityViewController, animated: true, completion: nil)


}
Ivan Skrobot
  • 311
  • 3
  • 7