Browse Source

Replaced the network list with Obj-C

Grant Limberg 9 years ago
parent
commit
d965768004

+ 13 - 9
ZeroTier One.xcodeproj/project.pbxproj

@@ -10,13 +10,11 @@
 		932D472F1D1CD499004BCFE2 /* ZeroTierIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 932D472E1D1CD499004BCFE2 /* ZeroTierIcon.icns */; };
 		932D472F1D1CD499004BCFE2 /* ZeroTierIcon.icns in Resources */ = {isa = PBXBuildFile; fileRef = 932D472E1D1CD499004BCFE2 /* ZeroTierIcon.icns */; };
 		932D47331D1CD861004BCFE2 /* PreferencesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */; };
 		932D47331D1CD861004BCFE2 /* PreferencesViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */; };
 		932D47371D1CDC9B004BCFE2 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */; };
 		932D47371D1CDC9B004BCFE2 /* AboutViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */; };
-		9330F13B1CF534E500687EC8 /* NetworkInfoCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */; };
 		93326BDC1CE7C816005CA2AC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93326BDB1CE7C816005CA2AC /* AppDelegate.swift */; };
 		93326BDC1CE7C816005CA2AC /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93326BDB1CE7C816005CA2AC /* AppDelegate.swift */; };
 		93326BDE1CE7C816005CA2AC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 93326BDD1CE7C816005CA2AC /* Assets.xcassets */; };
 		93326BDE1CE7C816005CA2AC /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 93326BDD1CE7C816005CA2AC /* Assets.xcassets */; };
 		93326BE11CE7C816005CA2AC /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BDF1CE7C816005CA2AC /* MainMenu.xib */; };
 		93326BE11CE7C816005CA2AC /* MainMenu.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BDF1CE7C816005CA2AC /* MainMenu.xib */; };
 		93326BEA1CE7D9B9005CA2AC /* JoinNetworkViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93326BE81CE7D9B9005CA2AC /* JoinNetworkViewController.swift */; };
 		93326BEA1CE7D9B9005CA2AC /* JoinNetworkViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93326BE81CE7D9B9005CA2AC /* JoinNetworkViewController.swift */; };
 		93326BEB1CE7D9B9005CA2AC /* JoinNetworkViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */; };
 		93326BEB1CE7D9B9005CA2AC /* JoinNetworkViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */; };
-		93326BEE1CE7DA30005CA2AC /* ShowNetworksViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93326BEC1CE7DA30005CA2AC /* ShowNetworksViewController.swift */; };
 		93326BEF1CE7DA30005CA2AC /* ShowNetworksViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */; };
 		93326BEF1CE7DA30005CA2AC /* ShowNetworksViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */; };
 		93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1675E1D54191C00330C99 /* NodeStatus.m */; };
 		93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1675E1D54191C00330C99 /* NodeStatus.m */; };
 		93D167621D541BC200330C99 /* ServiceCom.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167611D541BC200330C99 /* ServiceCom.m */; };
 		93D167621D541BC200330C99 /* ServiceCom.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167611D541BC200330C99 /* ServiceCom.m */; };
@@ -24,6 +22,8 @@
 		93D167691D57E7EA00330C99 /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167681D57E7EA00330C99 /* AboutViewController.m */; };
 		93D167691D57E7EA00330C99 /* AboutViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167681D57E7EA00330C99 /* AboutViewController.m */; };
 		93D1676D1D57EB8400330C99 /* PreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1676C1D57EB8400330C99 /* PreferencesViewController.m */; };
 		93D1676D1D57EB8400330C99 /* PreferencesViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1676C1D57EB8400330C99 /* PreferencesViewController.m */; };
 		93D167701D57FD3800330C99 /* NetworkMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1676F1D57FD3800330C99 /* NetworkMonitor.m */; };
 		93D167701D57FD3800330C99 /* NetworkMonitor.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D1676F1D57FD3800330C99 /* NetworkMonitor.m */; };
