Skip to content

Instantly share code, notes, and snippets.

@ivanlesko
Created October 27, 2015 22:20
Show Gist options
  • Save ivanlesko/4e68b3ee0bcf696c478c to your computer and use it in GitHub Desktop.
Save ivanlesko/4e68b3ee0bcf696c478c to your computer and use it in GitHub Desktop.
PHPhotoLibrary.sharedPhotoLibrary().performChanges({ () -> Void in
_ = PHAssetChangeRequest.creationRequestForAssetFromVideoAtFileURL(outputFileURL)
}, completionHandler: { (success: Bool, error: NSError?) -> Void in
if success {
print("successfully saved video to camera roll")
do {
let _ = try NSFileManager().removeItemAtPath(outputFileURL.path!)
print("Successfully removed saved video file from local directory")
} catch let error as NSError {
print("Error removing the file from the local directory: \(error.localizedDescription)")
}
} else {
print("error saving to camera roll: \(error?.localizedDescription)")
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment