title: How do I write video/image to saved photos album using PHPhotoLibrary?
body: <p>Hi all I'm using ALAssetsLibrary to write videos/images to the album. 
  But XCode is telling me that ALAssetsLibrary is deprecated and I need to use PHPhotoLibrary, which is all well and good but there are no examples or documentation of how to make this transition.</p>
  
  <p>Can anyone show me how to change this code to use PHPHotoLibrary?</p>
  
  <pre><code>let data:NSData = AVCaptureStillImageOutput.jpegStillImageNSDataRepresentation(imageDataSampleBuffer)
  let image:UIImage = UIImage( data: data)!
  
  let library:ALAssetsLibrary = ALAssetsLibrary()
  let orientation: ALAssetOrientation = ALAssetOrientation(rawValue: image.imageOrientation.rawValue)!
  library.writeImageToSavedPhotosAlbum(image.CGImage, orientation: orientation, completionBlock: nil)
  </code></pre>
  
  <p>and for video:</p>
  
  <pre><code>    ALAssetsLibrary().writeVideoAtPathToSavedPhotosAlbum(outputFileURL, completionBlock: {
          (assetURL:NSURL!, error:NSError!) in
          if error != nil{
              print(error)
  
          }
  
          do {
              try NSFileManager.defaultManager().removeItemAtURL(outputFileURL)
          } catch _ {
          }
  
          if backgroundRecordId != UIBackgroundTaskInvalid {
              UIApplication.sharedApplication().endBackgroundTask(backgroundRecordId)
          }
  
      })
  </code></pre>