+		93D167731D58093C00330C99 /* NetworkInfoCell.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167721D58093C00330C99 /* NetworkInfoCell.m */; };
+		93D167761D580C3500330C99 /* ShowNetworksViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 93D167751D580C3500330C99 /* ShowNetworksViewController.m */; };
 		93DAFB271D3F0BEE004D5417 /* about.html in Resources */ = {isa = PBXBuildFile; fileRef = 93DAFB261D3F0BEE004D5417 /* about.html */; };
 		93DAFB271D3F0BEE004D5417 /* about.html in Resources */ = {isa = PBXBuildFile; fileRef = 93DAFB261D3F0BEE004D5417 /* about.html */; };
 		93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */; };
 		93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */ = {isa = PBXBuildFile; fileRef = 93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */; };
 /* End PBXBuildFile section */
 /* End PBXBuildFile section */
@@ -32,7 +32,6 @@
 		932D472E1D1CD499004BCFE2 /* ZeroTierIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = ZeroTierIcon.icns; sourceTree = "<group>"; };
 		932D472E1D1CD499004BCFE2 /* ZeroTierIcon.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = ZeroTierIcon.icns; sourceTree = "<group>"; };
 		932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesViewController.xib; sourceTree = "<group>"; };
 		932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = PreferencesViewController.xib; sourceTree = "<group>"; };
 		932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AboutViewController.xib; sourceTree = "<group>"; };
 		932D47351D1CDC9B004BCFE2 /* AboutViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = AboutViewController.xib; sourceTree = "<group>"; };
-		9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NetworkInfoCell.swift; sourceTree = "<group>"; };
 		93326BD81CE7C816005CA2AC /* ZeroTier One.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ZeroTier One.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		93326BD81CE7C816005CA2AC /* ZeroTier One.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "ZeroTier One.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 		93326BDB1CE7C816005CA2AC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		93326BDB1CE7C816005CA2AC /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
 		93326BDD1CE7C816005CA2AC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
 		93326BDD1CE7C816005CA2AC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
@@ -40,7 +39,6 @@
 		93326BE21CE7C816005CA2AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		93326BE21CE7C816005CA2AC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 		93326BE81CE7D9B9005CA2AC /* JoinNetworkViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JoinNetworkViewController.swift; sourceTree = "<group>"; };
 		93326BE81CE7D9B9005CA2AC /* JoinNetworkViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = JoinNetworkViewController.swift; sourceTree = "<group>"; };
 		93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = JoinNetworkViewController.xib; sourceTree = "<group>"; };
 		93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = JoinNetworkViewController.xib; sourceTree = "<group>"; };
-		93326BEC1CE7DA30005CA2AC /* ShowNetworksViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ShowNetworksViewController.swift; sourceTree = "<group>"; };
 		93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShowNetworksViewController.xib; sourceTree = "<group>"; };
 		93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ShowNetworksViewController.xib; sourceTree = "<group>"; };
 		93D1675D1D54191C00330C99 /* NodeStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeStatus.h; sourceTree = "<group>"; };
 		93D1675D1D54191C00330C99 /* NodeStatus.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeStatus.h; sourceTree = "<group>"; };
 		93D1675E1D54191C00330C99 /* NodeStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NodeStatus.m; sourceTree = "<group>"; };
 		93D1675E1D54191C00330C99 /* NodeStatus.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NodeStatus.m; sourceTree = "<group>"; };
@@ -54,6 +52,10 @@
 		93D1676C1D57EB8400330C99 /* PreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesViewController.m; sourceTree = "<group>"; };
 		93D1676C1D57EB8400330C99 /* PreferencesViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PreferencesViewController.m; sourceTree = "<group>"; };
 		93D1676E1D57FD3800330C99 /* NetworkMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkMonitor.h; sourceTree = "<group>"; };
 		93D1676E1D57FD3800330C99 /* NetworkMonitor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkMonitor.h; sourceTree = "<group>"; };
 		93D1676F1D57FD3800330C99 /* NetworkMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkMonitor.m; sourceTree = "<group>"; };
 		93D1676F1D57FD3800330C99 /* NetworkMonitor.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkMonitor.m; sourceTree = "<group>"; };
+		93D167711D58093C00330C99 /* NetworkInfoCell.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetworkInfoCell.h; sourceTree = "<group>"; };
+		93D167721D58093C00330C99 /* NetworkInfoCell.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetworkInfoCell.m; sourceTree = "<group>"; };
+		93D167741D580C3500330C99 /* ShowNetworksViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ShowNetworksViewController.h; sourceTree = "<group>"; };
+		93D167751D580C3500330C99 /* ShowNetworksViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ShowNetworksViewController.m; sourceTree = "<group>"; };
 		93DAFB261D3F0BEE004D5417 /* about.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = about.html; sourceTree = "<group>"; };
 		93DAFB261D3F0BEE004D5417 /* about.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = about.html; sourceTree = "<group>"; };
 		93DAFE491CFE53C900547CC4 /* ZeroTier One-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ZeroTier One-Bridging-Header.h"; sourceTree = "<group>"; };
 		93DAFE491CFE53C900547CC4 /* ZeroTier One-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ZeroTier One-Bridging-Header.h"; sourceTree = "<group>"; };
 		93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthtokenCopy.m; sourceTree = "<group>"; };
 		93DAFE4A1CFE53CA00547CC4 /* AuthtokenCopy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AuthtokenCopy.m; sourceTree = "<group>"; };
@@ -94,9 +96,6 @@
 				93326BDB1CE7C816005CA2AC /* AppDelegate.swift */,
 				93326BDB1CE7C816005CA2AC /* AppDelegate.swift */,
 				93326BE81CE7D9B9005CA2AC /* JoinNetworkViewController.swift */,
 				93326BE81CE7D9B9005CA2AC /* JoinNetworkViewController.swift */,
 				93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */,
 				93326BE91CE7D9B9005CA2AC /* JoinNetworkViewController.xib */,
-				9330F13A1CF534E500687EC8 /* NetworkInfoCell.swift */,
-				93326BEC1CE7DA30005CA2AC /* ShowNetworksViewController.swift */,
-				93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */,
 				93326BDD1CE7C816005CA2AC /* Assets.xcassets */,
 				93326BDD1CE7C816005CA2AC /* Assets.xcassets */,
 				93326BDF1CE7C816005CA2AC /* MainMenu.xib */,
 				93326BDF1CE7C816005CA2AC /* MainMenu.xib */,
 				93326BE21CE7C816005CA2AC /* Info.plist */,
 				93326BE21CE7C816005CA2AC /* Info.plist */,
@@ -118,6 +117,11 @@
 				93D1676B1D57EB8400330C99 /* PreferencesViewController.h */,
 				93D1676B1D57EB8400330C99 /* PreferencesViewController.h */,
 				93D1676C1D57EB8400330C99 /* PreferencesViewController.m */,
 				93D1676C1D57EB8400330C99 /* PreferencesViewController.m */,
 				932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */,
 				932D47311D1CD861004BCFE2 /* PreferencesViewController.xib */,
+				93D167711D58093C00330C99 /* NetworkInfoCell.h */,
+				93D167721D58093C00330C99 /* NetworkInfoCell.m */,
+				93D167741D580C3500330C99 /* ShowNetworksViewController.h */,
+				93D167751D580C3500330C99 /* ShowNetworksViewController.m */,
+				93326BED1CE7DA30005CA2AC /* ShowNetworksViewController.xib */,
 			);
 			);
 			path = "ZeroTier One";
 			path = "ZeroTier One";
 			sourceTree = "<group>";
 			sourceTree = "<group>";
@@ -199,15 +203,15 @@
 			buildActionMask = 2147483647;
 			buildActionMask = 2147483647;
 			files = (
 			files = (
 				93D167621D541BC200330C99 /* ServiceCom.m in Sources */,
 				93D167621D541BC200330C99 /* ServiceCom.m in Sources */,
+				93D167761D580C3500330C99 /* ShowNetworksViewController.m in Sources */,
 				93326BDC1CE7C816005CA2AC /* AppDelegate.swift in Sources */,
 				93326BDC1CE7C816005CA2AC /* AppDelegate.swift in Sources */,
 				93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */,
 				93DAFE4B1CFE53CA00547CC4 /* AuthtokenCopy.m in Sources */,
-				9330F13B1CF534E500687EC8 /* NetworkInfoCell.swift in Sources */,
 				93D167701D57FD3800330C99 /* NetworkMonitor.m in Sources */,
 				93D167701D57FD3800330C99 /* NetworkMonitor.m in Sources */,
 				93326BEA1CE7D9B9005CA2AC /* JoinNetworkViewController.swift in Sources */,
 				93326BEA1CE7D9B9005CA2AC /* JoinNetworkViewController.swift in Sources */,
-				93326BEE1CE7DA30005CA2AC /* ShowNetworksViewController.swift in Sources */,
 				93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */,
 				93D1675F1D54191C00330C99 /* NodeStatus.m in Sources */,
 				93D167691D57E7EA00330C99 /* AboutViewController.m in Sources */,
 				93D167691D57E7EA00330C99 /* AboutViewController.m in Sources */,
 				93D1676D1D57EB8400330C99 /* PreferencesViewController.m in Sources */,
 				93D1676D1D57EB8400330C99 /* PreferencesViewController.m in Sources */,
+				93D167731D58093C00330C99 /* NetworkInfoCell.m in Sources */,
 				93D167661D54308200330C99 /* Network.m in Sources */,
 				93D167661D54308200330C99 /* Network.m in Sources */,
 			);
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 			runOnlyForDeploymentPostprocessing = 0;

+ 2 - 2
ZeroTier One/AppDelegate.swift

@@ -42,8 +42,8 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuDelegate {
 
 
 
 
         let nc = NSNotificationCenter.defaultCenter()
         let nc = NSNotificationCenter.defaultCenter()
-        nc.addObserver(self, selector: #selector(onNetworkListUpdated(_:)), name: networkUpdateKey, object: nil)
-        nc.addObserver(self, selector: #selector(onNodeStatusUpdated(_:)), name: statusUpdateKey, object: nil)
+        nc.addObserver(self, selector: #selector(onNetworkListUpdated(_:)), name: NetworkUpdateKey, object: nil)
+        nc.addObserver(self, selector: #selector(onNodeStatusUpdated(_:)), name: StatusUpdateKey, object: nil)
 
 
         statusItem.image = NSImage(named: "MenuBarIconMac")
         statusItem.image = NSImage(named: "MenuBarIconMac")
 
 

+ 40 - 0
ZeroTier One/NetworkInfoCell.h

@@ -0,0 +1,40 @@
+//
+//  NetworkInfoCell.h
+//  ZeroTier One
+//
+//  Created by Grant Limberg on 8/7/16.
+//  Copyright © 2016 ZeroTier, Inc. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@class ShowNetworksViewController;
+
+@interface NetworkInfoCell : NSTableCellView
+
+@property (weak, nonatomic) ShowNetworksViewController *parent;
+
+@property (weak, nonatomic) IBOutlet NSTextField *networkIdField;
+@property (weak, nonatomic) IBOutlet NSTextField *networkNameField;
+@property (weak, nonatomic) IBOutlet NSTextField *statusField;
+@property (weak, nonatomic) IBOutlet NSTextField *typeField;
+@property (weak, nonatomic) IBOutlet NSTextField *macField;
+@property (weak, nonatomic) IBOutlet NSTextField *mtuField;
+@property (weak, nonatomic) IBOutlet NSTextField *broadcastField;
+@property (weak, nonatomic) IBOutlet NSTextField *bridgingField;
+@property (weak, nonatomic) IBOutlet NSTextField *deviceField;
+@property (weak, nonatomic) IBOutlet NSTextField *addressesField;
+@property (weak, nonatomic) IBOutlet NSButton *allowManaged;
+@property (weak, nonatomic) IBOutlet NSButton *allowGlobal;
+@property (weak, nonatomic) IBOutlet NSButton *allowDefault;
+@property (weak, nonatomic) IBOutlet NSButton *connectedCheckbox;
+@property (weak, nonatomic) IBOutlet NSButton *deleteButton;
+
+- (IBAction)onConnectCheckStateChanged:(NSButton*)sender;
+- (IBAction)deleteNetwork:(NSButton*)sender;
+- (IBAction)onAllowStatusChanged:(NSButton*)sender;
+
+- (void)joinNetwork:(NSString*)nwid;
+- (void)leaveNetwork:(NSString*)nwid;
+
+@end

+ 56 - 0
ZeroTier One/NetworkInfoCell.m

@@ -0,0 +1,56 @@
+//
+//  NetworkInfoCell.m
+//  ZeroTier One
+//
+//  Created by Grant Limberg on 8/7/16.
+//  Copyright © 2016 ZeroTier, Inc. All rights reserved.
+//
+
+#import "NetworkInfoCell.h"
+#import "ServiceCom.h"
+#import "ShowNetworksViewController.h"
+#import "Network.h"
+
+@implementation NetworkInfoCell
+
+- (void)drawRect:(NSRect)dirtyRect {
+    [super drawRect:dirtyRect];
+    
+    // Drawing code here.
+}
+
+- (IBAction)onConnectCheckStateChanged:(NSButton*)sender
+{
+    if(sender.state == NSOnState) {
+        [self joinNetwork:self.networkIdField.stringValue];
+    }
+    else {
+        [self leaveNetwork:self.networkIdField.stringValue];
+    }
+}
+
+- (IBAction)deleteNetwork:(NSButton*)sender;
+{
+    [self leaveNetwork:self.networkIdField.stringValue];
+    [self.parent deleteNetworkFromList:self.networkIdField.stringValue];
+}
+
+- (IBAction)onAllowStatusChanged:(NSButton*)sender
+{
+    [self joinNetwork:self.networkIdField.stringValue];
+}
+
+- (void)joinNetwork:(NSString*)nwid
+{
+    [[ServiceCom sharedInstance] joinNetwork:nwid
+                                allowManaged:(self.allowManaged.state == NSOnState)
+                                 allowGlobal:(self.allowGlobal.state  == NSOnState)
+                                allowDefault:![Network defaultRouteExists:_parent.networkList] && (self.allowDefault.state == NSOnState)];
+}
+
+- (void)leaveNetwork:(NSString*)nwid
+{
+    [[ServiceCom sharedInstance] leaveNetwork:nwid];
+}
+
+@end

+ 0 - 72
ZeroTier One/NetworkInfoCell.swift

@@ -1,72 +0,0 @@
-//
-//  NetworkInfoCell.swift
-//  ZeroTier One
-//
-//  Created by Grant Limberg on 5/24/16.
-//  Copyright © 2016 ZeroTier, Inc. All rights reserved.
-//
-
-import Cocoa
-
-class NetworkInfoCell: NSTableCellView {
-
-    weak var parent: ShowNetworksViewController!
-
-    @IBOutlet var networkIdField: NSTextField!
-    @IBOutlet var networkNameField: NSTextField!
-
-    @IBOutlet var statusField: NSTextField!
-    @IBOutlet var typeField: NSTextField!
-    @IBOutlet var macField: NSTextField!
-    @IBOutlet var mtuField: NSTextField!
-    @IBOutlet var broadcastField: NSTextField!
-    @IBOutlet var bridgingField: NSTextField!
-    @IBOutlet var deviceField: NSTextField!
-    @IBOutlet var addressesField: NSTextField!
-
-    @IBOutlet var allowManaged: NSButton!
-    @IBOutlet var allowGlobal: NSButton!
-    @IBOutlet var allowDefault: NSButton!
-
-    @IBOutlet var connectedCheckbox: NSButton!
-    @IBOutlet var deleteButton: NSButton!
-
-    override func awakeFromNib() {
-        super.awakeFromNib()
-        
-    }
-    override func drawRect(dirtyRect: NSRect) {
-        super.drawRect(dirtyRect)
-
-        // Drawing code here.
-    }
-
-    @IBAction func onConnectCheckStateChanged(sender: NSButton) {
-        if(sender.state == NSOnState) {
-            joinNetwork(networkIdField.stringValue)
-        }
-        else {
-            leaveNetwork(networkIdField.stringValue)
-        }
-    }
-
-    @IBAction func deleteNetwork(sender: NSButton) {
-        leaveNetwork(networkIdField.stringValue)
-        parent.deleteNetworkFromList(networkIdField.stringValue)
-    }
-
-    func joinNetwork(nwid: String) {
-        ServiceCom.sharedInstance().joinNetwork(nwid,
-                                              allowManaged: allowManaged.state == NSOnState,
-                                              allowGlobal: allowGlobal.state == NSOnState,
-                                              allowDefault: !Network.defaultRouteExists(parent.networkList) && (allowDefault.state == NSOnState))
-    }
-
-    func leaveNetwork(nwid: String) {
-        ServiceCom.sharedInstance().leaveNetwork(nwid)
-    }
-
-    @IBAction func onAllowStatusChanged(sender: NSButton) {
-        joinNetwork(networkIdField.stringValue)
-    }
-}

+ 26 - 0
ZeroTier One/ShowNetworksViewController.h

@@ -0,0 +1,26 @@
+//
+//  ShowNetworksViewController.h
+//  ZeroTier One
+//
+//  Created by Grant Limberg on 8/7/16.
+//  Copyright © 2016 ZeroTier, Inc. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+@class NetworkMonitor;
+@class Network;
+
+@interface ShowNetworksViewController : NSViewController<NSTableViewDelegate, NSTableViewDataSource>
+
+@property (nonatomic) NSArray<Network*> *networkList;
+@property (nonatomic) NetworkMonitor *netMonitor;
+@property (nonatomic) BOOL visible;
+
+@property (weak, nonatomic) IBOutlet NSTableView *tableView;
+
+- (void)deleteNetworkFromList:(NSString*)nwid;
+- (void)setNetworks:(NSArray<Network*>*)list;
+
+
+@end

+ 108 - 0
ZeroTier One/ShowNetworksViewController.m

@@ -0,0 +1,108 @@
+//
+//  ShowNetworksViewController.m
+//  ZeroTier One
+//
+//  Created by Grant Limberg on 8/7/16.
+//  Copyright © 2016 ZeroTier, Inc. All rights reserved.
+//
+
+#import "ShowNetworksViewController.h"
+#import "NetworkMonitor.h"
+#import "NetworkInfoCell.h"
+#import "Network.h"
+
+@interface ShowNetworksViewController ()
+
+@end
+
+@implementation ShowNetworksViewController
+
+- (void)viewDidLoad {
+    [super viewDidLoad];
+
+    [self.tableView setDelegate:self];
+    [self.tableView setDataSource:self];
+    [self.tableView setBackgroundColor:[NSColor clearColor]];
+}
+
+- (void)viewWillAppear {
+    [super viewWillAppear];
+    self.visible = YES;
+}
+
+- (void)viewWillDisappear {
+    [super viewWillDisappear];
+    self.visible = NO;
+}
+
+- (void)deleteNetworkFromList:(NSString *)nwid {
+    [self.netMonitor deleteSavedNetwork:nwid];
+}
+
+- (void)setNetworks:(NSArray<Network *> *)list {
+    _networkList = list;
+    if(_visible) {
+        [_tableView reloadData];
+    }
+}
+
+- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
+    return [_networkList count];
+}
+
+- (NSView*)tableView:(NSTableView *)tableView viewForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
+{
+    NetworkInfoCell *cell = (NetworkInfoCell*)[tableView makeViewWithIdentifier:@"NetworkInfoCell"
+                                                                          owner:nil];
+    Network *network = [_networkList objectAtIndex:row];
+    cell.parent = self;
+    cell.networkIdField.stringValue = [NSString stringWithFormat:@"%10llx", network.nwid];
+    cell.networkNameField.stringValue = network.name;
+    cell.statusField.stringValue = [network statusString];
+    cell.typeField.stringValue = [network typeString];
+    cell.mtuField.stringValue = [NSString stringWithFormat:@"%d", network.mtu];
+    cell.macField.stringValue = network.mac;
+    cell.broadcastField.stringValue = network.broadcastEnabled ? @"ENABLED" : @"DISABLED";
+    cell.bridgingField.stringValue = network.bridge ? @"ENABLED" : @"DISABLED";
+    cell.deviceField.stringValue = network.portDeviceName;
+
+    if(network.connected) {
+        cell.connectedCheckbox.state = NSOnState;
+
+        if(network.allowDefault) {
+            cell.allowDefault.enabled = YES;
+            cell.allowDefault.state = NSOnState;
+        }
+        else {
+            cell.allowDefault.state = NSOffState;
+
+            if([Network defaultRouteExists:_networkList]) {
+                cell.allowDefault.enabled = NO;
+            }
+            else {
+                cell.allowDefault.enabled = YES;
+            }
+        }
+
+        cell.allowGlobal.enabled = YES;
+        cell.allowManaged.enabled = YES;
+    }
+    else {
+        cell.allowDefault.enabled = NO;
+        cell.allowGlobal.enabled = NO;
+        cell.allowManaged.enabled = NO;
+    }
+
+    cell.allowGlobal.state = network.allowGlobal ? NSOnState : NSOffState;
+    cell.allowManaged.state = network.allowManaged ? NSOnState : NSOffState;
+
+    cell.addressesField.stringValue = @"";
+
+    for(NSString *addr in network.assignedAddresses) {
+        cell.addressesField.stringValue = [[cell.addressesField.stringValue stringByAppendingString:addr] stringByAppendingString:@"\n"];
+    }
+
+    return cell;
+}
+
+@end

+ 0 - 132
ZeroTier One/ShowNetworksViewController.swift

@@ -1,132 +0,0 @@
-//
-//  ShowNetworksViewController.swift
-//  ZeroTier One
-//
-//  Created by Grant Limberg on 5/14/16.
-//  Copyright © 2016 ZeroTier, Inc. All rights reserved.
-//
-
-import Cocoa
-
-class ShowNetworksViewController: NSViewController, NSTableViewDelegate, NSTableViewDataSource {
-
-    @IBOutlet var tableView: NSTableView?
-
-    var networkList: [Network] = [Network]()
-    var netMonitor: NetworkMonitor!
-
-    var visible = false
-
-    override func viewDidLoad() {
-        super.viewDidLoad()
-        // Do view setup here.
-
-        tableView?.setDelegate(self)
-        tableView?.setDataSource(self)
-        tableView?.backgroundColor = NSColor.clearColor()
-    }
-
-    private func  dataFile() -> String {
-        var appSupport = NSFileManager.defaultManager().URLsForDirectory(.ApplicationSupportDirectory, inDomains: .UserDomainMask)[0]
-        appSupport = appSupport.URLByAppendingPathComponent("ZeroTier").URLByAppendingPathComponent("One").URLByAppendingPathComponent("networks.dat")
-        return appSupport.path!
-    }
-
-    override func viewWillAppear() {
-        super.viewWillAppear()
-        visible = true
-    }
-
-    override func viewWillDisappear() {
-        super.viewWillDisappear()
-
-        let filePath = dataFile()
-        NSKeyedArchiver.archiveRootObject(self.networkList, toFile: filePath)
-        visible = false
-    }
-
-    func deleteNetworkFromList(nwid: String) {
-        netMonitor.deleteSavedNetwork(nwid)
-    }
-
-
-    func setNetworks(list: [Network]) {
-        networkList = list
-        if visible {
-            tableView?.reloadData()
-        }
-    }
-
-    // NSTableViewDataSource
-
-    func numberOfRowsInTableView(tableView: NSTableView) -> Int {
-        return networkList.count
-    }
-
-    // end NSTableViewDataSource
-
-    // NSTableViewDelegate
-
-    func tableView(tableView: NSTableView, viewForTableColumn tableColumn: NSTableColumn?, row: Int) -> NSView? {
-        if let cell = tableView.makeViewWithIdentifier("NetworkInfoCell", owner: nil) as? NetworkInfoCell {
-            let network = networkList[row]
-            cell.parent = self
-            cell.networkIdField.stringValue = String(network.nwid, radix: 16)
-            cell.networkNameField.stringValue = network.name
-
-            cell.statusField.stringValue = network.statusString()
-            cell.typeField.stringValue = network.typeString()
-            cell.macField.stringValue = network.mac
-            cell.mtuField.stringValue = String(network.mtu)
-            cell.broadcastField.stringValue = network.broadcastEnabled ? "ENABLED" : "DISABLED"
-            cell.bridgingField.stringValue = network.bridge ? "ENABLED" : "DISABLED"
-            cell.deviceField.stringValue = network.portDeviceName
-
-            if network.connected {
-                cell.connectedCheckbox.state = NSOnState
-
-                if network.allowDefault {
-                    cell.allowDefault.enabled = true
-                    cell.allowDefault.state = NSOnState
-                }
-                else {
-                    cell.allowDefault.state = NSOffState
-
-                    if Network.defaultRouteExists(networkList) {
-                        cell.allowDefault.enabled = false
-                    }
-                    else {
-                        cell.allowDefault.enabled = true
-                    }
-                }
-
-                cell.allowGlobal.enabled = true
-                cell.allowManaged.enabled = true
-            }
-            else {
-                cell.connectedCheckbox.state = NSOffState
-
-                cell.allowDefault.enabled = false
-                cell.allowGlobal.enabled = false
-                cell.allowManaged.enabled = false
-            }
-            
-            cell.allowGlobal.state = (network.allowGlobal ? NSOnState : NSOffState)
-            cell.allowManaged.state = (network.allowManaged ? NSOnState : NSOffState)
-
-            cell.addressesField.stringValue = ""
-
-            for nw in network.assignedAddresses {
-                cell.addressesField.stringValue += "\(nw)\n"
-            }
-
-
-
-            return cell
-        }
-
-        return nil
-    }
-
-    // end NSTableViewDelegate
-}

+ 1 - 1
ZeroTier One/ShowNetworksViewController.xib

@@ -43,7 +43,7 @@
                                         </textFieldCell>
                                         </textFieldCell>
                                         <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                         <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
                                         <prototypeCellViews>
                                         <prototypeCellViews>
-                                            <tableCellView identifier="NetworkInfoCell" focusRingType="none" id="rmb-il-W5I" customClass="NetworkInfoCell" customModule="ZeroTier_One" customModuleProvider="target">
+                                            <tableCellView identifier="NetworkInfoCell" focusRingType="none" id="rmb-il-W5I" customClass="NetworkInfoCell">
                                                 <rect key="frame" x="1" y="1" width="527" height="367"/>
                                                 <rect key="frame" x="1" y="1" width="527" height="367"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                 <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
                                                 <subviews>
                                                 <subviews>

+ 2 - 0
ZeroTier One/ZeroTier One-Bridging-Header.h

@@ -9,3 +9,5 @@
 #import "AboutViewController.h"
 #import "AboutViewController.h"
 #import "PreferencesViewController.h"
 #import "PreferencesViewController.h"
 #import "NetworkMonitor.h"
 #import "NetworkMonitor.h"
+#import "NetworkInfoCell.h"
+#import "ShowNetworksViewController.h"