How to convert this code to Swift for saving video? -



How to convert this code to Swift for saving video? -

i have code save video:

(void)saverecordedfile:(nsurl *)recordedfile {

[svprogresshud showwithstatus:@"saving..." masktype:svprogresshudmasktypegradient];

dispatch_queue_t queue = dispatch_get_global_queue(dispatch_queue_priority_default, 0); dispatch_async(queue, ^{

alassetslibrary *assetlibrary = [[alassetslibrary alloc] init]; [assetlibrary writevideoatpathtosavedphotosalbum:recordedfile completionblock: ^(nsurl *asseturl, nserror *error) { dispatch_async(dispatch_get_main_queue(), ^{ [svprogresshud dismiss]; nsstring *title; nsstring *message; if (error != nil) { title = @"failed save video"; message = [error localizeddescription]; } else { title = @"saved!"; message = nil; } uialertview *alert = [[uialertview alloc] initwithtitle:title message:message delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil]; [alert show]; }); }];

}); }

i want convert swift, , don't know how alter lines:

alassetslibrary *assetlibrary = [[alassetslibrary alloc] init]; [assetlibrary writevideoatpathtosavedphotosalbum:recordedfile completionblock: ^(nsurl *asseturl, nserror *error)

how can convert completionblock ^(nsurl *asseturl, nserror *error) swift?

thanks!!

i solved with:

typealias alassetslibrarywritevideocompletionblock = (nsurl!, nserror!) -> void var finish : alassetslibrarywritevideocompletionblock = {reason in println(reason)} library.writevideoatpathtosavedphotosalbum( fileurl, complete)

thanks!

video swift avfoundation ios8

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

c# - Create a Notification Object (Email or Page) At Run Time -- Dependency Injection or Factory -

Set Up Of Common Name Of SSL Certificate To Protect Plesk Panel -