title: How to use the file path API from Swift to get documents directory and create filenames
body: <p>I have this code to record video with AVFoundation but I don't know how convert to Swift</p>
  
  <pre><code>- (void)startRecording 
  {    
      NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
      [formatter setDateFormat:@"yyyy-MM-dd-HH-mm-ss"];
      NSString* dateTimePrefix = [formatter stringFromDate:[NSDate date]];
  
      int fileNamePostfix = 0;
      NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
      NSString *documentsDirectory = [paths objectAtIndex:0];
      NSString *filePath = nil;
      do
          filePath =[NSString stringWithFormat:@"/%@/%@-%i.mp4", documentsDirectory, dateTimePrefix, fileNamePostfix++];
      while ([[NSFileManager defaultManager] fileExistsAtPath:filePath]);
  
      NSURL *fileURL = [NSURL URLWithString:[@"file://" stringByAppendingString:filePath]];
      [self.fileOutput startRecordingToOutputFileURL:fileURL recordingDelegate:self];
  }
  </code></pre>
  
  <p>I don't know how work with  this paths in Swift.. </p>
  
  <p>Thanks!!</p>