Skip to content

Commit 911de29

Browse files
committed
Added SSID view to top of display of iOS app.
1 parent ef0a1cd commit 911de29

File tree

10 files changed

+48
-18
lines changed

10 files changed

+48
-18
lines changed

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>70</string>
22+
<string>80</string>
2323
<key>NSExtension</key>
2424
<dict>
2525
<key>NSExtensionAttributes</key>

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>70</string>
22+
<string>80</string>
2323
<key>UISupportedInterfaceOrientations</key>
2424
<array>
2525
<string>UIInterfaceOrientationPortrait</string>

IP Address.xcodeproj/project.pbxproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@
7070

7171
/* Begin PBXFileReference section */
7272
AA12DD8E1FAB85F8004EB978 /* DNSlookup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DNSlookup.swift; sourceTree = "<group>"; };
73+
AA21820021247B33003C3FDE /* IP Address.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = "IP Address.entitlements"; sourceTree = "<group>"; };
7374
AA22A2021FEBFC6D001B0D91 /* IPAddressRowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPAddressRowController.swift; sourceTree = "<group>"; };
7475
AA343B711FEBF5D900CB6E03 /* IP Address WatchOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "IP Address WatchOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
7576
AA343B741FEBF5D900CB6E03 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Interface.storyboard; sourceTree = "<group>"; };
@@ -177,6 +178,7 @@
177178
AAE2351E1F91223400FB8E69 /* IP Address */ = {
178179
isa = PBXGroup;
179180
children = (
181+
AA21820021247B33003C3FDE /* IP Address.entitlements */,
180182
AAE2351F1F91223400FB8E69 /* AppDelegate.swift */,
181183
AAE235211F91223400FB8E69 /* ViewController.swift */,
182184
AA12DD8E1FAB85F8004EB978 /* DNSlookup.swift */,
@@ -278,6 +280,11 @@
278280
AAE2351B1F91223400FB8E69 = {
279281
CreatedOnToolsVersion = 9.0;
280282
ProvisioningStyle = Automatic;
283+
SystemCapabilities = {
284+
com.apple.AccessWiFi = {
285+
enabled = 1;
286+
};
287+
};
281288
};
282289
};
283290
};
@@ -630,6 +637,7 @@
630637
baseConfigurationReference = D0A5CED612EB906B8ABBB984 /* Pods-IP Address.debug.xcconfig */;
631638
buildSettings = {
632639
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
640+
CODE_SIGN_ENTITLEMENTS = "IP Address/IP Address.entitlements";
633641
CODE_SIGN_STYLE = Automatic;
634642
DEVELOPMENT_TEAM = 22648A4K3P;
635643
INFOPLIST_FILE = "IP Address/Info.plist";
@@ -646,6 +654,7 @@
646654
baseConfigurationReference = AC8FF94B6EFEB74B4FE34994 /* Pods-IP Address.release.xcconfig */;
647655
buildSettings = {
648656
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
657+
CODE_SIGN_ENTITLEMENTS = "IP Address/IP Address.entitlements";
649658
CODE_SIGN_STYLE = Automatic;
650659
DEVELOPMENT_TEAM = 22648A4K3P;
651660
INFOPLIST_FILE = "IP Address/Info.plist";

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: 70 (f6ee430)" 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: 80 (ef0a1cd)" 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: 69 (334bad6)" 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: 79 (ef0a1cd)" 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/Main.storyboard

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14112" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
2+
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="14313.13.2" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" useSafeAreas="YES" colorMatched="YES" initialViewController="BYZ-38-t0r">
33
<device id="retina5_5" orientation="portrait">
44
<adaptation id="fullscreen"/>
55
</device>
66
<dependencies>
7-
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14088"/>
7+
<deployment identifier="iOS"/>
8+
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="14283.9"/>
89
<capability name="Safe area layout guides" minToolsVersion="9.0"/>
910
<capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
1011
</dependencies>
@@ -20,8 +21,14 @@
2021
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="aXX-aH-RTQ">
2122
<rect key="frame" x="0.0" y="20" width="414" height="706"/>
2223
<subviews>
24+
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="ssid" textAlignment="center" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsLetterSpacingToFitWidth="YES" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="anq-wf-6bz" userLabel="ssid Label">
25+
<rect key="frame" x="0.0" y="0.0" width="414" height="31.333333333333332"/>
26+
<fontDescription key="fontDescription" style="UICTFontTextStyleTitle1"/>
27+
<nil key="textColor"/>
28+
<nil key="highlightedColor"/>
29+
</label>
2330
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="ATv-ck-YdY">
24-
<rect key="frame" x="0.0" y="0.0" width="414" height="654.66666666666663"/>
31+
<rect key="frame" x="0.0" y="31.333333333333314" width="414" height="623.33333333333348"/>
2532
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
2633
<prototypes>
2734
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="default" indentationWidth="10" reuseIdentifier="Cell" textLabel="4Ib-w1-KsL" detailTextLabel="3gV-GT-tPw" style="IBUITableViewCellStyleValue1" id="wGa-uZ-JhJ">
@@ -130,6 +137,7 @@
130137
<outlet property="IPv4filterSwitch" destination="4D9-QY-Z7f" id="isA-GW-TSe"/>
131138
<outlet property="IPv6filterSwitch" destination="k1l-3t-xif" id="lvu-W6-Qvh"/>
132139
<outlet property="linkLayerfilterSwitch" destination="6Ys-Jh-a0y" id="eEf-5X-skh"/>
140+
<outlet property="ssidLabel" destination="anq-wf-6bz" id="8Db-Q6-CKW"/>
133141
<outlet property="tableView" destination="ATv-ck-YdY" id="aCH-cM-tuT"/>
134142
</connections>
135143
</viewController>

IP Address/IP Address.entitlements

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3+
<plist version="1.0">
4+
<dict>
5+
<key>com.apple.developer.networking.wifi-info</key>
6+
<true/>
7+
</dict>
8+
</plist>

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>70</string>
20+
<string>80</string>
2121
<key>ITSAppUsesNonExemptEncryption</key>
2222
<false/>
2323
<key>LSRequiresIPhoneOS</key>

IP Address/ViewController.swift

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88

99
import UIKit
10-
10+
import SystemConfiguration.CaptiveNetwork
1111

1212

1313

@@ -17,6 +17,7 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
1717
@IBOutlet var IPv4filterSwitch: UISwitch!
1818
@IBOutlet var IPv6filterSwitch: UISwitch!
1919
@IBOutlet var linkLayerfilterSwitch: UISwitch!
20+
@IBOutlet var ssidLabel: UILabel!
2021

2122

2223
private var interfaces = Interface.allInterfaces()
@@ -33,14 +34,18 @@ class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSour
3334
refresher.attributedTitle = NSAttributedString (string: "Pull to refresh")
3435
refresher.addTarget(self, action: #selector(refreshSortAndFilterData), for: .valueChanged)
3536

36-
// let hostname = "www.trease.eu"
37-
// let dns = DNSLookup.lookup(hostname)
38-
// print (hostname + ":" + dns)
39-
40-
// let ip = "8.8.8.8"
41-
// let dnsName = DNSLookup.reverseLookup(ip)
42-
// print (ip + ":" + dnsName)
43-
37+
if let interfaces = CNCopySupportedInterfaces() {
38+
for i in 0..<CFArrayGetCount(interfaces){
39+
let interfaceName: UnsafeRawPointer = CFArrayGetValueAtIndex(interfaces, i)
40+
let rec = unsafeBitCast(interfaceName, to: AnyObject.self)
41+
let unsafeInterfaceData = CNCopyCurrentNetworkInfo("\(rec)" as CFString)
42+
43+
if let unsafeInterfaceData = unsafeInterfaceData as? Dictionary<AnyHashable, Any> {
44+
ssidLabel.text = unsafeInterfaceData["SSID"] as? String
45+
}
46+
}
47+
}
48+
4449
refreshSortAndFilterData()
4550
}
4651

build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
70
1+
80

0 commit comments

Comments
 (0)