Share Directory and its content

Viewed 46

I have below striation of directory in documents

Folder- A -> Folder1 -> (Contain image1.png,image2.png)
             Folder2 -> (Contain image1.png,image2.png)
             Folder3 -> (Contain image1.png,image2.png)

How I can share Folder-A using share button so I can share all its subfolder and content as well using email or UIActivityViewController

if you already have a file in a directory and want to share it, just add it's URL into activityItems:

let fileURL = NSURL(fileURLWithPath: "The path where the file you want to share is located")

// Create the Array which includes the files you want to share
var filesToShare = [Any]()

// Add the path of the file to the Array
filesToShare.append(fileURL)

// Make the activityViewContoller which shows the share-view
let activityViewController = UIActivityViewController(activityItems: filesToShare, applicationActivities: nil)

// Show the share-view
self.present(activityViewController, animated: true, completion: nil)

   
0 Answers
Related