I'm attempting to share a text file with a UIActivityViewController. I'm creating and writing to my file in my app, and then allowing the user to share this file using whatever means they would like.
Currently I can access the file like this:
let text2 = String(contentsOfFile: path, encoding: NSUTF8StringEncoding)
let objectsToShare = [text2]
let activityVC = UIActivityViewController(activityItems: objectsToShare, applicationActivities: nil)
self.presentViewController(activityVC, animated: true, completion: nil)
Which works well, but it shares a long string of the contents of the file. Instead, I would like to share the file itself. How can I do this with Swift?