Last active
February 7, 2019 23:11
-
-
Save AppleBetas/ac3f18c1769841d5555041abc73a5c59 to your computer and use it in GitHub Desktop.
NSAlert+QuickAlert.swift - A Swift NSAlert extension to quickly show alerts (macOS)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSAlert+QuickAlert.swift | |
// | |
// Created by AppleBetas on 2016-10-24. | |
// Copyright © 2016 AppleBetas. All rights reserved. | |
// | |
import Cocoa | |
extension NSAlert { | |
static func showAlert(title: String?, message: String?, style: NSAlertStyle = .informational) { | |
let alert = NSAlert() | |
if let title = title { | |
alert.messageText = title | |
} | |
if let message = message { | |
alert.informativeText = message | |
} | |
alert.alertStyle = style | |
alert.runModal() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment