From: masakih Date: Mon, 13 Aug 2018 08:00:52 +0000 (+0900) Subject: ArrayをSetに変更 X-Git-Url: http://git.osdn.net/view?p=kcd%2FKCD.git;a=commitdiff_plain;h=0285e383a6949153632e914824ecec2747c541fd ArrayをSetに変更 containsを多用するため --- diff --git a/KCD/API.swift b/KCD/API.swift index 25300da0..0a27418d 100644 --- a/KCD/API.swift +++ b/KCD/API.swift @@ -204,7 +204,7 @@ struct API { } } - func includs(in rawValues: [String]) -> Bool { + func includs(in rawValues: Set) -> Bool { return rawValues.contains(endpointString) } diff --git a/KCD/IgnoreCommand.swift b/KCD/IgnoreCommand.swift index 799cb9ed..11cda4cb 100644 --- a/KCD/IgnoreCommand.swift +++ b/KCD/IgnoreCommand.swift @@ -10,7 +10,7 @@ import Cocoa final class IgnoreCommand: JSONCommand { - private static let ignores: [String] = { + private static let ignores: Set = { guard let url = Bundle.main.url(forResource: "IgnoreCommand", withExtension: "plist"), let array = NSArray(contentsOf: url) as? [String] else { @@ -18,7 +18,7 @@ final class IgnoreCommand: JSONCommand { fatalError("Can not read IgnoreCommand.plist") } - return array + return Set(array) }() override class func canExecuteAPI(_ api: API) -> Bool {