Advertisement
Guest User

Untitled

a guest
Jul 3rd, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. func createSomeFile() {
  2.  
  3. var output = (some NSData to output to file)
  4.  
  5.  
  6. let fileName = NSTemporaryDirectory().stringByAppendingPathComponent("filename.ext")
  7. let url: NSURL! = NSURL(fileURLWithPath: fileName)
  8.  
  9. var dataToWrite = output.dataUsingEncoding(NSUTF8StringEncoding)
  10. dataToWrite?.writeToFile(url.absoluteString!, atomically: true)
  11.  
  12. documentController = UIDocumentInteractionController(URL: url)
  13. documentController.UTI = "com.someUTI"
  14. documentController.delegate = self
  15.  
  16. documentController.presentOpenInMenuFromRect(CGRectZero, inView: self, animated: true)
  17. }
  18.  
  19. documentController.presentOpenInMenuFromRect(CGRectZero, inView: self.view, animated: true)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement