Use lightweight generic declarations in ACEView

This commit is contained in:
Matthias Neeracher 2015-12-13 01:01:04 +01:00 committed by Matthias Neeracher
parent bf1bbf63b2
commit b7628c8c65
2 changed files with 4 additions and 4 deletions

View File

@ -10,7 +10,7 @@ import Foundation
extension ACEView { extension ACEView {
class func themeIdByName(themeName: String) -> ACETheme? { class func themeIdByName(themeName: String) -> ACETheme? {
for (themeIdx, theme) in (ACEThemeNames.themeNames() as! [String]).enumerate() { for (themeIdx, theme) in ACEThemeNames.themeNames() .enumerate() {
if themeName == theme { if themeName == theme {
return ACETheme(rawValue: UInt(themeIdx)) return ACETheme(rawValue: UInt(themeIdx))
} }
@ -19,7 +19,7 @@ extension ACEView {
} }
class func handlerIdByName(handlerName: String) -> ACEKeyboardHandler? { class func handlerIdByName(handlerName: String) -> ACEKeyboardHandler? {
for (handlerIdx, handler) in (ACEKeyboardHandlerNames.humanKeyboardHandlerNames() as! [String]).enumerate() { for (handlerIdx, handler) in ACEKeyboardHandlerNames.humanKeyboardHandlerNames().enumerate() {
if handlerName == handler { if handlerName == handler {
return ACEKeyboardHandler(rawValue: UInt(handlerIdx))! return ACEKeyboardHandler(rawValue: UInt(handlerIdx))!
} }

View File

@ -52,12 +52,12 @@ class ASApplication: NSObject, NSApplicationDelegate, NSMenuDelegate {
} }
func applicationDidFinishLaunching(aNotification: NSNotification) { func applicationDidFinishLaunching(aNotification: NSNotification) {
themeMenu.removeAllItems() themeMenu.removeAllItems()
for (index, theme) in (ACEThemeNames.humanThemeNames() as! [String]).enumerate() { for (index, theme) in ACEThemeNames.humanThemeNames().enumerate() {
let menuItem = themeMenu.addItemWithTitle(theme, action: "changeTheme:", keyEquivalent: "")! let menuItem = themeMenu.addItemWithTitle(theme, action: "changeTheme:", keyEquivalent: "")!
menuItem.tag = index menuItem.tag = index
} }
keyboardMenu.removeAllItems() keyboardMenu.removeAllItems()
for (index, theme) in (ACEKeyboardHandlerNames.humanKeyboardHandlerNames() as! [String]).enumerate() { for (index, theme) in ACEKeyboardHandlerNames.humanKeyboardHandlerNames().enumerate() {
let menuItem = keyboardMenu.addItemWithTitle(theme, action: "changeKeyboardHandler:", keyEquivalent: "")! let menuItem = keyboardMenu.addItemWithTitle(theme, action: "changeKeyboardHandler:", keyEquivalent: "")!
menuItem.tag = index menuItem.tag = index
} }