Reputation: 854
I am copying video from DocumentDirectory
to Pasteboard
with this code .
let data: NSData = NSData(contentsOfURL: NSURL(fileURLWithPath: outputurl))!
let pasteBoard: UIPasteboard = UIPasteboard.generalPasteboard()
pasteBoard.setData(data, forPasteboardType: String(kUTTypeVideo))
Now can anybody help me how to get this video and use in different place From pasteboard.
Upvotes: 1
Views: 500
Reputation: 422
Swift version of Ronak's answer
import MobileCoreServices
let pasteboard = UIPasteboard.general
let data = UIPasteboard.general.data(forPasteboardType: kUTTypeQuickTimeMovie as String)
Upvotes: 0
Reputation: 5435
See Objective-C code below, hope you can convert it to swift:
APIs
for reading data from Pasteboard.
//returns data
- (NSData *)dataForPasteboardType:(NSString *)pasteboardType;
//returns value
- (id)valueForPasteboardType:(NSString *)pasteboardType;
Example:
UIPasteboard * pasteboard=[UIPasteboard generalPasteboard];
NSData * data = [pasteboard dataForPasteboardType:(NSString*)kUTTypeVideo];
For more detail check article here:
http://hayageek.com/uipasteboard-example-read-write-share/
Upvotes: 1