OSDN Git Service

関数を直接引数に渡せる場合はtaling cloureを使わないようにした
authormasakih <masakih@users.sourceforge.jp>
Tue, 10 Oct 2017 15:04:01 +0000 (00:04 +0900)
committermasakih <masakih@users.sourceforge.jp>
Tue, 10 Oct 2017 15:04:01 +0000 (00:04 +0900)
21 files changed:
KCD/AncherageRepairTimerViewController.swift
KCD/BroserWindowController.swift
KCD/CombinedCommand.swift
KCD/DestroyItem2Command.swift
KCD/DocksViewController.swift
KCD/DummyShipCommand.swift
KCD/GuardShelterCommand.swift
KCD/HistoryItemCleaner.swift
KCD/HistoryTableViewController.swift
KCD/MapInfoCommand.swift
KCD/NyukyoStartCommand.swift
KCD/RealDestroyShipCommand.swift
KCD/RealPowerUpCommand.swift
KCD/RemodelSlotItemCommand.swift
KCD/ResetSortie.swift
KCD/ResourceHistoryManager.swift
KCD/ScreenshotInformation.swift
KCD/ScreenshotListViewController.swift
KCD/SlotItemMapper.swift
KCD/SlotResetCommand.swift
KCD/UpdateQuestListCommand.swift

