I have the code to create and NSAlert in Objective-C but I would now like to create it in Swift.
The alert is to confirm that the user would like to delete a document.
I would like the "delete" button to then run the delete function and the "cancel" one just to dismiss the alert.
How can I write this in Swift?
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];