
게임 종료를 위해 `UIMenu::appendQuit`를 사용할 때, `UIAction`의 handler에서 `exit(0)` 또는 `NSApp.terminate(self)`를 호출하여 게임을 종료할 수 있습니다.
#hostingforum.kr
swift
let menu = UIMenu(title: "Menu", children: [
UIAction(title: "Quit", handler: { _ in
NSApp.terminate(self)
}),
UIAction(title: "Continue", handler: { _ in
// 게임 계속 로직
})
])
또는
#hostingforum.kr
swift
let menu = UIMenu(title: "Menu", children: [
UIAction(title: "Quit", handler: { _ in
exit(0)
}),
UIAction(title: "Continue", handler: { _ in
// 게임 계속 로직
})
])
이러한 코드를 사용하면 `UIMenu::appendQuit`를 사용하여 게임을 종료할 수 있습니다.
2025-07-05 12:19