Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func showDialog(buttons: Int8 = 1, question: String, text: String? = nil, confirmButton: String, accessoryView: NSView? = nil, completion: (_ confirm: Bool) -> Void) {
- let alert = NSAlert()
- alert.messageText = question
- alert.addButton(withTitle: confirmButton)
- if let text = text {
- alert.informativeText = text
- }
- if buttons >= 2 {
- alert.addButton(withTitle: "Cancel")
- }
- if let accessoryView = accessoryView {
- alert.accessoryView = accessoryView
- }
- completion(alert.runModal() == .alertFirstButtonReturn)
- }
- let passwordView = NSTextView(frame: NSMakeRect(0, 0, 250, 18))
- Helper.showDialog(question: "Your Password", confirmButton: "Build", accessoryView: passwordView) {_ in
- //
- }
Add Comment
Please, Sign In to add comment