OSDN Git Service

HMPortNotifyCommandをSwiftに変換した
authormasakih <masakih@users.sourceforge.jp>
Sun, 8 Jan 2017 07:48:42 +0000 (16:48 +0900)
committermasakih <masakih@users.sourceforge.jp>
Sun, 8 Jan 2017 07:48:42 +0000 (16:48 +0900)
KCD.xcodeproj/project.pbxproj
KCD/HMAnchorageRepairManager.m
KCD/HMAppDelegate.h
KCD/HMFleetManager.m
KCD/HMPortCommand.m
KCD/HMPortNotifyCommand.h [deleted file]
KCD/HMPortNotifyCommand.m [deleted file]
KCD/HMPortNotifyCommand.swift [new file with mode: 0644]

index d7898d1..b2bf664 100644 (file)
@@ -57,6 +57,7 @@
                F44AB24119E8252600F217AF /* HMKCSlotItemObject+Extensions.m in Sources */ = {isa = PBXBuildFile; fileRef = F44AB24019E8252600F217AF /* HMKCSlotItemObject+Extensions.m */; };
                F44BC6C11E221293004644E3 /* HMAirCorpsChangeNameCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F44BC6C01E221293004644E3 /* HMAirCorpsChangeNameCommand.swift */; };
                F44BC6C31E221865004644E3 /* HMAirCorpsSupplyCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F44BC6C21E221865004644E3 /* HMAirCorpsSupplyCommand.swift */; };
+               F44BC6C51E222279004644E3 /* HMPortNotifyCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = F44BC6C41E222279004644E3 /* HMPortNotifyCommand.swift */; };
                F4513EDD18B619B600073552 /* HMCoreDataManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EDC18B619B600073552 /* HMCoreDataManager.m */; };
                F4513EE818B77A5300073552 /* HMMemberKDockCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EE718B77A5300073552 /* HMMemberKDockCommand.m */; };
                F4513EEB18B7900A00073552 /* HMMemberDeckCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F4513EEA18B7900A00073552 /* HMMemberDeckCommand.m */; };
                F495462B1B14CBA600E0D8D0 /* HMBookmarkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = F495462A1B14CBA600E0D8D0 /* HMBookmarkManager.m */; };
                F495462E1B1894DD00E0D8D0 /* Bookmark.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = F495462C1B1894DD00E0D8D0 /* Bookmark.xcdatamodeld */; };
                F49688671B3EA16800D3CEDE /* RemoveDatabaseFileAndRestart.app in Resources */ = {isa = PBXBuildFile; fileRef = F49688661B3EA16800D3CEDE /* RemoveDatabaseFileAndRestart.app */; };
-               F499E8901B5D4E7F00189029 /* HMPortNotifyCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = F499E88F1B5D4E7F00189029 /* HMPortNotifyCommand.m */; };
                F49AABE61DFC48F300E0B24F /* MainTouchBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F49AABE51DFC48F300E0B24F /* MainTouchBar.xib */; };
                F49AABE81DFD33FB00E0B24F /* HistoryWindowTouchBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F49AABE71DFD33FB00E0B24F /* HistoryWindowTouchBar.xib */; };
                F49AABF21DFD53A300E0B24F /* SlotItemWindowTouchBar.xib in Resources */ = {isa = PBXBuildFile; fileRef = F49AABF11DFD53A300E0B24F /* SlotItemWindowTouchBar.xib */; };
                F44AB24019E8252600F217AF /* HMKCSlotItemObject+Extensions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "HMKCSlotItemObject+Extensions.m"; sourceTree = "<group>"; };
                F44BC6C01E221293004644E3 /* HMAirCorpsChangeNameCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMAirCorpsChangeNameCommand.swift; sourceTree = "<group>"; };
                F44BC6C21E221865004644E3 /* HMAirCorpsSupplyCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMAirCorpsSupplyCommand.swift; sourceTree = "<group>"; };
+               F44BC6C41E222279004644E3 /* HMPortNotifyCommand.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HMPortNotifyCommand.swift; sourceTree = "<group>"; };
                F4513EDB18B619B600073552 /* HMCoreDataManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMCoreDataManager.h; sourceTree = "<group>"; };
                F4513EDC18B619B600073552 /* HMCoreDataManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMCoreDataManager.m; sourceTree = "<group>"; };
                F4513EE618B77A5300073552 /* HMMemberKDockCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMMemberKDockCommand.h; sourceTree = "<group>"; };
                F497F63D1D5B7CE600A8F609 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/InfoPlist.strings"; sourceTree = "<group>"; };
                F497F63E1D5B7CE600A8F609 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/SlotItemShortName.plist"; sourceTree = "<group>"; };
                F497F63F1D5B7CE700A8F609 /* zh-Hant-TW */ = {isa = PBXFileReference; lastKnownFileType = text; name = "zh-Hant-TW"; path = "zh-Hant-TW.lproj/Taihi.txt"; sourceTree = "<group>"; };
