-It should be. However, the destination to share is not specified in this article (Instagram, Twitter, etc.). I think it's familiar that the modal comes out from the bottom when you press the Share button, but it's mainly the setting.
ViewControlloer.swift
@IBAction func share(_ sender: Any) {
//It will be shared with SNS services etc. at the same time as the text here
let text = "#Service name"
//Compress images to share in jpeg format. The compression rate is arbitrary. The more you apply, the rougher the image, but the faster the processing
let image = backImageView.image?.jpegData(compressionQuality: 0.5)
//Define what you want to share as an item. I'm asked for a type, but it's not any type, so Any
let item = [text,image as Any]
//Screen transition (modal coming out from the bottom) settings
let activitiyVC = UIActivityViewController(activityItems: item, applicationActivities: nil)
//Screen transition
self.present(activitiyVC, animated: true, completion: nil)
}
Recommended Posts