title: Create an NSAlert with Swift
body: <p>I have the code to create and NSAlert in Objective-C but I would now like to create it in Swift. </p>
  
  <p>The alert is to confirm that the user would like to delete a document. </p>
  
  <p>I would like the "delete" button to then run the delete function and the "cancel" one just to dismiss the alert.</p>
  
  <p>How can I write this in Swift?</p>
  
  <pre><code>NSAlert *alert = [[[NSAlert alloc] init] autorelease];
  [alert addButtonWithTitle:@"Delete"];
  [alert addButtonWithTitle:@"Cancel"];
  [alert setMessageText:@"Delete the document?"];
  [alert setInformativeText:@"Are you sure you would like to delete the document?"];
  [alert setAlertStyle:NSWarningAlertStyle];
  [alert beginSheetModalForWindow:[self window] modalDelegate:self didEndSelector:@selector(alertDidEnd:returnCode:contextInfo:) contextInfo:nil];
  </code></pre>