-               F499E88E1B5D4E7F00189029 /* HMPortNotifyCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HMPortNotifyCommand.h; sourceTree = "<group>"; };
-               F499E88F1B5D4E7F00189029 /* HMPortNotifyCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HMPortNotifyCommand.m; sourceTree = "<group>"; };
                F49AABE51DFC48F300E0B24F /* MainTouchBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainTouchBar.xib; sourceTree = "<group>"; };
                F49AABE71DFD33FB00E0B24F /* HistoryWindowTouchBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = HistoryWindowTouchBar.xib; sourceTree = "<group>"; };
                F49AABF11DFD53A300E0B24F /* SlotItemWindowTouchBar.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = SlotItemWindowTouchBar.xib; sourceTree = "<group>"; };
                                F424A6FF1BC8C10C0096C431 /* HMFailedCommand.m */,
                                F48F7B001907D7B800E78AE1 /* HMPortCommand.h */,
                                F48F7B011907D7B800E78AE1 /* HMPortCommand.m */,
-                               F499E88E1B5D4E7F00189029 /* HMPortNotifyCommand.h */,
-                               F499E88F1B5D4E7F00189029 /* HMPortNotifyCommand.m */,
+                               F44BC6C41E222279004644E3 /* HMPortNotifyCommand.swift */,
                                F44BC6C21E221865004644E3 /* HMAirCorpsSupplyCommand.swift */,
                                F44BC6C01E221293004644E3 /* HMAirCorpsChangeNameCommand.swift */,
                        );
                                F4D05BD01E0D667600688D66 /* HMBookmarkListViewController.swift in Sources */,
                                F43769E41AE7D01D00DE6204 /* HMUpdateQuestListCommand.m in Sources */,
                                F4C1190818A746EB005D5B25 /* HMJSONTracker.m in Sources */,
+                               F44BC6C51E222279004644E3 /* HMPortNotifyCommand.swift in Sources */,
                                F4B3DC4718EEEB920011B4FC /* HMStart2Command.m in Sources */,
                                F4D05BD71E0F696C00688D66 /* HMRepairListViewController.swift in Sources */,
                                F490977F1E19ED400085A45D /* HMStrengthenListItemView.swift in Sources */,
                                F4A3AD8B19B9BE7A00FDBF80 /* HMMaskSelectView.m in Sources */,
                                F4B414E918B09A4B00468DAF /* HMMasterMapAreaCommand.m in Sources */,
                                F471784A1B6F9B5600F5E59D /* ResourceHistory.xcdatamodeld in Sources */,
-                               F499E8901B5D4E7F00189029 /* HMPortNotifyCommand.m in Sources */,
                                F424A6FA1BC801DE0096C431 /* HMUnknownComand.m in Sources */,
                                F4C3957418CDDFE500A1E918 /* HMKenzoDockStatus.m in Sources */,
                                F471784D1B6FA18800F5E59D /* HMKCResource.m in Sources */,
index 294e963..07b2957 100644 (file)
@@ -21,7 +21,6 @@
 #import "HMAppDelegate.h"
 
 #import "HMChangeHenseiNotification.h"
-#import "HMPortNotifyCommand.h"
 
 
 @interface HMAnchorageRepairManager ()
@@ -57,7 +56,7 @@
                                                                                                   object:nil];
                [nc addObserver:self
                           selector:@selector(didReturnToBaseNotification:)
-                                  name:HMPortAPIRecieveNotification
+                                  name:HMPortNotifyCommand.notificationName
                                 object:nil];
        }
        
index 86fad41..d8313bd 100644 (file)
@@ -60,7 +60,3 @@
 
 @end
 
-// defined in HMPortNotifyCommand.m
-// notification have no userinfo.
-extern NSString *HMPortAPIRecieveNotification;
-
index 72da27f..ccd960a 100644 (file)
@@ -12,8 +12,6 @@
 
 #import "HMFleet.h"
 
-#import "HMPortNotifyCommand.h"
-
 #import "HMKCShipObject+Extensions.h"
 
 
@@ -49,7 +47,7 @@ NSString *HMFleetManagerCompletePrepareFleetNotification = @"HMFleetManagerCompl
        _fleets = array;
        
        if(_fleets[0].ships.count == 0) {
-               [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDeck:) name:HMPortAPIRecieveNotification object:nil];
+               [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(updateDeck:) name:HMPortNotifyCommand.notificationName object:nil];
                
                return;
        }
index 5c4aa12..4549bf3 100644 (file)
@@ -8,6 +8,8 @@
 
 #import "HMPortCommand.h"
 
+#import "KCD-Swift.h"
+
 #import "HMMemberShipCommand.h"
 #import "HMMemberMaterialCommand.h"
 #import "HMMemberDeckCommand.h"
@@ -16,7 +18,6 @@
 #import "HMResetSortieCommand.h"
 #import "HMDropShipHistoryCommand.h"
 #import "HMDummyShipCommand.h"
-#import "HMPortNotifyCommand.h"
 #import "HMGuardShelterCommand.h"
 #import "HMCombinedCommand.h"
 
diff --git a/KCD/HMPortNotifyCommand.h b/KCD/HMPortNotifyCommand.h
deleted file mode 100644 (file)
index 519f9c9..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-//
-//  HMPortNotifyCommand.h
-//  KCD
-//
-//  Created by Hori,Masaki on 2015/07/21.
-//  Copyright (c) 2015年 Hori,Masaki. All rights reserved.
-//
-
-#import "HMJSONCommand.h"
-
-@interface HMPortNotifyCommand : HMJSONCommand
-
-@end
-
-
-extern NSString *HMPortAPIRecieveNotification;
diff --git a/KCD/HMPortNotifyCommand.m b/KCD/HMPortNotifyCommand.m
deleted file mode 100644 (file)
index 3f99b08..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-//
-//  HMPortNotifyCommand.m
-//  KCD
-//
-//  Created by Hori,Masaki on 2015/07/21.
-//  Copyright (c) 2015年 Hori,Masaki. All rights reserved.
-//
-
-#import "HMPortNotifyCommand.h"
-
-
-NSString *HMPortAPIRecieveNotification = @"HMPortAPIRecieveNotification";
-
-@implementation HMPortNotifyCommand
-
-- (void)execute
-{
-       dispatch_async(dispatch_get_main_queue(), ^{
-               NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
-               [nc postNotificationName:HMPortAPIRecieveNotification
-                                                 object:self
-                                               userInfo:nil];
-       });
-}
-
-@end
diff --git a/KCD/HMPortNotifyCommand.swift b/KCD/HMPortNotifyCommand.swift
new file mode 100644 (file)
index 0000000..2caf4dd
--- /dev/null
@@ -0,0 +1,25 @@
+//
+//  HMPortNotifyCommand.swift
+//  KCD
+//
+//  Created by Hori,Masaki on 2017/01/08.
+//  Copyright © 2017年 Hori,Masaki. All rights reserved.
+//
+
+import Cocoa
+
+extension Notification.Name {
+    static let PortAPIReceived = Notification.Name("com.masakih.KCD.Notification.PortAPIReceived")
+}
+
+class HMPortNotifyCommand: HMJSONCommand {
+    static var notificationName: String {
+        return Notification.Name.PortAPIReceived.rawValue
+    }
+    
+    override func execute() {
+        DispatchQueue.main.async {
+            NotificationCenter.default.post(name: .PortAPIReceived, object: self)
+        }
+    }
+}