Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let activityItem = URL.init(fileURLWithPath: Bundle.main.path(forResource: “Audio1”, ofType: “mp3")!)
- let activityVC = UIActivityViewController(activityItems: [activityItem],applicationActivities: nil)
- activityVC.popoverPresentationController?.sourceView = self.view
- self.present(activityVC, animated: true, completion: nil)
- let urlString = "Visit this website: http://www.google.com"
- let urlStringEncoded = urlString.addingPercentEncoding(withAllowedCharacters: .urlHostAllowed)!
- let url = NSURL(string: "whatsapp://send?text=(urlStringEncoded)")
- if UIApplication.shared.canOpenURL(url! as URL) {
- UIApplication.shared.openURL(url! as URL)
- }
Add Comment
Please, Sign In to add comment