I saw in this tutorial and also in Apple docs, that this bunch of code should work.
let d = UIDocumentMenuViewController(documentTypes: [kUTTypeText as NSString], inMode: .Import)
o.delegate = self
self.presentViewController(d, animated: true, completion: nil)
But I get a compile time error
kUTTypeText
is defined in the MobileCoreServices framework, so you should add
import MobileCoreServices
Also, as Bartłomiej correctly noticed, the type identifier has to be converted
from CFString
to String
in Swift 2/Xcode 7:
UIDocumentMenuViewController(documentTypes: [kUTTypeText as String], inMode: .Import)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With