Use async await in runSheetOnWindow.

This commit is contained in:
Brent Simmons 2024-05-05 22:01:26 -07:00
parent 3d91a6b38d
commit c46494de13
1 changed files with 6 additions and 5 deletions

View File

@ -10,8 +10,8 @@ import AppKit
import Articles
import Account
class AddFolderWindowController : NSWindowController {
final class AddFolderWindowController : NSWindowController {
@IBOutlet var folderNameTextField: NSTextField!
@IBOutlet var accountPopupButton: NSPopUpButton!
@IBOutlet var addFolderButton: NSButton!
@ -25,9 +25,10 @@ class AddFolderWindowController : NSWindowController {
func runSheetOnWindow(_ w: NSWindow) {
hostWindow = w
hostWindow!.beginSheet(window!) { (returnCode: NSApplication.ModalResponse) -> Void in
if returnCode == NSApplication.ModalResponse.OK {
Task { @MainActor in
let returnCode = await hostWindow!.beginSheet(window!)
if returnCode == .OK {
self.addFolderIfNeeded()
}
}