Hi team, using this implementation :
@objc func shareImage(_ base64: String, title: String) {
if let image = base64.imageFromBase64 {
DispatchQueue.main.async {
guard let appDelegate = UIApplication.shared.windows.first?.rootViewController else { return }
let dataToShare = [title , image] as [Any]
let activityViewController = UIActivityViewController(activityItems: dataToShare, applicationActivities: nil)
activityViewController.excludedActivityTypes = [UIActivity.ActivityType.airDrop]
if let popoverController = activityViewController.popoverPresentationController {
popoverController.sourceRect = CGRect(x: UIScreen.main.bounds.width / 2, y: UIScreen.main.bounds.height / 2, width: 0, height: 0)
popoverController.sourceView = appDelegate.view
popoverController.permittedArrowDirections = UIPopoverArrowDirection(rawValue: 0)
}
appDelegate.present(activityViewController, animated: true, completion: nil)
}
}
}
I only share a text without an image. Should I need to add something on this implementation.
I can confirm this implementation can share text and image on Facebook, Instagram, Telegram.
Thanks in advance.