I am trying to transfer a text file using the UIActivityViewController. I create and write to my file in my application, and then allow the user to share this file using any means that they would like.
Currently, I can access the file as follows:
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 splits a long line of file content. Instead, I would like to share the file. How can I do this with Swift?
source share