index 74854c0..bc32c4f 100644 (file)
@@ -65,8 +65,7 @@ final class AncherageRepairTimerViewController: NSViewController {
     
     private func refleshTrackingArea() {
         
-        view.trackingAreas
-            .forEach { view.removeTrackingArea($0) }
+        view.trackingAreas.forEach(view.removeTrackingArea)
         trackingArea = NSTrackingArea(rect: screenshotButton.frame,
                                       options: [.mouseEnteredAndExited, .activeInActiveApp],
                                       owner: self,
index 5ddf5df..38db46b 100644 (file)
@@ -222,7 +222,7 @@ extension BroserWindowController {
     @IBAction func clearQuestList(_ sender: AnyObject?) {
         
         let store = ServerDataStore.oneTimeEditor()
-        store.quests().forEach { store.delete($0) }
+        store.quests().forEach(store.delete)
     }
     
     @IBAction func selectView(_ sender: AnyObject?) {
index 4a71007..e47ac87 100644 (file)
@@ -38,8 +38,7 @@ final class CombinedCommand: JSONCommand {
             
             if let t = data["api_combined_flag"].int {
                 
-                CombineType(rawValue: t)
-                    .map { postNotification(withType: $0) }
+                CombineType(rawValue: t).map(postNotification(withType:))
                 
             } else {
                 
@@ -52,7 +51,7 @@ final class CombinedCommand: JSONCommand {
         parameter["api_combined_type"]
             .int
             .flatMap { CombineType(rawValue: $0) }
-            .map { postNotification(withType: $0) }
+            .map(postNotification(withType:))
     }
     
     private func postNotification(withType type: CombineType) {
index 4664c7b..9c52178 100644 (file)
@@ -30,7 +30,7 @@ final class DestroyItem2Command: JSONCommand {
         
         let store = ServerDataStore.oneTimeEditor()
         
-        store.slotItems(in: itemIds).forEach { store.delete($0) }
+        store.slotItems(in: itemIds).forEach(store.delete)
         
         guard let material = store.material() else {
             
index 6fe736b..aaf7781 100644 (file)
@@ -15,15 +15,15 @@ final class DocksViewController: MainTabVIewItemViewController {
         [NSBindingName(#keyPath(deck2Time)), NSBindingName(#keyPath(mission2Name)),
          NSBindingName(#keyPath(deck3Time)), NSBindingName(#keyPath(mission3Name)),
          NSBindingName(#keyPath(deck4Time)), NSBindingName(#keyPath(mission4Name))]
-            .forEach { unbind($0) }
+            .forEach(unbind)
         [NSBindingName(#keyPath(nDock1Time)), NSBindingName(#keyPath(nDock1ShipName)),
          NSBindingName(#keyPath(nDock2Time)), NSBindingName(#keyPath(nDock2ShipName)),
          NSBindingName(#keyPath(nDock3Time)), NSBindingName(#keyPath(nDock3ShipName)),
          NSBindingName(#keyPath(nDock4Time)), NSBindingName(#keyPath(nDock4ShipName))]
-            .forEach { unbind($0) }
+            .forEach(unbind)
         [NSBindingName(#keyPath(kDock1Time)), NSBindingName(#keyPath(kDock2Time)),
          NSBindingName(#keyPath(kDock3Time)), NSBindingName(#keyPath(kDock4Time))]
-            .forEach { unbind($0) }
+            .forEach(unbind)
         
         ["selection", "selection.no", "content.battleCell"]
             .forEach {
index 3c1007d..2621563 100644 (file)
@@ -41,7 +41,7 @@ final class DummyShipCommand: JSONCommand {
         
         let store = ServerDataStore.oneTimeEditor()
         
-        store.ships(by: -2).forEach { store.delete($0) }
+        store.ships(by: -2).forEach(store.delete)
         DummyShipCommand.needsEnterDummy = false
     }
 }
index baf5e5c..cc3c76e 100644 (file)
@@ -128,7 +128,7 @@ final class GuardShelterCommand: JSONCommand {
         
         let store = TemporaryDataStore.oneTimeEditor()
         
-        store.notEnsuredGuardEscaped().forEach { store.delete($0) }
+        store.notEnsuredGuardEscaped().forEach(store.delete)
         store.save()
         Thread.sleep(forTimeInterval: 0.1)
         notify()
@@ -138,7 +138,7 @@ final class GuardShelterCommand: JSONCommand {
         
         let store = TemporaryDataStore.oneTimeEditor()
         
-        store.guardEscaped().forEach { store.delete($0) }
+        store.guardEscaped().forEach(store.delete)
         store.save()
         Thread.sleep(forTimeInterval: 0.1)
         notify()
index 48f3f52..d74982a 100644 (file)
@@ -17,11 +17,8 @@ final class HistoryItemCleaner {
         let store = LocalDataStore.oneTimeEditor()
         let cleanSinceDays = UserDefaults.standard[.cleanSinceDays]
         
-        store.unmarkedKaihatuHistories(befor: cleanSinceDays)
-            .forEach { store.delete($0) }
-        store.unmarkedKenzoHistories(befor: cleanSinceDays)
-            .forEach { store.delete($0) }
-        store.unmarkedDropShipHistories(befor: cleanSinceDays)
-            .forEach { store.delete($0) }
+        store.unmarkedKaihatuHistories(befor: cleanSinceDays).forEach(store.delete)
+        store.unmarkedKenzoHistories(befor: cleanSinceDays).forEach(store.delete)
+        store.unmarkedDropShipHistories(befor: cleanSinceDays).forEach(store.delete)
     }
 }
index 7b03da5..4958c4a 100644 (file)
@@ -53,7 +53,7 @@ class HistoryTableViewController: NSViewController {
         selection
             .lazy
             .map { $0.objectID }
-            .map { store.object(with: $0) }
+            .map(store.object(with:))
             .forEach(store.delete)
         
         if selectedIndex > 1 {
index df6a005..60c0fd3 100644 (file)
@@ -21,7 +21,7 @@ final class MapInfoCommand: JSONCommand {
         
         let store = ServerDataStore.oneTimeEditor()
         
-        store.airBases().forEach { store.delete($0) }
+        store.airBases().forEach(store.delete)
         store.save()
         
         AirBaseMapper(apiResponse).commit()
index cd5e540..2c552ec 100644 (file)
@@ -25,7 +25,7 @@ final class NyukyoStartCommand: JSONCommand {
         
         parameter["api_ship_id"]
             .int
-            .flatMap { store.ship(by: $0) }
+            .flatMap(store.ship(by:))
             .map { $0.nowhp = $0.maxhp }
         
         store.material()
index 81d21a1..f5a52c2 100644 (file)
@@ -16,7 +16,7 @@ final class RealDestroyShipCommand: JSONCommand {
         
         parameter["api_ship_id"]
             .int
-            .flatMap { store.ship(by: $0) }
-            .flatMap { store.delete($0) }
+            .flatMap(store.ship(by:))
+            .flatMap(store.delete)
     }
 }
index 7f9921a..29f099b 100644 (file)
@@ -18,7 +18,7 @@ final class RealPowerUpCommand: JSONCommand {
             .string?
             .components(separatedBy: ",")
             .flatMap { Int($0) }
-            .flatMap { store.ship(by: $0) }
-            .forEach { store.delete($0) }
+            .flatMap(store.ship(by:))
+            .forEach(store.delete)
     }
 }
index fd6f4f5..dc157e4 100644 (file)
@@ -50,6 +50,6 @@ final class RemodelSlotItemCommand: JSONCommand {
         // remove used slot items.
         guard let useSlot = data["api_use_slot_id"].arrayObject as? [Int] else { return }
         
-        store.slotItems(in: useSlot).forEach { store.delete($0) }
+        store.slotItems(in: useSlot).forEach(store.delete)
     }
 }
index c49a2e2..7d3b7c9 100644 (file)
@@ -14,6 +14,6 @@ final class ResetSortie {
         
         let store = TemporaryDataStore.oneTimeEditor()
         
-        store.battles().forEach { store.delete($0) }
+        store.battles().forEach(store.delete)
     }
 }
index d6ec349..01b7068 100644 (file)
@@ -107,7 +107,7 @@ final class ResourceHistoryManager: NSObject {
     
     private func reduceResourceByConditions(_ store: ResourceHistoryDataStore, _ target: [Int], _ ago: Date) {
         
-        store.resources(in: target, older: ago).forEach { store.delete($0) }
+        store.resources(in: target, older: ago).forEach(store.delete)
     }
     
     private func dateOfMonth(_ month: Int) -> Date {
index a109fb0..ae73710 100644 (file)
@@ -105,7 +105,6 @@ extension ScreenshotInformation {
     
     @objc var creationDateString: String? {
         
-        return creationDate
-            .map { dateFormatter.string(from: $0) }
+        return creationDate.map(dateFormatter.string(from:))
     }
 }
index 5331fa9..6b3d1b2 100644 (file)
@@ -158,8 +158,7 @@ final class ScreenshotListViewController: NSViewController {
         
         viewFrameDidChange(nil)
         
-        DispatchQueue.main
-            .asyncAfter(deadline: .now() + 0.0001 ) { self.reloadData() }
+        DispatchQueue.main.asyncAfter(deadline: .now() + 0.0001, execute: self.reloadData)
     }
     
     override func prepare(for segue: NSStoryboardSegue, sender: Any?) {
index 1946925..9acfeec 100644 (file)
@@ -89,7 +89,7 @@ final class SlotItemMapper: JSONMapper {
         
         guard let store = configuration.editorStore as? ServerDataStore else { return }
         
-        store.slotItems(exclude: registerIds).forEach { store.delete($0) }
+        store.slotItems(exclude: registerIds).forEach(store.delete)
     }
     
     private func setMaster(_ masterId: Int, to slotItem: SlotItem?) {
index 891bb7b..c7d58f1 100644 (file)
@@ -21,7 +21,7 @@ final class SlotResetCommand: JSONCommand {
         
         let store = ServerDataStore.oneTimeEditor()
         
-        guard let ship = parameter["api_id"].int.flatMap({ store.ship(by: $0) }) else {
+        guard let ship = parameter["api_id"].int.flatMap(store.ship(by:)) else {
             
             print("api_id is wrong")
             return
@@ -32,7 +32,7 @@ final class SlotResetCommand: JSONCommand {
             return
         }
         
-        slotItems.enumerated().forEach { ship.setItem($0.element, to: $0.offset) }
+        zip(slotItems, 0...).forEach(ship.setItem)
         
         let storedSlotItems = store.sortedSlotItemsById()
         let newSet = slotItems
index ee1dced..7a82d4d 100644 (file)
@@ -16,7 +16,7 @@ final class UpdateQuestListCommand: JSONCommand {
         
         parameter["api_quest_id"]
             .int
-            .flatMap { store.quest(by: $0) }
+            .flatMap(store.quest(by:))
             .map {
                 $0.progress_flag = 0
                 $0.state = 1