Created
July 23, 2014 22:43
-
-
Save jarek-foksa/f52817f44e23b805d594 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import Cocoa | |
class MainMenuController : NSObject, NSMenuDelegate { | |
init() { | |
} | |
private func forEach(callback: (NSMenuItem)->()) { | |
func walk(menu: NSMenu) { | |
for item in menu.itemArray { | |
callback(item as NSMenuItem) | |
if item.hasSubmenu { | |
walk(item.submenu) | |
} | |
} | |
} | |
walk(NSApp.mainMenu) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
class MainMenuController : NSObject, NSMenuDelegate {
}