Skip to content

Commit ac90b23

Browse files
Steve TreaseSteve Trease
authored andcommitted
Removed duplicate interface/addresses.
1 parent 2fb514f commit ac90b23

File tree

10 files changed

+42
-71
lines changed

10 files changed

+42
-71
lines changed

IP Address WatchOS Extension/IPAddressInterfaceController.swift

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,23 @@ class IPAddressInterfaceController: WKInterfaceController {
7777

7878
interfaces = IPv4Interfaces + IPv6Interfaces
7979

80+
print ("making unique")
81+
print (interfaces.count)
82+
var uniqueArray: [Interface] = []
83+
for interface in interfaces {
84+
var found = false
85+
for item in uniqueArray {
86+
if (interface.description == item.description && interface.address == item.address) {
87+
found = true
88+
break
89+
}
90+
}
91+
if (!found) {
92+
uniqueArray.append (interface)
93+
}
94+
}
95+
interfaces = uniqueArray
96+
8097
interfaces.sort {
8198
if $0.description == $1.description { return $0.address! < $1.address! }
8299
return $0.description < $1.description

IP Address WatchOS Extension/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>1.0</string>
2121
<key>CFBundleVersion</key>
22-
<string>38</string>
22+
<string>44</string>
2323
<key>NSExtension</key>
2424
<dict>
2525
<key>NSExtensionAttributes</key>

IP Address WatchOS Extension/InterfaceController.swift

Lines changed: 0 additions & 61 deletions
This file was deleted.

IP Address WatchOS/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<key>CFBundleShortVersionString</key>
2020
<string>1.0</string>
2121
<key>CFBundleVersion</key>
22-
<string>38</string>
22+
<string>44</string>
2323
<key>UISupportedInterfaceOrientations</key>
2424
<array>
2525
<string>UIInterfaceOrientationPortrait</string>

IP Address.xcodeproj/project.pbxproj

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
AA343B751FEBF5D900CB6E03 /* Interface.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = AA343B731FEBF5D900CB6E03 /* Interface.storyboard */; };
1313
AA343B771FEBF5D900CB6E03 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AA343B761FEBF5D900CB6E03 /* Assets.xcassets */; };
1414
AA343B7E1FEBF5D900CB6E03 /* IP Address WatchOS Extension.appex in Embed App Extensions */ = {isa = PBXBuildFile; fileRef = AA343B7D1FEBF5D900CB6E03 /* IP Address WatchOS Extension.appex */; settings = {ATTRIBUTES = (RemoveHeadersOnCopy, ); }; };
15-
AA343B831FEBF5D900CB6E03 /* InterfaceController.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA343B821FEBF5D900CB6E03 /* InterfaceController.swift */; };
1615
AA343B851FEBF5D900CB6E03 /* ExtensionDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = AA343B841FEBF5D900CB6E03 /* ExtensionDelegate.swift */; };
1716
AA343B871FEBF5D900CB6E03 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = AA343B861FEBF5D900CB6E03 /* Assets.xcassets */; };
1817
AA343B8B1FEBF5D900CB6E03 /* IP Address WatchOS.app in Embed Watch Content */ = {isa = PBXBuildFile; fileRef = AA343B711FEBF5D900CB6E03 /* IP Address WatchOS.app */; };
@@ -78,7 +77,6 @@
7877
AA343B761FEBF5D900CB6E03 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
7978
AA343B781FEBF5D900CB6E03 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8079
AA343B7D1FEBF5D900CB6E03 /* IP Address WatchOS Extension.appex */ = {isa = PBXFileReference; explicitFileType = "wrapper.app-extension"; includeInIndex = 0; path = "IP Address WatchOS Extension.appex"; sourceTree = BUILT_PRODUCTS_DIR; };
81-
AA343B821FEBF5D900CB6E03 /* InterfaceController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = InterfaceController.swift; sourceTree = "<group>"; };
8280
AA343B841FEBF5D900CB6E03 /* ExtensionDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionDelegate.swift; sourceTree = "<group>"; };
8381
AA343B861FEBF5D900CB6E03 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
8482
AA343B881FEBF5D900CB6E03 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -139,7 +137,6 @@
139137
AA343B811FEBF5D900CB6E03 /* IP Address WatchOS Extension */ = {
140138
isa = PBXGroup;
141139
children = (
142-
AA343B821FEBF5D900CB6E03 /* InterfaceController.swift */,
143140
AA343B841FEBF5D900CB6E03 /* ExtensionDelegate.swift */,
144141
AA343B861FEBF5D900CB6E03 /* Assets.xcassets */,
145142
AA343B881FEBF5D900CB6E03 /* Info.plist */,
@@ -413,7 +410,6 @@
413410
AA22A2031FEBFC6D001B0D91 /* IPAddressRowController.swift in Sources */,
414411
AA343B851FEBF5D900CB6E03 /* ExtensionDelegate.swift in Sources */,
415412
AA343B971FEBFA7400CB6E03 /* IPAddressInterfaceController.swift in Sources */,
416-
AA343B831FEBF5D900CB6E03 /* InterfaceController.swift in Sources */,
417413
AA343B951FEBF60C00CB6E03 /* Interface.swift in Sources */,
418414
);
419415
runOnlyForDeploymentPostprocessing = 0;

IP Address/Base.lproj/LaunchScreen.storyboard

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
2222
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2323
<subviews>
24-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Build: 38 (8a01301)" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yhA-lX-4Of" userLabel="APP_VERSION">
24+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Build: 44 (2fb514f)" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yhA-lX-4Of" userLabel="APP_VERSION">
2525
<rect key="frame" x="132.5" y="527" width="55.5" height="21"/>
2626
<fontDescription key="fontDescription" type="system" pointSize="17"/>
2727
<nil key="textColor"/>

IP Address/Base.lproj/LaunchScreen.storyboardbak

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
2222
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
2323
<subviews>
24-
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Build: 37 (8a01301)" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yhA-lX-4Of" userLabel="APP_VERSION">
24+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Build: 43 (2fb514f)" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="yhA-lX-4Of" userLabel="APP_VERSION">
2525
<rect key="frame" x="132.5" y="527" width="55.5" height="21"/>
2626
<fontDescription key="fontDescription" type="system" pointSize="17"/>
2727
<nil key="textColor"/>

IP Address/Info.plist

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<key>CFBundleShortVersionString</key>
1818
<string>1.0</string>
1919
<key>CFBundleVersion</key>
20-
<string>38</string>
20+
<string>44</string>
2121
<key>LSRequiresIPhoneOS</key>
2222
<true/>
2323
<key>UILaunchStoryboardName</key>

IP Address/ViewController.swift

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,30 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
101101

102102
interfaces = IPv4Interfaces + IPv6Interfaces
103103

104+
print ("making unique")
105+
print (interfaces.count)
106+
var uniqueArray: [Interface] = []
107+
for interface in interfaces {
108+
var found = false
109+
for item in uniqueArray {
110+
if (interface.description == item.description && interface.address == item.address) {
111+
found = true
112+
break
113+
}
114+
}
115+
if (!found) {
116+
uniqueArray.append (interface)
117+
}
118+
}
119+
interfaces = uniqueArray
120+
104121
interfaces.sort {
105122
if $0.description == $1.description { return $0.address! < $1.address! }
106123
return $0.description < $1.description
107124
}
108125

126+
127+
109128
print (interfaces.count)
110129
tableView.reloadData()
111130
refresher.endRefreshing()

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
38
1+
44

0 commit comments

Comments
 (0)