├── .github └── workflows │ ├── objective-c-xcode.yml │ └── swift-package.yml ├── .gitignore ├── .jazzy.yaml ├── CHANGELOG ├── LICENSE.txt ├── LinuxMain.swift ├── NetUtils-macOS ├── Info.plist └── NetUtils_macOS.h ├── NetUtils-macOSTests └── Info.plist ├── NetUtils.podspec.json ├── NetUtils.xcodeproj ├── project.pbxproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ └── xcshareddata │ │ └── IDEWorkspaceChecks.plist └── xcshareddata │ └── xcschemes │ ├── NetUtils-macOS.xcscheme │ └── NetUtils.xcscheme ├── NetUtils ├── Info.plist ├── Interface.swift └── NetUtils.h ├── NetUtilsTests ├── Info.plist ├── NetUtilsTests.swift └── XCTestManifests.swift ├── Package.swift ├── README.md ├── Tests ├── Linux │ └── App │ │ ├── .gitignore │ │ ├── Package.swift │ │ ├── README.md │ │ └── Sources │ │ └── App │ │ └── main.swift ├── Swift4 │ ├── App │ │ ├── .gitignore │ │ ├── App.xcodeproj │ │ │ ├── project.pbxproj │ │ │ ├── project.xcworkspace │ │ │ │ └── contents.xcworkspacedata │ │ │ └── xcshareddata │ │ │ │ └── xcschemes │ │ │ │ └── App.xcscheme │ │ ├── App │ │ │ ├── AppDelegate.swift │ │ │ ├── Assets.xcassets │ │ │ │ └── AppIcon.appiconset │ │ │ │ │ └── Contents.json │ │ │ ├── Base.lproj │ │ │ │ ├── LaunchScreen.storyboard │ │ │ │ └── Main.storyboard │ │ │ ├── Info.plist │ │ │ └── ViewController.swift │ │ └── Podfile │ └── runTest.sh └── Swift5 │ ├── App │ ├── .gitignore │ ├── App.xcodeproj │ │ ├── project.pbxproj │ │ ├── project.xcworkspace │ │ │ └── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── App.xcscheme │ ├── App │ │ ├── AppDelegate.swift │ │ ├── Assets.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Base.lproj │ │ │ ├── LaunchScreen.storyboard │ │ │ └── Main.storyboard │ │ ├── Info.plist │ │ └── ViewController.swift │ └── Podfile │ └── runTest.sh ├── docs ├── Classes.html ├── Classes │ ├── Interface.html │ └── Interface │ │ └── Family.html ├── Extensions.html ├── badge.svg ├── css │ ├── highlight.css │ └── jazzy.css ├── docsets │ ├── NetUtils.docset │ │ └── Contents │ │ │ ├── Info.plist │ │ │ └── Resources │ │ │ ├── Documents │ │ │ ├── Classes.html │ │ │ ├── Classes │ │ │ │ ├── Interface.html │ │ │ │ └── Interface │ │ │ │ │ └── Family.html │ │ │ ├── Extensions.html │ │ │ ├── css │ │ │ │ ├── highlight.css │ │ │ │ └── jazzy.css │ │ │ ├── img │ │ │ │ ├── carat.png │ │ │ │ ├── dash.png │ │ │ │ ├── gh.png │ │ │ │ └── spinner.gif │ │ │ ├── index.html │ │ │ ├── js │ │ │ │ ├── jazzy.js │ │ │ │ ├── jazzy.search.js │ │ │ │ ├── jquery.min.js │ │ │ │ ├── lunr.min.js │ │ │ │ └── typeahead.jquery.js │ │ │ └── search.json │ │ │ └── docSet.dsidx │ └── NetUtils.tgz ├── img │ ├── carat.png │ ├── dash.png │ ├── gh.png │ └── spinner.gif ├── index.html ├── js │ ├── jazzy.js │ ├── jazzy.search.js │ ├── jquery.min.js │ ├── lunr.min.js │ └── typeahead.jquery.js ├── search.json └── undocumented.json └── ifaddrs └── injectXcodePath.sh /.github/workflows/objective-c-xcode.yml: -------------------------------------------------------------------------------- 1 | name: Xcode Build 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | name: Build and analyse default scheme using xcodebuild command 12 | runs-on: macos-latest 13 | 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v3 17 | - name: Set Default Scheme 18 | run: | 19 | scheme_list=$(xcodebuild -list -json | tr -d "\n") 20 | default=$(echo $scheme_list | ruby -e "require 'json'; puts JSON.parse(STDIN.gets)['project']['targets'][0]") 21 | echo $default | cat >default 22 | echo Using default scheme: $default 23 | - name: Build 24 | env: 25 | scheme: ${{ 'default' }} 26 | run: | 27 | if [ $scheme = default ]; then scheme=$(cat default); fi 28 | if [ "`ls -A | grep -i \\.xcworkspace\$`" ]; then filetype_parameter="workspace" && file_to_build="`ls -A | grep -i \\.xcworkspace\$`"; else filetype_parameter="project" && file_to_build="`ls -A | grep -i \\.xcodeproj\$`"; fi 29 | file_to_build=`echo $file_to_build | awk '{$1=$1;print}'` 30 | xcodebuild clean build analyze test -scheme "$scheme" -"$filetype_parameter" "$file_to_build" -sdk iphonesimulator -destination "platform=iOS Simulator,name=iPhone 13" | xcpretty && exit ${PIPESTATUS[0]} 31 | - name: Build Swift 4 test app 32 | run: cd Tests/Swift4 && ./runTest.sh 33 | - name: Build Swift 5 test app 34 | run: cd Tests/Swift5 && ./runTest.sh 35 | -------------------------------------------------------------------------------- /.github/workflows/swift-package.yml: -------------------------------------------------------------------------------- 1 | name: Swift Build 2 | 3 | on: 4 | push: 5 | branches: [ "master" ] 6 | pull_request: 7 | branches: [ "master" ] 8 | 9 | jobs: 10 | build: 11 | 12 | runs-on: macos-latest 13 | 14 | steps: 15 | - uses: actions/checkout@v3 16 | - name: Build 17 | run: swift build -v 18 | - name: Run tests 19 | run: swift test -v 20 | - name: Build sample project 21 | run: cd Tests/Linux/App && swift build -v 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .idea 2 | .ruby-gemset 3 | .ruby-version 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # CocoaPods 25 | # 26 | # We recommend against adding the Pods directory to your .gitignore. However 27 | # you should judge for yourself, the pros and cons are mentioned at: 28 | # http://guides.cocoapods.org/using/using-cocoapods.html#should-i-ignore-the-pods-directory-in-source-control 29 | # 30 | # Pods/ 31 | 32 | # Carthage 33 | # 34 | # Add this line if you want to avoid checking in source code from Carthage dependencies. 35 | # Carthage/Checkouts 36 | 37 | Carthage/Build 38 | 39 | # Swift Package Manager 40 | .build 41 | -------------------------------------------------------------------------------- /.jazzy.yaml: -------------------------------------------------------------------------------- 1 | clean: Yes 2 | objc: No 3 | author: Stefan van den Oord 4 | author_url: https://github.com/svdo 5 | github_url: https://github.com/svdo/swift-netutils 6 | github_file_prefix: https://github.com/svdo/swift-netutils/tree/4.2.1 7 | module: NetUtils 8 | module_version: 4.2.1 9 | readme: README.md 10 | copyright: Copyright © 2015 [Stefan van den Oord](https://github.com/svdo). All rights reserved 11 | -------------------------------------------------------------------------------- /CHANGELOG: -------------------------------------------------------------------------------- 1 | Version 4.2.1 2 | ============= 3 | - Fixes runtime crash using `withMemoryRebound` and `sockaddr_storage` on iOS16 and macOS13 4 | (thanks to @palerikm and @dsmurfin) 5 | 6 | Version 4.2.0 7 | ============= 8 | - Makes `Interface` `Identifiable` so that it's possible to iterate them 9 | and represent them in a list. Thanks to @ivirtex for this contribution! 10 | 11 | Version 4.1.0 12 | ============= 13 | - Adds Linux support 14 | 15 | Version 4.0.4 16 | ============= 17 | - Fixes buffer overflow (#17) 18 | 19 | Version 4.0.3 20 | ============= 21 | - Fixes issue #21 by adding shared scheme for macOS builds. 22 | - Fixes compiler warnings and updates to Swift 4.2. 23 | 24 | Version 4.0.2 25 | ============= 26 | - Added Swift Package Manager support. 27 | - Changed documentation URL in README. 28 | 29 | Version 4.0.1 30 | ============= 31 | Better check in source code for whether our own `ifaddrs` module map needs 32 | to be used or not. 33 | 34 | Version 4.0.0 35 | ============= 36 | Added Swift 4.0 support. 37 | 38 | Version 3.0.2 39 | ============= 40 | - Fixed warning because of new Swift version (#11) 41 | - Moved generated documentation to github.io 42 | 43 | Version 3.0.1 44 | ============= 45 | Added Jazzy config file, hoping to fix CocoaDocs generation that way... 46 | 47 | Version 3.0.0 48 | ============= 49 | Swift 3 support. 50 | 51 | Version 2.0.1 52 | ============= 53 | House keeping: added API documentation, extended README. 54 | Changed license to MIT License. 55 | 56 | Version 2.0.0 57 | ============= 58 | This version supports the latest Swift version (2.2). The API of Interface is simplified: 59 | instead of the getters (like `getName()`) you now should simply use the properties (`name`). 60 | There are no functional changes. 61 | 62 | Older Versions 63 | ============== 64 | Not documented in this document. Please refer to git history. 65 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) Copyright (c) 2015 Stefan van den Oord 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a 4 | copy of this software and associated documentation files (the 5 | "Software"), to deal in the Software without restriction, including 6 | without limitation the rights to use, copy, modify, merge, publish, 7 | distribute, sublicense, and/or sell copies of the Software, and to 8 | permit persons to whom the Software is furnished to do so, subject to 9 | the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included 12 | in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 15 | OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 17 | IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 18 | CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 19 | TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 20 | SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /LinuxMain.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | import NetUtilsTests 3 | 4 | var tests = NetUtilsTests.__allTests() 5 | 6 | XCTMain(tests) 7 | 8 | -------------------------------------------------------------------------------- /NetUtils-macOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleVersion 20 | $(CURRENT_PROJECT_VERSION) 21 | NSHumanReadableCopyright 22 | Copyright © 2018 Stefan van den Oord. All rights reserved. 23 | 24 | 25 | -------------------------------------------------------------------------------- /NetUtils-macOS/NetUtils_macOS.h: -------------------------------------------------------------------------------- 1 | // 2 | // NetUtils_macOS.h 3 | // NetUtils-macOS 4 | // 5 | // Created by Stefan on 24/10/2018. 6 | // Copyright © 2018 Stefan van den Oord. All rights reserved. 7 | // 8 | 9 | #import 10 | 11 | //! Project version number for NetUtils_macOS. 12 | FOUNDATION_EXPORT double NetUtils_macOSVersionNumber; 13 | 14 | //! Project version string for NetUtils_macOS. 15 | FOUNDATION_EXPORT const unsigned char NetUtils_macOSVersionString[]; 16 | 17 | // In this header, you should import all the public headers of your framework using statements like #import 18 | 19 | 20 | -------------------------------------------------------------------------------- /NetUtils-macOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | 22 | 23 | -------------------------------------------------------------------------------- /NetUtils.podspec.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "NetUtils", 3 | "version": "4.2.1", 4 | "summary": "Swift library that simplifies getting information about your network interfaces and their properties, both for iOS and OS X.", 5 | "homepage": "https://github.com/svdo/swift-netutils", 6 | "documentation_url": "http://svdo.github.io/swift-netutils", 7 | "license": { 8 | "type": "MIT", "file": "LICENSE.txt" 9 | }, 10 | "source": { 11 | "git": "https://github.com/svdo/swift-netutils.git", 12 | "tag": "4.2.1" 13 | }, 14 | "authors": "Stefan van den Oord", 15 | "platforms": { 16 | "ios": "8.0", 17 | "osx": "10.9" 18 | }, 19 | "source_files": "NetUtils/**/*.swift", 20 | "requires_arc": true, 21 | "xcconfig": { 22 | "SWIFT_INCLUDE_PATHS[sdk=iphoneos*]": "$(SRCROOT)/NetUtils/ifaddrs/iphoneos", 23 | "SWIFT_INCLUDE_PATHS[sdk=iphonesimulator*]": "$(SRCROOT)/NetUtils/ifaddrs/iphonesimulator", 24 | "SWIFT_INCLUDE_PATHS[sdk=macosx*]": "$(SRCROOT)/NetUtils/ifaddrs/macosx" 25 | }, 26 | "preserve_paths": [ "ifaddrs/*" ], 27 | "prepare_command": "ifaddrs/injectXcodePath.sh", 28 | "swift_versions": ["4.2", "5.0", "5.1", "5.2", "5.3"] 29 | } 30 | -------------------------------------------------------------------------------- /NetUtils.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /NetUtils.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /NetUtils.xcodeproj/xcshareddata/xcschemes/NetUtils-macOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 42 | 48 | 49 | 50 | 51 | 52 | 62 | 63 | 69 | 70 | 71 | 72 | 78 | 79 | 85 | 86 | 87 | 88 | 90 | 91 | 94 | 95 | 96 | -------------------------------------------------------------------------------- /NetUtils.xcodeproj/xcshareddata/xcschemes/NetUtils.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 38 | 39 | 47 | 48 | 54 | 55 | 56 | 57 | 59 | 65 | 66 | 67 | 68 | 69 | 79 | 80 | 86 | 87 | 88 | 89 | 95 | 96 | 102 | 103 | 104 | 105 | 107 | 108 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /NetUtils/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | FMWK 17 | CFBundleShortVersionString 18 | $(MARKETING_VERSION) 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | $(CURRENT_PROJECT_VERSION) 23 | NSPrincipalClass 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /NetUtils/Interface.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Stefan van den Oord. All rights reserved. 2 | 3 | import Foundation 4 | #if swift(>=3.2) 5 | #if os(Linux) 6 | import Glibc 7 | typealias InetFamily = UInt16 8 | typealias Flags = Int 9 | func destinationAddress(_ data: ifaddrs) -> UnsafeMutablePointer! { return data.ifa_addr } 10 | func socketLength4(_ addr: sockaddr) -> UInt32 { return UInt32(MemoryLayout.size) } 11 | #else 12 | import Darwin 13 | typealias InetFamily = UInt8 14 | typealias Flags = Int32 15 | func destinationAddress(_ data: ifaddrs) -> UnsafeMutablePointer! { return data.ifa_dstaddr } 16 | func socketLength4(_ addr: sockaddr) -> UInt32 { return socklen_t(addr.sa_len) } 17 | #endif 18 | #else 19 | import ifaddrs 20 | typealias InetFamily = UInt8 21 | typealias Flags = Int32 22 | func destinationAddress(_ data: ifaddrs) -> UnsafeMutablePointer! { return data.ifa_dstaddr } 23 | func socketLength4(_ addr: sockaddr) -> UInt32 { return socklen_t(addr.sa_len) } 24 | #endif 25 | 26 | /** 27 | * This class represents a network interface in your system. For example, `en0` with a certain IP address. 28 | * It is a wrapper around the `getifaddrs` system call. 29 | * 30 | * Typical use of this class is to first call `Interface.allInterfaces()` and then use the properties of the interface(s) that you need. 31 | * 32 | * - See: `/usr/include/ifaddrs.h` 33 | */ 34 | open class Interface : CustomStringConvertible, CustomDebugStringConvertible { 35 | public var id = UUID() 36 | /// The network interface family (IPv4 or IPv6). 37 | public enum Family : Int { 38 | /// IPv4. 39 | case ipv4 40 | 41 | /// IPv6. 42 | case ipv6 43 | 44 | /// Used in case of errors. 45 | case other 46 | 47 | /// String representation of the address family. 48 | public func toString() -> String { 49 | switch (self) { 50 | case .ipv4: return "IPv4" 51 | case .ipv6: return "IPv6" 52 | default: return "other" 53 | } 54 | } 55 | } 56 | 57 | /** 58 | * Returns all network interfaces in your system. If you have an interface name (e.g. `en0`) that has 59 | * multiple IP addresses (e.g. one IPv4 address and a few IPv6 addresses), then they will be returned 60 | * as separate instances of Interface. 61 | * - Returns: An array containing all network interfaces in your system. 62 | */ 63 | public static func allInterfaces() -> [Interface] { 64 | var interfaces : [Interface] = [] 65 | 66 | var ifaddrsPtr : UnsafeMutablePointer? = nil 67 | if getifaddrs(&ifaddrsPtr) == 0 { 68 | var ifaddrPtr = ifaddrsPtr 69 | while ifaddrPtr != nil { 70 | let addr = ifaddrPtr?.pointee.ifa_addr.pointee 71 | if addr?.sa_family == InetFamily(AF_INET) || addr?.sa_family == InetFamily(AF_INET6) { 72 | interfaces.append(Interface(data: (ifaddrPtr?.pointee)!)) 73 | } 74 | ifaddrPtr = ifaddrPtr?.pointee.ifa_next 75 | } 76 | freeifaddrs(ifaddrsPtr) 77 | } 78 | 79 | return interfaces 80 | } 81 | 82 | /** 83 | * Returns a new Interface instance that does not represent a real network interface, but can be used for (unit) testing. 84 | * - Returns: An instance of Interface that does *not* represent a real network interface. 85 | */ 86 | public static func createTestDummy(_ name:String, family:Family, address:String, multicastSupported:Bool, broadcastAddress:String?) -> Interface 87 | { 88 | return Interface(name: name, family: family, address: address, netmask: nil, running: true, up: true, loopback: false, multicastSupported: multicastSupported, broadcastAddress: broadcastAddress) 89 | } 90 | 91 | /** 92 | * Initialize a new Interface with the given properties. 93 | */ 94 | public init(name:String, family:Family, address:String?, netmask:String?, running:Bool, up:Bool, loopback:Bool, multicastSupported:Bool, broadcastAddress:String?) { 95 | self.name = name 96 | self.family = family 97 | self.address = address 98 | self.netmask = netmask 99 | self.running = running 100 | self.up = up 101 | self.loopback = loopback 102 | self.multicastSupported = multicastSupported 103 | self.broadcastAddress = broadcastAddress 104 | } 105 | 106 | convenience init(data:ifaddrs) { 107 | let flags = Flags(data.ifa_flags) 108 | let broadcastValid : Bool = ((flags & IFF_BROADCAST) == IFF_BROADCAST) 109 | self.init(name: String(cString: data.ifa_name), 110 | family: Interface.extractFamily(data), 111 | address: Interface.extractAddress(data.ifa_addr), 112 | netmask: Interface.extractAddress(data.ifa_netmask), 113 | running: ((flags & IFF_RUNNING) == IFF_RUNNING), 114 | up: ((flags & IFF_UP) == IFF_UP), 115 | loopback: ((flags & IFF_LOOPBACK) == IFF_LOOPBACK), 116 | multicastSupported: ((flags & IFF_MULTICAST) == IFF_MULTICAST), 117 | broadcastAddress: ((broadcastValid && destinationAddress(data) != nil) ? Interface.extractAddress(destinationAddress(data)) : nil)) 118 | } 119 | 120 | fileprivate static func extractFamily(_ data:ifaddrs) -> Family { 121 | var family : Family = .other 122 | let addr = data.ifa_addr.pointee 123 | if addr.sa_family == InetFamily(AF_INET) { 124 | family = .ipv4 125 | } 126 | else if addr.sa_family == InetFamily(AF_INET6) { 127 | family = .ipv6 128 | } 129 | else { 130 | family = .other 131 | } 132 | return family 133 | } 134 | 135 | fileprivate static func extractAddress(_ address: UnsafeMutablePointer?) -> String? { 136 | guard let address = address else { return nil } 137 | if (address.pointee.sa_family == sa_family_t(AF_INET)) { 138 | return extractAddress_ipv4(address) 139 | } 140 | else if (address.pointee.sa_family == sa_family_t(AF_INET6)) { 141 | return extractAddress_ipv6(address) 142 | } 143 | else { 144 | return nil 145 | } 146 | } 147 | 148 | fileprivate static func extractAddress_ipv4(_ address:UnsafeMutablePointer) -> String? { 149 | return address.withMemoryRebound(to: sockaddr.self, capacity: 1) { addr in 150 | var address : String? = nil 151 | var hostname = [CChar](repeating: 0, count: Int(2049)) 152 | if (getnameinfo(&addr.pointee, socklen_t(socketLength4(addr.pointee)), &hostname, 153 | socklen_t(hostname.count), nil, socklen_t(0), NI_NUMERICHOST) == 0) { 154 | address = String(cString: hostname) 155 | } 156 | else { 157 | // var error = String.fromCString(gai_strerror(errno))! 158 | // println("ERROR: \(error)") 159 | } 160 | return address 161 | 162 | } 163 | } 164 | 165 | fileprivate static func extractAddress_ipv6(_ address:UnsafeMutablePointer) -> String? { 166 | var ip : [Int8] = [Int8](repeating: Int8(0), count: Int(INET6_ADDRSTRLEN)) 167 | return inetNtoP(address, ip: &ip) 168 | } 169 | 170 | fileprivate static func inetNtoP(_ addr:UnsafeMutablePointer, ip:UnsafeMutablePointer) -> String? { 171 | return addr.withMemoryRebound(to: sockaddr_in6.self, capacity: 1) { addr6 in 172 | let conversion:UnsafePointer = inet_ntop(AF_INET6, &addr6.pointee.sin6_addr, ip, socklen_t(INET6_ADDRSTRLEN)) 173 | return String(cString: conversion) 174 | } 175 | } 176 | 177 | /** 178 | * Creates the network format representation of the interface's IP address. Wraps `inet_pton`. 179 | */ 180 | open var addressBytes: [UInt8]? { 181 | guard let addr = address else { return nil } 182 | 183 | let af:Int32 184 | let len:Int 185 | switch family { 186 | case .ipv4: 187 | af = AF_INET 188 | len = 4 189 | case .ipv6: 190 | af = AF_INET6 191 | len = 16 192 | default: 193 | return nil 194 | } 195 | var bytes = [UInt8](repeating: 0, count: len) 196 | let result = inet_pton(af, addr, &bytes) 197 | return ( result == 1 ) ? bytes : nil 198 | } 199 | 200 | /// `IFF_RUNNING` flag of `ifaddrs->ifa_flags`. 201 | open var isRunning: Bool { return running } 202 | 203 | /// `IFF_UP` flag of `ifaddrs->ifa_flags`. 204 | open var isUp: Bool { return up } 205 | 206 | /// `IFF_LOOPBACK` flag of `ifaddrs->ifa_flags`. 207 | open var isLoopback: Bool { return loopback } 208 | 209 | /// `IFF_MULTICAST` flag of `ifaddrs->ifa_flags`. 210 | open var supportsMulticast: Bool { return multicastSupported } 211 | 212 | /// Field `ifaddrs->ifa_name`. 213 | public let name : String 214 | 215 | /// Field `ifaddrs->ifa_addr->sa_family`. 216 | public let family : Family 217 | 218 | /// Extracted from `ifaddrs->ifa_addr`, supports both IPv4 and IPv6. 219 | public let address : String? 220 | 221 | /// Extracted from `ifaddrs->ifa_netmask`, supports both IPv4 and IPv6. 222 | public let netmask : String? 223 | 224 | /// Extracted from `ifaddrs->ifa_dstaddr`. Not applicable for IPv6. 225 | public let broadcastAddress : String? 226 | 227 | fileprivate let running : Bool 228 | fileprivate let up : Bool 229 | fileprivate let loopback : Bool 230 | fileprivate let multicastSupported : Bool 231 | 232 | /// Returns the interface name. 233 | open var description: String { return name } 234 | 235 | /// Returns a string containing a few properties of the Interface. 236 | open var debugDescription: String { 237 | var s = "Interface name:\(name) family:\(family)" 238 | if let ip = address { 239 | s += " ip:\(ip)" 240 | } 241 | s += isUp ? " (up)" : " (down)" 242 | s += isRunning ? " (running)" : "(not running)" 243 | return s 244 | } 245 | } 246 | 247 | #if swift(>=5) 248 | extension Interface: Identifiable {} 249 | #endif 250 | -------------------------------------------------------------------------------- /NetUtils/NetUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Stefan van den Oord. All rights reserved. 2 | 3 | #import 4 | 5 | //! Project version number for NetUtils. 6 | FOUNDATION_EXPORT double NetUtilsVersionNumber; 7 | 8 | //! Project version string for NetUtils. 9 | FOUNDATION_EXPORT const unsigned char NetUtilsVersionString[]; 10 | 11 | // In this header, you should import all the public headers of your framework using statements like #import 12 | -------------------------------------------------------------------------------- /NetUtilsTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /NetUtilsTests/NetUtilsTests.swift: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2015 Stefan van den Oord. All rights reserved. 2 | 3 | import XCTest 4 | import NetUtils 5 | 6 | class NetUtilsTests: XCTestCase { 7 | 8 | func testAllInterfaces() { 9 | let interfaces = Interface.allInterfaces() 10 | dumpInterfaces(interfaces: interfaces) 11 | XCTAssertTrue(interfaces.count >= 2) /* at least loopback and ethernet */ 12 | } 13 | 14 | func testNonLoopbackIPV4Interfaces() { 15 | let interfaces = Interface.allInterfaces() 16 | let filtered = interfaces.filter { ($0.family == .ipv4 && !$0.isLoopback) } 17 | dumpInterfaces(interfaces: filtered) 18 | XCTAssertTrue(filtered.count >= 1) 19 | } 20 | 21 | func testCreateDummyInterface() { 22 | let i = Interface.createTestDummy("dummyInterface", family: .ipv4, address: "1.2.3.4", multicastSupported: false, broadcastAddress: "5.6.7.8") 23 | XCTAssertEqual(i.name, "dummyInterface") 24 | XCTAssertEqual(i.family, Interface.Family.ipv4) 25 | XCTAssertEqual(i.address, "1.2.3.4") 26 | XCTAssertFalse(i.supportsMulticast) 27 | XCTAssertEqual(i.broadcastAddress, "5.6.7.8") 28 | } 29 | 30 | func testInet4AddressAsByteArray() { 31 | let i = Interface.createTestDummy("lo0", family: .ipv4, address: "127.0.0.1", multicastSupported: false, broadcastAddress: nil) 32 | let bytes:[UInt8] = i.addressBytes! 33 | XCTAssertEqual(bytes.count, 4) 34 | XCTAssertEqual(bytes[0], 0x7F) 35 | XCTAssertEqual(bytes[1], 0) 36 | XCTAssertEqual(bytes[2], 0) 37 | XCTAssertEqual(bytes[3], 1) 38 | } 39 | 40 | func testInet6AddressAsByteArray() { 41 | let i = Interface.createTestDummy("lo0", family: .ipv6, address: "fe80::dead:beaf", multicastSupported: false, broadcastAddress: nil) 42 | let addressbytes:[UInt8]? = i.addressBytes 43 | XCTAssert(addressbytes != nil) 44 | if let bytes = addressbytes { 45 | XCTAssertEqual(bytes.count, 16) 46 | XCTAssertEqual(bytes[0], 0xFE) 47 | XCTAssertEqual(bytes[1], 0x80) 48 | XCTAssertEqual(bytes[2], 0x00) 49 | XCTAssertEqual(bytes[3], 0x00) 50 | XCTAssertEqual(bytes[4], 0x00) 51 | XCTAssertEqual(bytes[5], 0x00) 52 | XCTAssertEqual(bytes[6], 0x00) 53 | XCTAssertEqual(bytes[7], 0x00) 54 | XCTAssertEqual(bytes[8], 0x00) 55 | XCTAssertEqual(bytes[9], 0x00) 56 | XCTAssertEqual(bytes[10], 0x00) 57 | XCTAssertEqual(bytes[11], 0x00) 58 | XCTAssertEqual(bytes[12], 0xDE) 59 | XCTAssertEqual(bytes[13], 0xAD) 60 | XCTAssertEqual(bytes[14], 0xBE) 61 | XCTAssertEqual(bytes[15], 0xAF) 62 | } 63 | } 64 | 65 | func dumpInterfaces(interfaces:[Interface]) { 66 | for i in interfaces { 67 | let running = i.isRunning ? "running" : "not running" 68 | let up = i.isUp ? "up" : "down" 69 | let loopback = i.isLoopback ? ", loopback" : "" 70 | print("\(i.name) (\(running), \(up)\(loopback))") 71 | print(" Family: \(i.family.toString())") 72 | if let a = i.address { 73 | print(" Address: \(a)") 74 | } 75 | if let nm = i.netmask { 76 | print(" Netmask: \(nm)") 77 | } 78 | if let b = i.broadcastAddress { 79 | print(" broadcast: \(b)") 80 | } 81 | let mc = i.supportsMulticast ? "yes" : "no" 82 | print(" multicast: \(mc)") 83 | } 84 | } 85 | } 86 | -------------------------------------------------------------------------------- /NetUtilsTests/XCTestManifests.swift: -------------------------------------------------------------------------------- 1 | import XCTest 2 | 3 | extension NetUtilsTests { 4 | static let __allTests = [ 5 | ("testAllInterfaces", testAllInterfaces), 6 | ("testCreateDummyInterface", testCreateDummyInterface), 7 | ("testInet4AddressAsByteArray", testInet4AddressAsByteArray), 8 | ("testInet6AddressAsByteArray", testInet6AddressAsByteArray), 9 | ("testNonLoopbackIPV4Interfaces", testNonLoopbackIPV4Interfaces), 10 | ] 11 | } 12 | 13 | #if !os(macOS) 14 | public func __allTests() -> [XCTestCaseEntry] { 15 | return [ 16 | testCase(NetUtilsTests.__allTests), 17 | ] 18 | } 19 | #endif 20 | -------------------------------------------------------------------------------- /Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:4.0 2 | 3 | import PackageDescription 4 | 5 | let package = Package( 6 | name: "NetUtils", 7 | products: [ 8 | .library( 9 | name: "NetUtils", 10 | targets: ["NetUtils"]), 11 | ], 12 | dependencies: [ 13 | ], 14 | targets: [ 15 | .target( 16 | name: "NetUtils", 17 | dependencies: [], 18 | path: "NetUtils"), 19 | .testTarget( 20 | name: "NetUtilsTests", 21 | dependencies: ["NetUtils"], 22 | path: "NetUtilsTests") 23 | ] 24 | ) 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # NetUtils for Swift 2 | 3 | ![Swift Version 4](https://img.shields.io/badge/Swift-v4-yellow.svg) 4 | ![Swift Version 5](https://img.shields.io/badge/Swift-v5-yellow.svg) 5 | [![CocoaPods Version Badge](https://img.shields.io/cocoapods/v/NetUtils.svg)](https://cocoapods.org/pods/NetUtils) 6 | [![License Badge](https://img.shields.io/cocoapods/l/NetUtils.svg)](LICENSE.txt) 7 | ![Supported Platforms](https://img.shields.io/badge/platform-ios%20%7C%20macos%20%7C%20linux-lightgrey.svg) 8 | [![Percentage Documented Badge](http://svdo.github.io/swift-netutils/badge.svg)](http://svdo.github.io/swift-netutils/) 9 | [![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) 10 | [![Swift Package Manager compatible](https://img.shields.io/badge/Swift%20Package%20Manager-compatible-brightgreen.svg)](https://github.com/apple/swift-package-manager) 11 | [![Swift Build](https://github.com/svdo/swift-netutils/actions/workflows/swift-package.yml/badge.svg)](https://github.com/svdo/swift-netutils/actions/workflows/swift-package.yml) 12 | [![Xcode Build](https://github.com/svdo/swift-netutils/actions/workflows/objective-c-xcode.yml/badge.svg)](https://github.com/svdo/swift-netutils/actions/workflows/objective-c-xcode.yml) 13 | [![Join the chat at https://gitter.im/NetUtils-for-Swift/Lobby](https://badges.gitter.im/NetUtils-for-Swift/Lobby.svg)](https://gitter.im/NetUtils-for-Swift/Lobby) 14 | 15 | Swift library that simplifies getting information about your network interfaces 16 | and their properties, both for iOS, macOS and Linux. This library is a wrapper 17 | around the BSD APIs like `getifaddrs`, to make it easy to use them from Swift. 18 | 19 | Recommended way of integrating this library on macOS or iOS is using CocoaPods: 20 | https://cocoapods.org/pods/NetUtils. On Linux I recommend using the Swift 21 | Package Manager. 22 | 23 | This library works with both Swift 4 and Swift 5. 24 | 25 | ## Background Info 26 | 27 | Some system APIs you can simply use from Swift, but others you cannot. The 28 | difference is that some are made available as a module, and some are not. The 29 | APIs around network interfaces are not exposed as a module, which means that you 30 | cannot use them from Swift without defining a module for them yourself. I 31 | documented this problem extensively [in a blog post][blog-post]. 32 | 33 | ## Installation 34 | 35 | This library can be installed via CocoaPods, Carthage and Swift Package Manager. 36 | 37 | ## Usage 38 | 39 | This module contains only one class: `Interface`. This class represents a 40 | network interface. It has a static method to list all interfaces, somewhat 41 | surprisingly called `allInterfaces()`. This will return an array of `Interface` 42 | objects, which contain properties like their IP address, family, whether they 43 | are up and running, etc. 44 | 45 | Please note that both IPv4 and IPv6 interfaces are supported. 46 | 47 | ## License 48 | 49 | This project is released under the [MIT license](LICENSE.txt). 50 | 51 | [blog-post]: https://medium.com/@stefanvdoord/using-system-headers-in-swift-8731e972adfe 52 | -------------------------------------------------------------------------------- /Tests/Linux/App/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /.build 3 | /Packages 4 | /*.xcodeproj 5 | -------------------------------------------------------------------------------- /Tests/Linux/App/Package.swift: -------------------------------------------------------------------------------- 1 | // swift-tools-version:4.2 2 | // The swift-tools-version declares the minimum version of Swift required to build this package. 3 | 4 | import PackageDescription 5 | 6 | let package = Package( 7 | name: "App", 8 | dependencies: [ 9 | // Dependencies declare other packages that this package depends on. 10 | // .package(url: /* package url */, from: "1.0.0"), 11 | .package(url: "https://github.com/svdo/swift-netutils", from: "4.2.1") 12 | ], 13 | targets: [ 14 | // Targets are the basic building blocks of a package. A target can define a module or a test suite. 15 | // Targets can depend on other targets in this package, and on products in packages which this package depends on. 16 | .target( 17 | name: "App", 18 | dependencies: ["NetUtils"]), 19 | ] 20 | ) 21 | -------------------------------------------------------------------------------- /Tests/Linux/App/README.md: -------------------------------------------------------------------------------- 1 | # App 2 | 3 | A description of this package. 4 | -------------------------------------------------------------------------------- /Tests/Linux/App/Sources/App/main.swift: -------------------------------------------------------------------------------- 1 | import NetUtils 2 | 3 | print("\(Interface.allInterfaces())") 4 | 5 | -------------------------------------------------------------------------------- /Tests/Swift4/App/.gitignore: -------------------------------------------------------------------------------- 1 | Pods 2 | App.xcworkspace 3 | Podfile.lock 4 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 532BC40BA99BA6706D55744E /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E4BE2BA48FD9EDF3DDACA36 /* Pods_App.framework */; }; 11 | F8FF4BFB1F7655840038C912 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8FF4BFA1F7655840038C912 /* AppDelegate.swift */; }; 12 | F8FF4BFD1F7655840038C912 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8FF4BFC1F7655840038C912 /* ViewController.swift */; }; 13 | F8FF4C001F7655840038C912 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8FF4BFE1F7655840038C912 /* Main.storyboard */; }; 14 | F8FF4C021F7655840038C912 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8FF4C011F7655840038C912 /* Assets.xcassets */; }; 15 | F8FF4C051F7655840038C912 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8FF4C031F7655840038C912 /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 8E4BE2BA48FD9EDF3DDACA36 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 91C959B08BB6B6B9AECECD52 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = ""; }; 21 | F8FF4BF71F7655840038C912 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | F8FF4BFA1F7655840038C912 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | F8FF4BFC1F7655840038C912 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | F8FF4BFF1F7655840038C912 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | F8FF4C011F7655840038C912 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | F8FF4C041F7655840038C912 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | F8FF4C061F7655850038C912 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | FAA392D3D0AFC21A3A449AD5 /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | F8FF4BF41F7655840038C912 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | 532BC40BA99BA6706D55744E /* Pods_App.framework in Frameworks */, 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 2C10602ECE567C7BEC44DE7B /* Frameworks */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | 8E4BE2BA48FD9EDF3DDACA36 /* Pods_App.framework */, 47 | ); 48 | name = Frameworks; 49 | sourceTree = ""; 50 | }; 51 | 50D8710F331093C3D06F82D4 /* Pods */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | FAA392D3D0AFC21A3A449AD5 /* Pods-App.debug.xcconfig */, 55 | 91C959B08BB6B6B9AECECD52 /* Pods-App.release.xcconfig */, 56 | ); 57 | name = Pods; 58 | sourceTree = ""; 59 | }; 60 | F8FF4BEE1F7655840038C912 = { 61 | isa = PBXGroup; 62 | children = ( 63 | F8FF4BF91F7655840038C912 /* App */, 64 | F8FF4BF81F7655840038C912 /* Products */, 65 | 50D8710F331093C3D06F82D4 /* Pods */, 66 | 2C10602ECE567C7BEC44DE7B /* Frameworks */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | F8FF4BF81F7655840038C912 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | F8FF4BF71F7655840038C912 /* App.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | F8FF4BF91F7655840038C912 /* App */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | F8FF4BFA1F7655840038C912 /* AppDelegate.swift */, 82 | F8FF4BFC1F7655840038C912 /* ViewController.swift */, 83 | F8FF4BFE1F7655840038C912 /* Main.storyboard */, 84 | F8FF4C011F7655840038C912 /* Assets.xcassets */, 85 | F8FF4C031F7655840038C912 /* LaunchScreen.storyboard */, 86 | F8FF4C061F7655850038C912 /* Info.plist */, 87 | ); 88 | path = App; 89 | sourceTree = ""; 90 | }; 91 | /* End PBXGroup section */ 92 | 93 | /* Begin PBXNativeTarget section */ 94 | F8FF4BF61F7655840038C912 /* App */ = { 95 | isa = PBXNativeTarget; 96 | buildConfigurationList = F8FF4C091F7655850038C912 /* Build configuration list for PBXNativeTarget "App" */; 97 | buildPhases = ( 98 | 4E90E28FDB9126C90C5F38CA /* [CP] Check Pods Manifest.lock */, 99 | F8FF4BF31F7655840038C912 /* Sources */, 100 | F8FF4BF41F7655840038C912 /* Frameworks */, 101 | F8FF4BF51F7655840038C912 /* Resources */, 102 | 8109F570E348127F284D5143 /* [CP] Embed Pods Frameworks */, 103 | ); 104 | buildRules = ( 105 | ); 106 | dependencies = ( 107 | ); 108 | name = App; 109 | productName = App; 110 | productReference = F8FF4BF71F7655840038C912 /* App.app */; 111 | productType = "com.apple.product-type.application"; 112 | }; 113 | /* End PBXNativeTarget section */ 114 | 115 | /* Begin PBXProject section */ 116 | F8FF4BEF1F7655840038C912 /* Project object */ = { 117 | isa = PBXProject; 118 | attributes = { 119 | LastSwiftUpdateCheck = 0900; 120 | LastUpgradeCheck = 0900; 121 | ORGANIZATIONNAME = "Stefan van den Oord"; 122 | TargetAttributes = { 123 | F8FF4BF61F7655840038C912 = { 124 | CreatedOnToolsVersion = 9.0; 125 | ProvisioningStyle = Automatic; 126 | }; 127 | }; 128 | }; 129 | buildConfigurationList = F8FF4BF21F7655840038C912 /* Build configuration list for PBXProject "App" */; 130 | compatibilityVersion = "Xcode 8.0"; 131 | developmentRegion = en; 132 | hasScannedForEncodings = 0; 133 | knownRegions = ( 134 | en, 135 | Base, 136 | ); 137 | mainGroup = F8FF4BEE1F7655840038C912; 138 | productRefGroup = F8FF4BF81F7655840038C912 /* Products */; 139 | projectDirPath = ""; 140 | projectRoot = ""; 141 | targets = ( 142 | F8FF4BF61F7655840038C912 /* App */, 143 | ); 144 | }; 145 | /* End PBXProject section */ 146 | 147 | /* Begin PBXResourcesBuildPhase section */ 148 | F8FF4BF51F7655840038C912 /* Resources */ = { 149 | isa = PBXResourcesBuildPhase; 150 | buildActionMask = 2147483647; 151 | files = ( 152 | F8FF4C051F7655840038C912 /* LaunchScreen.storyboard in Resources */, 153 | F8FF4C021F7655840038C912 /* Assets.xcassets in Resources */, 154 | F8FF4C001F7655840038C912 /* Main.storyboard in Resources */, 155 | ); 156 | runOnlyForDeploymentPostprocessing = 0; 157 | }; 158 | /* End PBXResourcesBuildPhase section */ 159 | 160 | /* Begin PBXShellScriptBuildPhase section */ 161 | 4E90E28FDB9126C90C5F38CA /* [CP] Check Pods Manifest.lock */ = { 162 | isa = PBXShellScriptBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | ); 166 | inputFileListPaths = ( 167 | ); 168 | inputPaths = ( 169 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 170 | "${PODS_ROOT}/Manifest.lock", 171 | ); 172 | name = "[CP] Check Pods Manifest.lock"; 173 | outputFileListPaths = ( 174 | ); 175 | outputPaths = ( 176 | "$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt", 177 | ); 178 | runOnlyForDeploymentPostprocessing = 0; 179 | shellPath = /bin/sh; 180 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 181 | showEnvVarsInLog = 0; 182 | }; 183 | 8109F570E348127F284D5143 /* [CP] Embed Pods Frameworks */ = { 184 | isa = PBXShellScriptBuildPhase; 185 | buildActionMask = 2147483647; 186 | files = ( 187 | ); 188 | inputPaths = ( 189 | "${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh", 190 | "${BUILT_PRODUCTS_DIR}/NetUtils/NetUtils.framework", 191 | ); 192 | name = "[CP] Embed Pods Frameworks"; 193 | outputPaths = ( 194 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NetUtils.framework", 195 | ); 196 | runOnlyForDeploymentPostprocessing = 0; 197 | shellPath = /bin/sh; 198 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n"; 199 | showEnvVarsInLog = 0; 200 | }; 201 | /* End PBXShellScriptBuildPhase section */ 202 | 203 | /* Begin PBXSourcesBuildPhase section */ 204 | F8FF4BF31F7655840038C912 /* Sources */ = { 205 | isa = PBXSourcesBuildPhase; 206 | buildActionMask = 2147483647; 207 | files = ( 208 | F8FF4BFD1F7655840038C912 /* ViewController.swift in Sources */, 209 | F8FF4BFB1F7655840038C912 /* AppDelegate.swift in Sources */, 210 | ); 211 | runOnlyForDeploymentPostprocessing = 0; 212 | }; 213 | /* End PBXSourcesBuildPhase section */ 214 | 215 | /* Begin PBXVariantGroup section */ 216 | F8FF4BFE1F7655840038C912 /* Main.storyboard */ = { 217 | isa = PBXVariantGroup; 218 | children = ( 219 | F8FF4BFF1F7655840038C912 /* Base */, 220 | ); 221 | name = Main.storyboard; 222 | sourceTree = ""; 223 | }; 224 | F8FF4C031F7655840038C912 /* LaunchScreen.storyboard */ = { 225 | isa = PBXVariantGroup; 226 | children = ( 227 | F8FF4C041F7655840038C912 /* Base */, 228 | ); 229 | name = LaunchScreen.storyboard; 230 | sourceTree = ""; 231 | }; 232 | /* End PBXVariantGroup section */ 233 | 234 | /* Begin XCBuildConfiguration section */ 235 | F8FF4C071F7655850038C912 /* Debug */ = { 236 | isa = XCBuildConfiguration; 237 | buildSettings = { 238 | ALWAYS_SEARCH_USER_PATHS = NO; 239 | CLANG_ANALYZER_NONNULL = YES; 240 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 241 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 242 | CLANG_CXX_LIBRARY = "libc++"; 243 | CLANG_ENABLE_MODULES = YES; 244 | CLANG_ENABLE_OBJC_ARC = YES; 245 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 246 | CLANG_WARN_BOOL_CONVERSION = YES; 247 | CLANG_WARN_COMMA = YES; 248 | CLANG_WARN_CONSTANT_CONVERSION = YES; 249 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 250 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 251 | CLANG_WARN_EMPTY_BODY = YES; 252 | CLANG_WARN_ENUM_CONVERSION = YES; 253 | CLANG_WARN_INFINITE_RECURSION = YES; 254 | CLANG_WARN_INT_CONVERSION = YES; 255 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 256 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 257 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 258 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 259 | CLANG_WARN_STRICT_PROTOTYPES = YES; 260 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 261 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 262 | CLANG_WARN_UNREACHABLE_CODE = YES; 263 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 264 | CODE_SIGN_IDENTITY = "iPhone Developer"; 265 | COPY_PHASE_STRIP = NO; 266 | DEBUG_INFORMATION_FORMAT = dwarf; 267 | ENABLE_STRICT_OBJC_MSGSEND = YES; 268 | ENABLE_TESTABILITY = YES; 269 | GCC_C_LANGUAGE_STANDARD = gnu11; 270 | GCC_DYNAMIC_NO_PIC = NO; 271 | GCC_NO_COMMON_BLOCKS = YES; 272 | GCC_OPTIMIZATION_LEVEL = 0; 273 | GCC_PREPROCESSOR_DEFINITIONS = ( 274 | "DEBUG=1", 275 | "$(inherited)", 276 | ); 277 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 278 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 279 | GCC_WARN_UNDECLARED_SELECTOR = YES; 280 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 281 | GCC_WARN_UNUSED_FUNCTION = YES; 282 | GCC_WARN_UNUSED_VARIABLE = YES; 283 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 284 | MTL_ENABLE_DEBUG_INFO = YES; 285 | ONLY_ACTIVE_ARCH = YES; 286 | SDKROOT = iphoneos; 287 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 288 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 289 | }; 290 | name = Debug; 291 | }; 292 | F8FF4C081F7655850038C912 /* Release */ = { 293 | isa = XCBuildConfiguration; 294 | buildSettings = { 295 | ALWAYS_SEARCH_USER_PATHS = NO; 296 | CLANG_ANALYZER_NONNULL = YES; 297 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 298 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 299 | CLANG_CXX_LIBRARY = "libc++"; 300 | CLANG_ENABLE_MODULES = YES; 301 | CLANG_ENABLE_OBJC_ARC = YES; 302 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 303 | CLANG_WARN_BOOL_CONVERSION = YES; 304 | CLANG_WARN_COMMA = YES; 305 | CLANG_WARN_CONSTANT_CONVERSION = YES; 306 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 307 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 308 | CLANG_WARN_EMPTY_BODY = YES; 309 | CLANG_WARN_ENUM_CONVERSION = YES; 310 | CLANG_WARN_INFINITE_RECURSION = YES; 311 | CLANG_WARN_INT_CONVERSION = YES; 312 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 313 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 314 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 315 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 316 | CLANG_WARN_STRICT_PROTOTYPES = YES; 317 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 318 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 319 | CLANG_WARN_UNREACHABLE_CODE = YES; 320 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 321 | CODE_SIGN_IDENTITY = "iPhone Developer"; 322 | COPY_PHASE_STRIP = NO; 323 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 324 | ENABLE_NS_ASSERTIONS = NO; 325 | ENABLE_STRICT_OBJC_MSGSEND = YES; 326 | GCC_C_LANGUAGE_STANDARD = gnu11; 327 | GCC_NO_COMMON_BLOCKS = YES; 328 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 329 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 330 | GCC_WARN_UNDECLARED_SELECTOR = YES; 331 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 332 | GCC_WARN_UNUSED_FUNCTION = YES; 333 | GCC_WARN_UNUSED_VARIABLE = YES; 334 | IPHONEOS_DEPLOYMENT_TARGET = 11.0; 335 | MTL_ENABLE_DEBUG_INFO = NO; 336 | SDKROOT = iphoneos; 337 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 338 | VALIDATE_PRODUCT = YES; 339 | }; 340 | name = Release; 341 | }; 342 | F8FF4C0A1F7655850038C912 /* Debug */ = { 343 | isa = XCBuildConfiguration; 344 | baseConfigurationReference = FAA392D3D0AFC21A3A449AD5 /* Pods-App.debug.xcconfig */; 345 | buildSettings = { 346 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 347 | CODE_SIGN_STYLE = Automatic; 348 | DEVELOPMENT_TEAM = 7EQ9KX3BR9; 349 | INFOPLIST_FILE = App/Info.plist; 350 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 351 | PRODUCT_BUNDLE_IDENTIFIER = com.vandenoord.App; 352 | PRODUCT_NAME = "$(TARGET_NAME)"; 353 | SWIFT_VERSION = 4.0; 354 | TARGETED_DEVICE_FAMILY = "1,2"; 355 | }; 356 | name = Debug; 357 | }; 358 | F8FF4C0B1F7655850038C912 /* Release */ = { 359 | isa = XCBuildConfiguration; 360 | baseConfigurationReference = 91C959B08BB6B6B9AECECD52 /* Pods-App.release.xcconfig */; 361 | buildSettings = { 362 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 363 | CODE_SIGN_STYLE = Automatic; 364 | DEVELOPMENT_TEAM = 7EQ9KX3BR9; 365 | INFOPLIST_FILE = App/Info.plist; 366 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 367 | PRODUCT_BUNDLE_IDENTIFIER = com.vandenoord.App; 368 | PRODUCT_NAME = "$(TARGET_NAME)"; 369 | SWIFT_VERSION = 4.0; 370 | TARGETED_DEVICE_FAMILY = "1,2"; 371 | }; 372 | name = Release; 373 | }; 374 | /* End XCBuildConfiguration section */ 375 | 376 | /* Begin XCConfigurationList section */ 377 | F8FF4BF21F7655840038C912 /* Build configuration list for PBXProject "App" */ = { 378 | isa = XCConfigurationList; 379 | buildConfigurations = ( 380 | F8FF4C071F7655850038C912 /* Debug */, 381 | F8FF4C081F7655850038C912 /* Release */, 382 | ); 383 | defaultConfigurationIsVisible = 0; 384 | defaultConfigurationName = Release; 385 | }; 386 | F8FF4C091F7655850038C912 /* Build configuration list for PBXNativeTarget "App" */ = { 387 | isa = XCConfigurationList; 388 | buildConfigurations = ( 389 | F8FF4C0A1F7655850038C912 /* Debug */, 390 | F8FF4C0B1F7655850038C912 /* Release */, 391 | ); 392 | defaultConfigurationIsVisible = 0; 393 | defaultConfigurationName = Release; 394 | }; 395 | /* End XCConfigurationList section */ 396 | }; 397 | rootObject = F8FF4BEF1F7655840038C912 /* Project object */; 398 | } 399 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App.xcodeproj/xcshareddata/xcschemes/App.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 31 | 32 | 33 | 34 | 40 | 41 | 42 | 43 | 44 | 45 | 56 | 58 | 64 | 65 | 66 | 67 | 68 | 69 | 75 | 77 | 83 | 84 | 85 | 86 | 88 | 89 | 92 | 93 | 94 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 Stefan van den Oord. All rights reserved. 2 | 3 | import UIKit 4 | 5 | @UIApplicationMain 6 | class AppDelegate: UIResponder, UIApplicationDelegate { 7 | 8 | var window: UIWindow? 9 | 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Tests/Swift4/App/App/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Tests/Swift4/App/App/ViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 Stefan van den Oord. All rights reserved. 2 | 3 | import UIKit 4 | import NetUtils 5 | 6 | class ViewController: UIViewController { 7 | 8 | override func viewDidLoad() { 9 | super.viewDidLoad() 10 | print("\(Interface.allInterfaces())") 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Tests/Swift4/App/Podfile: -------------------------------------------------------------------------------- 1 | target 'App' do 2 | use_frameworks! 3 | pod 'NetUtils', :git => 'https://github.com/svdo/swift-NetUtils', :branch => 'master' 4 | end 5 | -------------------------------------------------------------------------------- /Tests/Swift4/runTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -o pipefail 4 | 5 | scriptdir=$(cd $(dirname $0) && pwd) 6 | echo "Running Pod test for $(basename ${scriptdir})." 7 | 8 | xcodeVersion=$(xcrun xcodebuild -version) 9 | if ( ! ( echo ${xcodeVersion} | grep "Xcode 13" > /dev/null 2>&1 ) ); then 10 | echo "Expected Xcode 13.x, got "$(xcrun xcodebuild -version|grep "Xcode ") 11 | exit 1 12 | fi 13 | 14 | ( 15 | cd $(dirname $0)/App 16 | pod install 17 | xcrun xcodebuild -workspace App.xcworkspace -scheme App -sdk iphonesimulator | xcpretty 18 | ) 19 | -------------------------------------------------------------------------------- /Tests/Swift5/App/.gitignore: -------------------------------------------------------------------------------- 1 | Pods 2 | App.xcworkspace 3 | Podfile.lock 4 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 48; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 532BC40BA99BA6706D55744E /* Pods_App.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8E4BE2BA48FD9EDF3DDACA36 /* Pods_App.framework */; }; 11 | F8FF4BFB1F7655840038C912 /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8FF4BFA1F7655840038C912 /* AppDelegate.swift */; }; 12 | F8FF4BFD1F7655840038C912 /* ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = F8FF4BFC1F7655840038C912 /* ViewController.swift */; }; 13 | F8FF4C001F7655840038C912 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8FF4BFE1F7655840038C912 /* Main.storyboard */; }; 14 | F8FF4C021F7655840038C912 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = F8FF4C011F7655840038C912 /* Assets.xcassets */; }; 15 | F8FF4C051F7655840038C912 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = F8FF4C031F7655840038C912 /* LaunchScreen.storyboard */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 8E4BE2BA48FD9EDF3DDACA36 /* Pods_App.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_App.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 91C959B08BB6B6B9AECECD52 /* Pods-App.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.release.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.release.xcconfig"; sourceTree = ""; }; 21 | F8FF4BF71F7655840038C912 /* App.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = App.app; sourceTree = BUILT_PRODUCTS_DIR; }; 22 | F8FF4BFA1F7655840038C912 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; 23 | F8FF4BFC1F7655840038C912 /* ViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ViewController.swift; sourceTree = ""; }; 24 | F8FF4BFF1F7655840038C912 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 25 | F8FF4C011F7655840038C912 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 26 | F8FF4C041F7655840038C912 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 27 | F8FF4C061F7655850038C912 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 28 | FAA392D3D0AFC21A3A449AD5 /* Pods-App.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-App.debug.xcconfig"; path = "Pods/Target Support Files/Pods-App/Pods-App.debug.xcconfig"; sourceTree = ""; }; 29 | /* End PBXFileReference section */ 30 | 31 | /* Begin PBXFrameworksBuildPhase section */ 32 | F8FF4BF41F7655840038C912 /* Frameworks */ = { 33 | isa = PBXFrameworksBuildPhase; 34 | buildActionMask = 2147483647; 35 | files = ( 36 | 532BC40BA99BA6706D55744E /* Pods_App.framework in Frameworks */, 37 | ); 38 | runOnlyForDeploymentPostprocessing = 0; 39 | }; 40 | /* End PBXFrameworksBuildPhase section */ 41 | 42 | /* Begin PBXGroup section */ 43 | 2C10602ECE567C7BEC44DE7B /* Frameworks */ = { 44 | isa = PBXGroup; 45 | children = ( 46 | 8E4BE2BA48FD9EDF3DDACA36 /* Pods_App.framework */, 47 | ); 48 | name = Frameworks; 49 | sourceTree = ""; 50 | }; 51 | 50D8710F331093C3D06F82D4 /* Pods */ = { 52 | isa = PBXGroup; 53 | children = ( 54 | FAA392D3D0AFC21A3A449AD5 /* Pods-App.debug.xcconfig */, 55 | 91C959B08BB6B6B9AECECD52 /* Pods-App.release.xcconfig */, 56 | ); 57 | name = Pods; 58 | sourceTree = ""; 59 | }; 60 | F8FF4BEE1F7655840038C912 = { 61 | isa = PBXGroup; 62 | children = ( 63 | F8FF4BF91F7655840038C912 /* App */, 64 | F8FF4BF81F7655840038C912 /* Products */, 65 | 50D8710F331093C3D06F82D4 /* Pods */, 66 | 2C10602ECE567C7BEC44DE7B /* Frameworks */, 67 | ); 68 | sourceTree = ""; 69 | }; 70 | F8FF4BF81F7655840038C912 /* Products */ = { 71 | isa = PBXGroup; 72 | children = ( 73 | F8FF4BF71F7655840038C912 /* App.app */, 74 | ); 75 | name = Products; 76 | sourceTree = ""; 77 | }; 78 | F8FF4BF91F7655840038C912 /* App */ = { 79 | isa = PBXGroup; 80 | children = ( 81 | F8FF4BFA1F7655840038C912 /* AppDelegate.swift */, 82 | F8FF4BFC1F7655840038C912 /* ViewController.swift */, 83 | F8FF4BFE1F7655840038C912 /* Main.storyboard */, 84 | F8FF4C011F7655840038C912 /* Assets.xcassets */, 85 | F8FF4C031F7655840038C912 /* LaunchScreen.storyboard */, 86 | F8FF4C061F7655850038C912 /* Info.plist */, 87 | ); 88 | path = App; 89 | sourceTree = ""; 90 | }; 91 | /* End PBXGroup section */ 92 | 93 | /* Begin PBXNativeTarget section */ 94 | F8FF4BF61F7655840038C912 /* App */ = { 95 | isa = PBXNativeTarget; 96 | buildConfigurationList = F8FF4C091F7655850038C912 /* Build configuration list for PBXNativeTarget "App" */; 97 | buildPhases = ( 98 | 4E90E28FDB9126C90C5F38CA /* [CP] Check Pods Manifest.lock */, 99 | F8FF4BF31F7655840038C912 /* Sources */, 100 | F8FF4BF41F7655840038C912 /* Frameworks */, 101 | F8FF4BF51F7655840038C912 /* Resources */, 102 | 8109F570E348127F284D5143 /* [CP] Embed Pods Frameworks */, 103 | ); 104 | buildRules = ( 105 | ); 106 | dependencies = ( 107 | ); 108 | name = App; 109 | productName = App; 110 | productReference = F8FF4BF71F7655840038C912 /* App.app */; 111 | productType = "com.apple.product-type.application"; 112 | }; 113 | /* End PBXNativeTarget section */ 114 | 115 | /* Begin PBXProject section */ 116 | F8FF4BEF1F7655840038C912 /* Project object */ = { 117 | isa = PBXProject; 118 | attributes = { 119 | LastSwiftUpdateCheck = 0900; 120 | LastUpgradeCheck = 1340; 121 | ORGANIZATIONNAME = "Stefan van den Oord"; 122 | TargetAttributes = { 123 | F8FF4BF61F7655840038C912 = { 124 | CreatedOnToolsVersion = 9.0; 125 | LastSwiftMigration = 1340; 126 | ProvisioningStyle = Automatic; 127 | }; 128 | }; 129 | }; 130 | buildConfigurationList = F8FF4BF21F7655840038C912 /* Build configuration list for PBXProject "App" */; 131 | compatibilityVersion = "Xcode 8.0"; 132 | developmentRegion = en; 133 | hasScannedForEncodings = 0; 134 | knownRegions = ( 135 | en, 136 | Base, 137 | ); 138 | mainGroup = F8FF4BEE1F7655840038C912; 139 | productRefGroup = F8FF4BF81F7655840038C912 /* Products */; 140 | projectDirPath = ""; 141 | projectRoot = ""; 142 | targets = ( 143 | F8FF4BF61F7655840038C912 /* App */, 144 | ); 145 | }; 146 | /* End PBXProject section */ 147 | 148 | /* Begin PBXResourcesBuildPhase section */ 149 | F8FF4BF51F7655840038C912 /* Resources */ = { 150 | isa = PBXResourcesBuildPhase; 151 | buildActionMask = 2147483647; 152 | files = ( 153 | F8FF4C051F7655840038C912 /* LaunchScreen.storyboard in Resources */, 154 | F8FF4C021F7655840038C912 /* Assets.xcassets in Resources */, 155 | F8FF4C001F7655840038C912 /* Main.storyboard in Resources */, 156 | ); 157 | runOnlyForDeploymentPostprocessing = 0; 158 | }; 159 | /* End PBXResourcesBuildPhase section */ 160 | 161 | /* Begin PBXShellScriptBuildPhase section */ 162 | 4E90E28FDB9126C90C5F38CA /* [CP] Check Pods Manifest.lock */ = { 163 | isa = PBXShellScriptBuildPhase; 164 | buildActionMask = 2147483647; 165 | files = ( 166 | ); 167 | inputFileListPaths = ( 168 | ); 169 | inputPaths = ( 170 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 171 | "${PODS_ROOT}/Manifest.lock", 172 | ); 173 | name = "[CP] Check Pods Manifest.lock"; 174 | outputFileListPaths = ( 175 | ); 176 | outputPaths = ( 177 | "$(DERIVED_FILE_DIR)/Pods-App-checkManifestLockResult.txt", 178 | ); 179 | runOnlyForDeploymentPostprocessing = 0; 180 | shellPath = /bin/sh; 181 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 182 | showEnvVarsInLog = 0; 183 | }; 184 | 8109F570E348127F284D5143 /* [CP] Embed Pods Frameworks */ = { 185 | isa = PBXShellScriptBuildPhase; 186 | buildActionMask = 2147483647; 187 | files = ( 188 | ); 189 | inputPaths = ( 190 | "${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh", 191 | "${BUILT_PRODUCTS_DIR}/NetUtils/NetUtils.framework", 192 | ); 193 | name = "[CP] Embed Pods Frameworks"; 194 | outputPaths = ( 195 | "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/NetUtils.framework", 196 | ); 197 | runOnlyForDeploymentPostprocessing = 0; 198 | shellPath = /bin/sh; 199 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-App/Pods-App-frameworks.sh\"\n"; 200 | showEnvVarsInLog = 0; 201 | }; 202 | /* End PBXShellScriptBuildPhase section */ 203 | 204 | /* Begin PBXSourcesBuildPhase section */ 205 | F8FF4BF31F7655840038C912 /* Sources */ = { 206 | isa = PBXSourcesBuildPhase; 207 | buildActionMask = 2147483647; 208 | files = ( 209 | F8FF4BFD1F7655840038C912 /* ViewController.swift in Sources */, 210 | F8FF4BFB1F7655840038C912 /* AppDelegate.swift in Sources */, 211 | ); 212 | runOnlyForDeploymentPostprocessing = 0; 213 | }; 214 | /* End PBXSourcesBuildPhase section */ 215 | 216 | /* Begin PBXVariantGroup section */ 217 | F8FF4BFE1F7655840038C912 /* Main.storyboard */ = { 218 | isa = PBXVariantGroup; 219 | children = ( 220 | F8FF4BFF1F7655840038C912 /* Base */, 221 | ); 222 | name = Main.storyboard; 223 | sourceTree = ""; 224 | }; 225 | F8FF4C031F7655840038C912 /* LaunchScreen.storyboard */ = { 226 | isa = PBXVariantGroup; 227 | children = ( 228 | F8FF4C041F7655840038C912 /* Base */, 229 | ); 230 | name = LaunchScreen.storyboard; 231 | sourceTree = ""; 232 | }; 233 | /* End PBXVariantGroup section */ 234 | 235 | /* Begin XCBuildConfiguration section */ 236 | F8FF4C071F7655850038C912 /* Debug */ = { 237 | isa = XCBuildConfiguration; 238 | buildSettings = { 239 | ALWAYS_SEARCH_USER_PATHS = NO; 240 | CLANG_ANALYZER_NONNULL = YES; 241 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 242 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 243 | CLANG_CXX_LIBRARY = "libc++"; 244 | CLANG_ENABLE_MODULES = YES; 245 | CLANG_ENABLE_OBJC_ARC = YES; 246 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 247 | CLANG_WARN_BOOL_CONVERSION = YES; 248 | CLANG_WARN_COMMA = YES; 249 | CLANG_WARN_CONSTANT_CONVERSION = YES; 250 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 251 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 252 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 253 | CLANG_WARN_EMPTY_BODY = YES; 254 | CLANG_WARN_ENUM_CONVERSION = YES; 255 | CLANG_WARN_INFINITE_RECURSION = YES; 256 | CLANG_WARN_INT_CONVERSION = YES; 257 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 258 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 259 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 260 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 261 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 262 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 263 | CLANG_WARN_STRICT_PROTOTYPES = YES; 264 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 265 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 266 | CLANG_WARN_UNREACHABLE_CODE = YES; 267 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 268 | CODE_SIGN_IDENTITY = "iPhone Developer"; 269 | COPY_PHASE_STRIP = NO; 270 | DEBUG_INFORMATION_FORMAT = dwarf; 271 | ENABLE_STRICT_OBJC_MSGSEND = YES; 272 | ENABLE_TESTABILITY = YES; 273 | GCC_C_LANGUAGE_STANDARD = gnu11; 274 | GCC_DYNAMIC_NO_PIC = NO; 275 | GCC_NO_COMMON_BLOCKS = YES; 276 | GCC_OPTIMIZATION_LEVEL = 0; 277 | GCC_PREPROCESSOR_DEFINITIONS = ( 278 | "DEBUG=1", 279 | "$(inherited)", 280 | ); 281 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 282 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 283 | GCC_WARN_UNDECLARED_SELECTOR = YES; 284 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 285 | GCC_WARN_UNUSED_FUNCTION = YES; 286 | GCC_WARN_UNUSED_VARIABLE = YES; 287 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 288 | MTL_ENABLE_DEBUG_INFO = YES; 289 | ONLY_ACTIVE_ARCH = YES; 290 | SDKROOT = iphoneos; 291 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; 292 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 293 | }; 294 | name = Debug; 295 | }; 296 | F8FF4C081F7655850038C912 /* Release */ = { 297 | isa = XCBuildConfiguration; 298 | buildSettings = { 299 | ALWAYS_SEARCH_USER_PATHS = NO; 300 | CLANG_ANALYZER_NONNULL = YES; 301 | CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; 302 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; 303 | CLANG_CXX_LIBRARY = "libc++"; 304 | CLANG_ENABLE_MODULES = YES; 305 | CLANG_ENABLE_OBJC_ARC = YES; 306 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 307 | CLANG_WARN_BOOL_CONVERSION = YES; 308 | CLANG_WARN_COMMA = YES; 309 | CLANG_WARN_CONSTANT_CONVERSION = YES; 310 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 311 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 312 | CLANG_WARN_DOCUMENTATION_COMMENTS = YES; 313 | CLANG_WARN_EMPTY_BODY = YES; 314 | CLANG_WARN_ENUM_CONVERSION = YES; 315 | CLANG_WARN_INFINITE_RECURSION = YES; 316 | CLANG_WARN_INT_CONVERSION = YES; 317 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 318 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 319 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 320 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 321 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 322 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 323 | CLANG_WARN_STRICT_PROTOTYPES = YES; 324 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 325 | CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; 326 | CLANG_WARN_UNREACHABLE_CODE = YES; 327 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 328 | CODE_SIGN_IDENTITY = "iPhone Developer"; 329 | COPY_PHASE_STRIP = NO; 330 | DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; 331 | ENABLE_NS_ASSERTIONS = NO; 332 | ENABLE_STRICT_OBJC_MSGSEND = YES; 333 | GCC_C_LANGUAGE_STANDARD = gnu11; 334 | GCC_NO_COMMON_BLOCKS = YES; 335 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 336 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 337 | GCC_WARN_UNDECLARED_SELECTOR = YES; 338 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 339 | GCC_WARN_UNUSED_FUNCTION = YES; 340 | GCC_WARN_UNUSED_VARIABLE = YES; 341 | IPHONEOS_DEPLOYMENT_TARGET = 12.0; 342 | MTL_ENABLE_DEBUG_INFO = NO; 343 | SDKROOT = iphoneos; 344 | SWIFT_OPTIMIZATION_LEVEL = "-Owholemodule"; 345 | VALIDATE_PRODUCT = YES; 346 | }; 347 | name = Release; 348 | }; 349 | F8FF4C0A1F7655850038C912 /* Debug */ = { 350 | isa = XCBuildConfiguration; 351 | baseConfigurationReference = FAA392D3D0AFC21A3A449AD5 /* Pods-App.debug.xcconfig */; 352 | buildSettings = { 353 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 354 | CODE_SIGN_STYLE = Automatic; 355 | DEVELOPMENT_TEAM = 7EQ9KX3BR9; 356 | INFOPLIST_FILE = App/Info.plist; 357 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 358 | PRODUCT_BUNDLE_IDENTIFIER = com.vandenoord.App; 359 | PRODUCT_NAME = "$(TARGET_NAME)"; 360 | SWIFT_VERSION = 5.0; 361 | TARGETED_DEVICE_FAMILY = "1,2"; 362 | }; 363 | name = Debug; 364 | }; 365 | F8FF4C0B1F7655850038C912 /* Release */ = { 366 | isa = XCBuildConfiguration; 367 | baseConfigurationReference = 91C959B08BB6B6B9AECECD52 /* Pods-App.release.xcconfig */; 368 | buildSettings = { 369 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 370 | CODE_SIGN_STYLE = Automatic; 371 | DEVELOPMENT_TEAM = 7EQ9KX3BR9; 372 | INFOPLIST_FILE = App/Info.plist; 373 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; 374 | PRODUCT_BUNDLE_IDENTIFIER = com.vandenoord.App; 375 | PRODUCT_NAME = "$(TARGET_NAME)"; 376 | SWIFT_VERSION = 5.0; 377 | TARGETED_DEVICE_FAMILY = "1,2"; 378 | }; 379 | name = Release; 380 | }; 381 | /* End XCBuildConfiguration section */ 382 | 383 | /* Begin XCConfigurationList section */ 384 | F8FF4BF21F7655840038C912 /* Build configuration list for PBXProject "App" */ = { 385 | isa = XCConfigurationList; 386 | buildConfigurations = ( 387 | F8FF4C071F7655850038C912 /* Debug */, 388 | F8FF4C081F7655850038C912 /* Release */, 389 | ); 390 | defaultConfigurationIsVisible = 0; 391 | defaultConfigurationName = Release; 392 | }; 393 | F8FF4C091F7655850038C912 /* Build configuration list for PBXNativeTarget "App" */ = { 394 | isa = XCConfigurationList; 395 | buildConfigurations = ( 396 | F8FF4C0A1F7655850038C912 /* Debug */, 397 | F8FF4C0B1F7655850038C912 /* Release */, 398 | ); 399 | defaultConfigurationIsVisible = 0; 400 | defaultConfigurationName = Release; 401 | }; 402 | /* End XCConfigurationList section */ 403 | }; 404 | rootObject = F8FF4BEF1F7655840038C912 /* Project object */; 405 | } 406 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App.xcodeproj/xcshareddata/xcschemes/App.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 37 | 38 | 39 | 40 | 41 | 42 | 52 | 54 | 60 | 61 | 62 | 63 | 69 | 71 | 77 | 78 | 79 | 80 | 82 | 83 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 Stefan van den Oord. All rights reserved. 2 | 3 | import UIKit 4 | 5 | @UIApplicationMain 6 | class AppDelegate: UIResponder, UIApplicationDelegate { 7 | 8 | var window: UIWindow? 9 | 10 | } 11 | 12 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App/Assets.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "20x20", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "20x20", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "29x29", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "29x29", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "40x40", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "40x40", 31 | "scale" : "3x" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "size" : "60x60", 36 | "scale" : "2x" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "size" : "60x60", 41 | "scale" : "3x" 42 | }, 43 | { 44 | "idiom" : "ipad", 45 | "size" : "20x20", 46 | "scale" : "1x" 47 | }, 48 | { 49 | "idiom" : "ipad", 50 | "size" : "20x20", 51 | "scale" : "2x" 52 | }, 53 | { 54 | "idiom" : "ipad", 55 | "size" : "29x29", 56 | "scale" : "1x" 57 | }, 58 | { 59 | "idiom" : "ipad", 60 | "size" : "29x29", 61 | "scale" : "2x" 62 | }, 63 | { 64 | "idiom" : "ipad", 65 | "size" : "40x40", 66 | "scale" : "1x" 67 | }, 68 | { 69 | "idiom" : "ipad", 70 | "size" : "40x40", 71 | "scale" : "2x" 72 | }, 73 | { 74 | "idiom" : "ipad", 75 | "size" : "76x76", 76 | "scale" : "1x" 77 | }, 78 | { 79 | "idiom" : "ipad", 80 | "size" : "76x76", 81 | "scale" : "2x" 82 | }, 83 | { 84 | "idiom" : "ipad", 85 | "size" : "83.5x83.5", 86 | "scale" : "2x" 87 | } 88 | ], 89 | "info" : { 90 | "version" : 1, 91 | "author" : "xcode" 92 | } 93 | } -------------------------------------------------------------------------------- /Tests/Swift5/App/App/Base.lproj/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App/Base.lproj/Main.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | $(DEVELOPMENT_LANGUAGE) 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleVersion 20 | 1 21 | LSRequiresIPhoneOS 22 | 23 | UILaunchStoryboardName 24 | LaunchScreen 25 | UIMainStoryboardFile 26 | Main 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UISupportedInterfaceOrientations~ipad 38 | 39 | UIInterfaceOrientationPortrait 40 | UIInterfaceOrientationPortraitUpsideDown 41 | UIInterfaceOrientationLandscapeLeft 42 | UIInterfaceOrientationLandscapeRight 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /Tests/Swift5/App/App/ViewController.swift: -------------------------------------------------------------------------------- 1 | // Copyright © 2017 Stefan van den Oord. All rights reserved. 2 | 3 | import UIKit 4 | import NetUtils 5 | 6 | class ViewController: UIViewController { 7 | 8 | override func viewDidLoad() { 9 | super.viewDidLoad() 10 | print("\(Interface.allInterfaces())") 11 | } 12 | 13 | } 14 | 15 | -------------------------------------------------------------------------------- /Tests/Swift5/App/Podfile: -------------------------------------------------------------------------------- 1 | target 'App' do 2 | use_frameworks! 3 | pod 'NetUtils', :git => 'https://github.com/svdo/swift-NetUtils', :branch => 'master' 4 | end 5 | -------------------------------------------------------------------------------- /Tests/Swift5/runTest.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -o pipefail 4 | 5 | scriptdir=$(cd $(dirname $0) && pwd) 6 | echo "Running Pod test for $(basename ${scriptdir})." 7 | 8 | xcodeVersion=$(xcrun xcodebuild -version) 9 | if ( ! ( echo ${xcodeVersion} | grep "Xcode 13" > /dev/null 2>&1 ) ); then 10 | echo "Expected Xcode 13.x, got "$(xcrun xcodebuild -version|grep "Xcode ") 11 | exit 1 12 | fi 13 | 14 | ( 15 | cd $(dirname $0)/App 16 | pod install 17 | xcrun xcodebuild -workspace App.xcworkspace -scheme App -sdk iphonesimulator | xcpretty 18 | ) 19 | -------------------------------------------------------------------------------- /docs/Classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

NetUtils 4.2.1 Docs (95% documented)

21 |

GitHubView on GitHub

22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 | 35 |
36 |
37 | 60 |
61 |
62 |
63 |

Classes

64 |

The following classes are available globally.

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Interface 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 |

    This class represents a network interface in your system. For example, en0 with a certain IP address. 84 | It is a wrapper around the getifaddrs system call.

    85 | 86 |

    Typical use of this class is to first call Interface.allInterfaces() and then use the properties of the interface(s) that you need.

    87 |
    88 |

    See

    89 | /usr/include/ifaddrs.h 90 | 91 |
    92 | 93 | See more 94 |
    95 |
    96 |

    Declaration

    97 |
    98 |

    Swift

    99 |
    open class Interface : CustomStringConvertible, CustomDebugStringConvertible
    100 | 101 |
    102 |
    103 |
    104 | Show on GitHub 105 |
    106 |
    107 |
    108 |
  • 109 |
110 |
111 |
112 |
113 | 117 |
118 |
119 | 120 | 121 | -------------------------------------------------------------------------------- /docs/Classes/Interface/Family.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Family Enumeration Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

NetUtils 4.2.1 Docs (95% documented)

21 |

GitHubView on GitHub

22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 | 35 |
36 |
37 | 60 |
61 |
62 |
63 |

Family

64 |
65 |
66 | 67 |
public enum Family : Int
68 | 69 |
70 |
71 |

The network interface family (IPv4 or IPv6).

72 | 73 |
74 | Show on GitHub 75 |
76 |
77 |
78 |
79 |
    80 |
  • 81 |
    82 | 83 | 84 | 85 | ipv4 86 | 87 |
    88 |
    89 |
    90 |
    91 |
    92 |
    93 |

    IPv4.

    94 | 95 |
    96 |
    97 |

    Declaration

    98 |
    99 |

    Swift

    100 |
    case ipv4
    101 | 102 |
    103 |
    104 |
    105 | Show on GitHub 106 |
    107 |
    108 |
    109 |
  • 110 |
  • 111 |
    112 | 113 | 114 | 115 | ipv6 116 | 117 |
    118 |
    119 |
    120 |
    121 |
    122 |
    123 |

    IPv6.

    124 | 125 |
    126 |
    127 |

    Declaration

    128 |
    129 |

    Swift

    130 |
    case ipv6
    131 | 132 |
    133 |
    134 |
    135 | Show on GitHub 136 |
    137 |
    138 |
    139 |
  • 140 |
  • 141 |
    142 | 143 | 144 | 145 | other 146 | 147 |
    148 |
    149 |
    150 |
    151 |
    152 |
    153 |

    Used in case of errors.

    154 | 155 |
    156 |
    157 |

    Declaration

    158 |
    159 |

    Swift

    160 |
    case other
    161 | 162 |
    163 |
    164 |
    165 | Show on GitHub 166 |
    167 |
    168 |
    169 |
  • 170 |
  • 171 |
    172 | 173 | 174 | 175 | toString() 176 | 177 |
    178 |
    179 |
    180 |
    181 |
    182 |
    183 |

    String representation of the address family.

    184 | 185 |
    186 |
    187 |

    Declaration

    188 |
    189 |

    Swift

    190 |
    public func toString() -> String
    191 | 192 |
    193 |
    194 |
    195 | Show on GitHub 196 |
    197 |
    198 |
    199 |
  • 200 |
201 |
202 |
203 |
204 | 208 |
209 |
210 | 211 | 212 | -------------------------------------------------------------------------------- /docs/Extensions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Extensions Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

NetUtils 4.2.1 Docs (95% documented)

21 |

GitHubView on GitHub

22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 | 35 |
36 |
37 | 60 |
61 |
62 |
63 |

Extensions

64 |

The following extensions are available globally.

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Interface 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 | 84 |
    85 |
    86 |
    87 |
  • 88 |
89 |
90 |
91 |
92 | 96 |
97 |
98 | 99 | 100 | -------------------------------------------------------------------------------- /docs/badge.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | documentation 17 | 18 | 19 | documentation 20 | 21 | 22 | 95% 23 | 24 | 25 | 95% 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /docs/css/highlight.css: -------------------------------------------------------------------------------- 1 | /*! Jazzy - https://github.com/realm/jazzy 2 | * Copyright Realm Inc. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | /* Credit to https://gist.github.com/wataru420/2048287 */ 6 | .highlight .c { 7 | color: #999988; 8 | font-style: italic; } 9 | 10 | .highlight .err { 11 | color: #a61717; 12 | background-color: #e3d2d2; } 13 | 14 | .highlight .k { 15 | color: #000000; 16 | font-weight: bold; } 17 | 18 | .highlight .o { 19 | color: #000000; 20 | font-weight: bold; } 21 | 22 | .highlight .cm { 23 | color: #999988; 24 | font-style: italic; } 25 | 26 | .highlight .cp { 27 | color: #999999; 28 | font-weight: bold; } 29 | 30 | .highlight .c1 { 31 | color: #999988; 32 | font-style: italic; } 33 | 34 | .highlight .cs { 35 | color: #999999; 36 | font-weight: bold; 37 | font-style: italic; } 38 | 39 | .highlight .gd { 40 | color: #000000; 41 | background-color: #ffdddd; } 42 | 43 | .highlight .gd .x { 44 | color: #000000; 45 | background-color: #ffaaaa; } 46 | 47 | .highlight .ge { 48 | color: #000000; 49 | font-style: italic; } 50 | 51 | .highlight .gr { 52 | color: #aa0000; } 53 | 54 | .highlight .gh { 55 | color: #999999; } 56 | 57 | .highlight .gi { 58 | color: #000000; 59 | background-color: #ddffdd; } 60 | 61 | .highlight .gi .x { 62 | color: #000000; 63 | background-color: #aaffaa; } 64 | 65 | .highlight .go { 66 | color: #888888; } 67 | 68 | .highlight .gp { 69 | color: #555555; } 70 | 71 | .highlight .gs { 72 | font-weight: bold; } 73 | 74 | .highlight .gu { 75 | color: #aaaaaa; } 76 | 77 | .highlight .gt { 78 | color: #aa0000; } 79 | 80 | .highlight .kc { 81 | color: #000000; 82 | font-weight: bold; } 83 | 84 | .highlight .kd { 85 | color: #000000; 86 | font-weight: bold; } 87 | 88 | .highlight .kp { 89 | color: #000000; 90 | font-weight: bold; } 91 | 92 | .highlight .kr { 93 | color: #000000; 94 | font-weight: bold; } 95 | 96 | .highlight .kt { 97 | color: #445588; } 98 | 99 | .highlight .m { 100 | color: #009999; } 101 | 102 | .highlight .s { 103 | color: #d14; } 104 | 105 | .highlight .na { 106 | color: #008080; } 107 | 108 | .highlight .nb { 109 | color: #0086B3; } 110 | 111 | .highlight .nc { 112 | color: #445588; 113 | font-weight: bold; } 114 | 115 | .highlight .no { 116 | color: #008080; } 117 | 118 | .highlight .ni { 119 | color: #800080; } 120 | 121 | .highlight .ne { 122 | color: #990000; 123 | font-weight: bold; } 124 | 125 | .highlight .nf { 126 | color: #990000; } 127 | 128 | .highlight .nn { 129 | color: #555555; } 130 | 131 | .highlight .nt { 132 | color: #000080; } 133 | 134 | .highlight .nv { 135 | color: #008080; } 136 | 137 | .highlight .ow { 138 | color: #000000; 139 | font-weight: bold; } 140 | 141 | .highlight .w { 142 | color: #bbbbbb; } 143 | 144 | .highlight .mf { 145 | color: #009999; } 146 | 147 | .highlight .mh { 148 | color: #009999; } 149 | 150 | .highlight .mi { 151 | color: #009999; } 152 | 153 | .highlight .mo { 154 | color: #009999; } 155 | 156 | .highlight .sb { 157 | color: #d14; } 158 | 159 | .highlight .sc { 160 | color: #d14; } 161 | 162 | .highlight .sd { 163 | color: #d14; } 164 | 165 | .highlight .s2 { 166 | color: #d14; } 167 | 168 | .highlight .se { 169 | color: #d14; } 170 | 171 | .highlight .sh { 172 | color: #d14; } 173 | 174 | .highlight .si { 175 | color: #d14; } 176 | 177 | .highlight .sx { 178 | color: #d14; } 179 | 180 | .highlight .sr { 181 | color: #009926; } 182 | 183 | .highlight .s1 { 184 | color: #d14; } 185 | 186 | .highlight .ss { 187 | color: #990073; } 188 | 189 | .highlight .bp { 190 | color: #999999; } 191 | 192 | .highlight .vc { 193 | color: #008080; } 194 | 195 | .highlight .vg { 196 | color: #008080; } 197 | 198 | .highlight .vi { 199 | color: #008080; } 200 | 201 | .highlight .il { 202 | color: #009999; } 203 | -------------------------------------------------------------------------------- /docs/css/jazzy.css: -------------------------------------------------------------------------------- 1 | /*! Jazzy - https://github.com/realm/jazzy 2 | * Copyright Realm Inc. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 6 | background: transparent; 7 | border: 0; 8 | margin: 0; 9 | outline: 0; 10 | padding: 0; 11 | vertical-align: baseline; } 12 | 13 | body { 14 | background-color: #f2f2f2; 15 | font-family: Helvetica, freesans, Arial, sans-serif; 16 | font-size: 14px; 17 | -webkit-font-smoothing: subpixel-antialiased; 18 | word-wrap: break-word; } 19 | 20 | h1, h2, h3 { 21 | margin-top: 0.8em; 22 | margin-bottom: 0.3em; 23 | font-weight: 100; 24 | color: black; } 25 | 26 | h1 { 27 | font-size: 2.5em; } 28 | 29 | h2 { 30 | font-size: 2em; 31 | border-bottom: 1px solid #e2e2e2; } 32 | 33 | h4 { 34 | font-size: 13px; 35 | line-height: 1.5; 36 | margin-top: 21px; } 37 | 38 | h5 { 39 | font-size: 1.1em; } 40 | 41 | h6 { 42 | font-size: 1.1em; 43 | color: #777; } 44 | 45 | .section-name { 46 | color: gray; 47 | display: block; 48 | font-family: Helvetica; 49 | font-size: 22px; 50 | font-weight: 100; 51 | margin-bottom: 15px; } 52 | 53 | pre, code { 54 | font: 0.95em Menlo, monospace; 55 | color: #777; 56 | word-wrap: normal; } 57 | 58 | p code, li code { 59 | background-color: #eee; 60 | padding: 2px 4px; 61 | border-radius: 4px; } 62 | 63 | pre > code { 64 | padding: 0; } 65 | 66 | a { 67 | color: #0088cc; 68 | text-decoration: none; } 69 | a code { 70 | color: inherit; } 71 | 72 | ul { 73 | padding-left: 15px; } 74 | 75 | li { 76 | line-height: 1.8em; } 77 | 78 | img { 79 | max-width: 100%; } 80 | 81 | blockquote { 82 | margin-left: 0; 83 | padding: 0 10px; 84 | border-left: 4px solid #ccc; } 85 | 86 | hr { 87 | height: 1px; 88 | border: none; 89 | background-color: #e2e2e2; } 90 | 91 | .footnote-ref { 92 | display: inline-block; 93 | scroll-margin-top: 70px; } 94 | 95 | .footnote-def { 96 | scroll-margin-top: 70px; } 97 | 98 | .content-wrapper { 99 | margin: 0 auto; 100 | width: 980px; } 101 | 102 | header { 103 | font-size: 0.85em; 104 | line-height: 32px; 105 | background-color: #414141; 106 | position: fixed; 107 | width: 100%; 108 | z-index: 3; } 109 | header img { 110 | padding-right: 6px; 111 | vertical-align: -3px; 112 | height: 16px; } 113 | header a { 114 | color: #fff; } 115 | header p { 116 | float: left; 117 | color: #999; } 118 | header .header-right { 119 | float: right; 120 | margin-left: 16px; } 121 | 122 | #breadcrumbs { 123 | background-color: #f2f2f2; 124 | height: 21px; 125 | padding-top: 17px; 126 | position: fixed; 127 | width: 100%; 128 | z-index: 2; 129 | margin-top: 32px; } 130 | #breadcrumbs #carat { 131 | height: 10px; 132 | margin: 0 5px; } 133 | 134 | .sidebar { 135 | background-color: #f9f9f9; 136 | border: 1px solid #e2e2e2; 137 | overflow-y: auto; 138 | overflow-x: hidden; 139 | position: fixed; 140 | top: 70px; 141 | bottom: 0; 142 | width: 230px; 143 | word-wrap: normal; } 144 | 145 | .nav-groups { 146 | list-style-type: none; 147 | background: #fff; 148 | padding-left: 0; } 149 | 150 | .nav-group-name { 151 | border-bottom: 1px solid #e2e2e2; 152 | font-size: 1.1em; 153 | font-weight: 100; 154 | padding: 15px 0 15px 20px; } 155 | .nav-group-name > a { 156 | color: #333; } 157 | 158 | .nav-group-tasks { 159 | margin-top: 5px; } 160 | 161 | .nav-group-task { 162 | font-size: 0.9em; 163 | list-style-type: none; 164 | white-space: nowrap; } 165 | .nav-group-task a { 166 | color: #888; } 167 | 168 | .main-content { 169 | background-color: #fff; 170 | border: 1px solid #e2e2e2; 171 | margin-left: 246px; 172 | position: absolute; 173 | overflow: hidden; 174 | padding-bottom: 20px; 175 | top: 70px; 176 | width: 734px; } 177 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 178 | margin-bottom: 1em; } 179 | .main-content p { 180 | line-height: 1.8em; } 181 | .main-content section .section:first-child { 182 | margin-top: 0; 183 | padding-top: 0; } 184 | .main-content section .task-group-section .task-group:first-of-type { 185 | padding-top: 10px; } 186 | .main-content section .task-group-section .task-group:first-of-type .section-name { 187 | padding-top: 15px; } 188 | .main-content section .heading:before { 189 | content: ""; 190 | display: block; 191 | padding-top: 70px; 192 | margin: -70px 0 0; } 193 | .main-content .section-name p { 194 | margin-bottom: inherit; 195 | line-height: inherit; } 196 | .main-content .section-name code { 197 | background-color: inherit; 198 | padding: inherit; 199 | color: inherit; } 200 | 201 | .section { 202 | padding: 0 25px; } 203 | 204 | .highlight { 205 | background-color: #eee; 206 | padding: 10px 12px; 207 | border: 1px solid #e2e2e2; 208 | border-radius: 4px; 209 | overflow-x: auto; } 210 | 211 | .declaration .highlight { 212 | overflow-x: initial; 213 | padding: 0 40px 40px 0; 214 | margin-bottom: -25px; 215 | background-color: transparent; 216 | border: none; } 217 | 218 | .section-name { 219 | margin: 0; 220 | margin-left: 18px; } 221 | 222 | .task-group-section { 223 | margin-top: 10px; 224 | padding-left: 6px; 225 | border-top: 1px solid #e2e2e2; } 226 | 227 | .task-group { 228 | padding-top: 0px; } 229 | 230 | .task-name-container a[name]:before { 231 | content: ""; 232 | display: block; 233 | padding-top: 70px; 234 | margin: -70px 0 0; } 235 | 236 | .section-name-container { 237 | position: relative; 238 | display: inline-block; } 239 | .section-name-container .section-name-link { 240 | position: absolute; 241 | top: 0; 242 | left: 0; 243 | bottom: 0; 244 | right: 0; 245 | margin-bottom: 0; } 246 | .section-name-container .section-name { 247 | position: relative; 248 | pointer-events: none; 249 | z-index: 1; } 250 | .section-name-container .section-name a { 251 | pointer-events: auto; } 252 | 253 | .item { 254 | padding-top: 8px; 255 | width: 100%; 256 | list-style-type: none; } 257 | .item a[name]:before { 258 | content: ""; 259 | display: block; 260 | padding-top: 70px; 261 | margin: -70px 0 0; } 262 | .item code { 263 | background-color: transparent; 264 | padding: 0; } 265 | .item .token, .item .direct-link { 266 | display: inline-block; 267 | text-indent: -20px; 268 | padding-left: 3px; 269 | margin-left: 35px; 270 | font-size: 11.9px; 271 | transition: all 300ms; } 272 | .item .token-open { 273 | margin-left: 20px; } 274 | .item .discouraged { 275 | text-decoration: line-through; } 276 | .item .declaration-note { 277 | font-size: .85em; 278 | color: gray; 279 | font-style: italic; } 280 | 281 | .pointer-container { 282 | border-bottom: 1px solid #e2e2e2; 283 | left: -23px; 284 | padding-bottom: 13px; 285 | position: relative; 286 | width: 110%; } 287 | 288 | .pointer { 289 | background: #f9f9f9; 290 | border-left: 1px solid #e2e2e2; 291 | border-top: 1px solid #e2e2e2; 292 | height: 12px; 293 | left: 21px; 294 | top: -7px; 295 | -webkit-transform: rotate(45deg); 296 | -moz-transform: rotate(45deg); 297 | -o-transform: rotate(45deg); 298 | transform: rotate(45deg); 299 | position: absolute; 300 | width: 12px; } 301 | 302 | .height-container { 303 | display: none; 304 | left: -25px; 305 | padding: 0 25px; 306 | position: relative; 307 | width: 100%; 308 | overflow: hidden; } 309 | .height-container .section { 310 | background: #f9f9f9; 311 | border-bottom: 1px solid #e2e2e2; 312 | left: -25px; 313 | position: relative; 314 | width: 100%; 315 | padding-top: 10px; 316 | padding-bottom: 5px; } 317 | 318 | .aside, .language { 319 | padding: 6px 12px; 320 | margin: 12px 0; 321 | border-left: 5px solid #dddddd; 322 | overflow-y: hidden; } 323 | .aside .aside-title, .language .aside-title { 324 | font-size: 9px; 325 | letter-spacing: 2px; 326 | text-transform: uppercase; 327 | padding-bottom: 0; 328 | margin: 0; 329 | color: #aaa; 330 | -webkit-user-select: none; } 331 | .aside p:last-child, .language p:last-child { 332 | margin-bottom: 0; } 333 | 334 | .language { 335 | border-left: 5px solid #cde9f4; } 336 | .language .aside-title { 337 | color: #4b8afb; } 338 | 339 | .aside-warning, .aside-deprecated, .aside-unavailable { 340 | border-left: 5px solid #ff6666; } 341 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { 342 | color: #ff0000; } 343 | 344 | .graybox { 345 | border-collapse: collapse; 346 | width: 100%; } 347 | .graybox p { 348 | margin: 0; 349 | word-break: break-word; 350 | min-width: 50px; } 351 | .graybox td { 352 | border: 1px solid #e2e2e2; 353 | padding: 5px 25px 5px 10px; 354 | vertical-align: middle; } 355 | .graybox tr td:first-of-type { 356 | text-align: right; 357 | padding: 7px; 358 | vertical-align: top; 359 | word-break: normal; 360 | width: 40px; } 361 | 362 | .slightly-smaller { 363 | font-size: 0.9em; } 364 | 365 | #footer { 366 | position: relative; 367 | top: 10px; 368 | bottom: 0px; 369 | margin-left: 25px; } 370 | #footer p { 371 | margin: 0; 372 | color: #aaa; 373 | font-size: 0.8em; } 374 | 375 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 376 | display: none; } 377 | 378 | html.dash .main-content { 379 | width: 980px; 380 | margin-left: 0; 381 | border: none; 382 | width: 100%; 383 | top: 0; 384 | padding-bottom: 0; } 385 | 386 | html.dash .height-container { 387 | display: block; } 388 | 389 | html.dash .item .token { 390 | margin-left: 0; } 391 | 392 | html.dash .content-wrapper { 393 | width: auto; } 394 | 395 | html.dash #footer { 396 | position: static; } 397 | 398 | form[role=search] { 399 | float: right; } 400 | form[role=search] input { 401 | font: Helvetica, freesans, Arial, sans-serif; 402 | margin-top: 6px; 403 | font-size: 13px; 404 | line-height: 20px; 405 | padding: 0px 10px; 406 | border: none; 407 | border-radius: 1em; } 408 | .loading form[role=search] input { 409 | background: white url(../img/spinner.gif) center right 4px no-repeat; } 410 | form[role=search] .tt-menu { 411 | margin: 0; 412 | min-width: 300px; 413 | background: #fff; 414 | color: #333; 415 | border: 1px solid #e2e2e2; 416 | z-index: 4; } 417 | form[role=search] .tt-highlight { 418 | font-weight: bold; } 419 | form[role=search] .tt-suggestion { 420 | font: Helvetica, freesans, Arial, sans-serif; 421 | font-size: 14px; 422 | padding: 0 8px; } 423 | form[role=search] .tt-suggestion span { 424 | display: table-cell; 425 | white-space: nowrap; } 426 | form[role=search] .tt-suggestion .doc-parent-name { 427 | width: 100%; 428 | text-align: right; 429 | font-weight: normal; 430 | font-size: 0.9em; 431 | padding-left: 16px; } 432 | form[role=search] .tt-suggestion:hover, 433 | form[role=search] .tt-suggestion.tt-cursor { 434 | cursor: pointer; 435 | background-color: #4183c4; 436 | color: #fff; } 437 | form[role=search] .tt-suggestion:hover .doc-parent-name, 438 | form[role=search] .tt-suggestion.tt-cursor .doc-parent-name { 439 | color: #fff; } 440 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleIdentifier 6 | com.jazzy.netutils 7 | CFBundleName 8 | NetUtils 9 | DocSetPlatformFamily 10 | netutils 11 | isDashDocset 12 | 13 | dashIndexFilePath 14 | index.html 15 | isJavaScriptEnabled 16 | 17 | DashDocSetFamily 18 | dashtoc 19 | 20 | 21 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/Classes.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Classes Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

NetUtils 4.2.1 Docs (95% documented)

21 |

GitHubView on GitHub

22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 | 35 |
36 |
37 | 60 |
61 |
62 |
63 |

Classes

64 |

The following classes are available globally.

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Interface 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 |

    This class represents a network interface in your system. For example, en0 with a certain IP address. 84 | It is a wrapper around the getifaddrs system call.

    85 | 86 |

    Typical use of this class is to first call Interface.allInterfaces() and then use the properties of the interface(s) that you need.

    87 |
    88 |

    See

    89 | /usr/include/ifaddrs.h 90 | 91 |
    92 | 93 | See more 94 |
    95 |
    96 |

    Declaration

    97 |
    98 |

    Swift

    99 |
    open class Interface : CustomStringConvertible, CustomDebugStringConvertible
    100 | 101 |
    102 |
    103 |
    104 | Show on GitHub 105 |
    106 |
    107 |
    108 |
  • 109 |
110 |
111 |
112 |
113 | 117 |
118 |
119 | 120 | 121 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/Classes/Interface/Family.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Family Enumeration Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

NetUtils 4.2.1 Docs (95% documented)

21 |

GitHubView on GitHub

22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 | 35 |
36 |
37 | 60 |
61 |
62 |
63 |

Family

64 |
65 |
66 | 67 |
public enum Family : Int
68 | 69 |
70 |
71 |

The network interface family (IPv4 or IPv6).

72 | 73 |
74 | Show on GitHub 75 |
76 |
77 |
78 |
79 |
    80 |
  • 81 |
    82 | 83 | 84 | 85 | ipv4 86 | 87 |
    88 |
    89 |
    90 |
    91 |
    92 |
    93 |

    IPv4.

    94 | 95 |
    96 |
    97 |

    Declaration

    98 |
    99 |

    Swift

    100 |
    case ipv4
    101 | 102 |
    103 |
    104 |
    105 | Show on GitHub 106 |
    107 |
    108 |
    109 |
  • 110 |
  • 111 |
    112 | 113 | 114 | 115 | ipv6 116 | 117 |
    118 |
    119 |
    120 |
    121 |
    122 |
    123 |

    IPv6.

    124 | 125 |
    126 |
    127 |

    Declaration

    128 |
    129 |

    Swift

    130 |
    case ipv6
    131 | 132 |
    133 |
    134 |
    135 | Show on GitHub 136 |
    137 |
    138 |
    139 |
  • 140 |
  • 141 |
    142 | 143 | 144 | 145 | other 146 | 147 |
    148 |
    149 |
    150 |
    151 |
    152 |
    153 |

    Used in case of errors.

    154 | 155 |
    156 |
    157 |

    Declaration

    158 |
    159 |

    Swift

    160 |
    case other
    161 | 162 |
    163 |
    164 |
    165 | Show on GitHub 166 |
    167 |
    168 |
    169 |
  • 170 |
  • 171 |
    172 | 173 | 174 | 175 | toString() 176 | 177 |
    178 |
    179 |
    180 |
    181 |
    182 |
    183 |

    String representation of the address family.

    184 | 185 |
    186 |
    187 |

    Declaration

    188 |
    189 |

    Swift

    190 |
    public func toString() -> String
    191 | 192 |
    193 |
    194 |
    195 | Show on GitHub 196 |
    197 |
    198 |
    199 |
  • 200 |
201 |
202 |
203 |
204 | 208 |
209 |
210 | 211 | 212 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/Extensions.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Extensions Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 |
20 |

NetUtils 4.2.1 Docs (95% documented)

21 |

GitHubView on GitHub

22 |
23 |
24 | 25 |
26 |
27 |
28 |
29 |
30 | 35 |
36 |
37 | 60 |
61 |
62 |
63 |

Extensions

64 |

The following extensions are available globally.

65 | 66 |
67 |
68 |
69 |
    70 |
  • 71 |
    72 | 73 | 74 | 75 | Interface 76 | 77 |
    78 |
    79 |
    80 |
    81 |
    82 |
    83 | 84 |
    85 |
    86 |
    87 |
  • 88 |
89 |
90 |
91 |
92 | 96 |
97 |
98 | 99 | 100 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/css/highlight.css: -------------------------------------------------------------------------------- 1 | /*! Jazzy - https://github.com/realm/jazzy 2 | * Copyright Realm Inc. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | /* Credit to https://gist.github.com/wataru420/2048287 */ 6 | .highlight .c { 7 | color: #999988; 8 | font-style: italic; } 9 | 10 | .highlight .err { 11 | color: #a61717; 12 | background-color: #e3d2d2; } 13 | 14 | .highlight .k { 15 | color: #000000; 16 | font-weight: bold; } 17 | 18 | .highlight .o { 19 | color: #000000; 20 | font-weight: bold; } 21 | 22 | .highlight .cm { 23 | color: #999988; 24 | font-style: italic; } 25 | 26 | .highlight .cp { 27 | color: #999999; 28 | font-weight: bold; } 29 | 30 | .highlight .c1 { 31 | color: #999988; 32 | font-style: italic; } 33 | 34 | .highlight .cs { 35 | color: #999999; 36 | font-weight: bold; 37 | font-style: italic; } 38 | 39 | .highlight .gd { 40 | color: #000000; 41 | background-color: #ffdddd; } 42 | 43 | .highlight .gd .x { 44 | color: #000000; 45 | background-color: #ffaaaa; } 46 | 47 | .highlight .ge { 48 | color: #000000; 49 | font-style: italic; } 50 | 51 | .highlight .gr { 52 | color: #aa0000; } 53 | 54 | .highlight .gh { 55 | color: #999999; } 56 | 57 | .highlight .gi { 58 | color: #000000; 59 | background-color: #ddffdd; } 60 | 61 | .highlight .gi .x { 62 | color: #000000; 63 | background-color: #aaffaa; } 64 | 65 | .highlight .go { 66 | color: #888888; } 67 | 68 | .highlight .gp { 69 | color: #555555; } 70 | 71 | .highlight .gs { 72 | font-weight: bold; } 73 | 74 | .highlight .gu { 75 | color: #aaaaaa; } 76 | 77 | .highlight .gt { 78 | color: #aa0000; } 79 | 80 | .highlight .kc { 81 | color: #000000; 82 | font-weight: bold; } 83 | 84 | .highlight .kd { 85 | color: #000000; 86 | font-weight: bold; } 87 | 88 | .highlight .kp { 89 | color: #000000; 90 | font-weight: bold; } 91 | 92 | .highlight .kr { 93 | color: #000000; 94 | font-weight: bold; } 95 | 96 | .highlight .kt { 97 | color: #445588; } 98 | 99 | .highlight .m { 100 | color: #009999; } 101 | 102 | .highlight .s { 103 | color: #d14; } 104 | 105 | .highlight .na { 106 | color: #008080; } 107 | 108 | .highlight .nb { 109 | color: #0086B3; } 110 | 111 | .highlight .nc { 112 | color: #445588; 113 | font-weight: bold; } 114 | 115 | .highlight .no { 116 | color: #008080; } 117 | 118 | .highlight .ni { 119 | color: #800080; } 120 | 121 | .highlight .ne { 122 | color: #990000; 123 | font-weight: bold; } 124 | 125 | .highlight .nf { 126 | color: #990000; } 127 | 128 | .highlight .nn { 129 | color: #555555; } 130 | 131 | .highlight .nt { 132 | color: #000080; } 133 | 134 | .highlight .nv { 135 | color: #008080; } 136 | 137 | .highlight .ow { 138 | color: #000000; 139 | font-weight: bold; } 140 | 141 | .highlight .w { 142 | color: #bbbbbb; } 143 | 144 | .highlight .mf { 145 | color: #009999; } 146 | 147 | .highlight .mh { 148 | color: #009999; } 149 | 150 | .highlight .mi { 151 | color: #009999; } 152 | 153 | .highlight .mo { 154 | color: #009999; } 155 | 156 | .highlight .sb { 157 | color: #d14; } 158 | 159 | .highlight .sc { 160 | color: #d14; } 161 | 162 | .highlight .sd { 163 | color: #d14; } 164 | 165 | .highlight .s2 { 166 | color: #d14; } 167 | 168 | .highlight .se { 169 | color: #d14; } 170 | 171 | .highlight .sh { 172 | color: #d14; } 173 | 174 | .highlight .si { 175 | color: #d14; } 176 | 177 | .highlight .sx { 178 | color: #d14; } 179 | 180 | .highlight .sr { 181 | color: #009926; } 182 | 183 | .highlight .s1 { 184 | color: #d14; } 185 | 186 | .highlight .ss { 187 | color: #990073; } 188 | 189 | .highlight .bp { 190 | color: #999999; } 191 | 192 | .highlight .vc { 193 | color: #008080; } 194 | 195 | .highlight .vg { 196 | color: #008080; } 197 | 198 | .highlight .vi { 199 | color: #008080; } 200 | 201 | .highlight .il { 202 | color: #009999; } 203 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/css/jazzy.css: -------------------------------------------------------------------------------- 1 | /*! Jazzy - https://github.com/realm/jazzy 2 | * Copyright Realm Inc. 3 | * SPDX-License-Identifier: MIT 4 | */ 5 | html, body, div, span, h1, h3, h4, p, a, code, em, img, ul, li, table, tbody, tr, td { 6 | background: transparent; 7 | border: 0; 8 | margin: 0; 9 | outline: 0; 10 | padding: 0; 11 | vertical-align: baseline; } 12 | 13 | body { 14 | background-color: #f2f2f2; 15 | font-family: Helvetica, freesans, Arial, sans-serif; 16 | font-size: 14px; 17 | -webkit-font-smoothing: subpixel-antialiased; 18 | word-wrap: break-word; } 19 | 20 | h1, h2, h3 { 21 | margin-top: 0.8em; 22 | margin-bottom: 0.3em; 23 | font-weight: 100; 24 | color: black; } 25 | 26 | h1 { 27 | font-size: 2.5em; } 28 | 29 | h2 { 30 | font-size: 2em; 31 | border-bottom: 1px solid #e2e2e2; } 32 | 33 | h4 { 34 | font-size: 13px; 35 | line-height: 1.5; 36 | margin-top: 21px; } 37 | 38 | h5 { 39 | font-size: 1.1em; } 40 | 41 | h6 { 42 | font-size: 1.1em; 43 | color: #777; } 44 | 45 | .section-name { 46 | color: gray; 47 | display: block; 48 | font-family: Helvetica; 49 | font-size: 22px; 50 | font-weight: 100; 51 | margin-bottom: 15px; } 52 | 53 | pre, code { 54 | font: 0.95em Menlo, monospace; 55 | color: #777; 56 | word-wrap: normal; } 57 | 58 | p code, li code { 59 | background-color: #eee; 60 | padding: 2px 4px; 61 | border-radius: 4px; } 62 | 63 | pre > code { 64 | padding: 0; } 65 | 66 | a { 67 | color: #0088cc; 68 | text-decoration: none; } 69 | a code { 70 | color: inherit; } 71 | 72 | ul { 73 | padding-left: 15px; } 74 | 75 | li { 76 | line-height: 1.8em; } 77 | 78 | img { 79 | max-width: 100%; } 80 | 81 | blockquote { 82 | margin-left: 0; 83 | padding: 0 10px; 84 | border-left: 4px solid #ccc; } 85 | 86 | hr { 87 | height: 1px; 88 | border: none; 89 | background-color: #e2e2e2; } 90 | 91 | .footnote-ref { 92 | display: inline-block; 93 | scroll-margin-top: 70px; } 94 | 95 | .footnote-def { 96 | scroll-margin-top: 70px; } 97 | 98 | .content-wrapper { 99 | margin: 0 auto; 100 | width: 980px; } 101 | 102 | header { 103 | font-size: 0.85em; 104 | line-height: 32px; 105 | background-color: #414141; 106 | position: fixed; 107 | width: 100%; 108 | z-index: 3; } 109 | header img { 110 | padding-right: 6px; 111 | vertical-align: -3px; 112 | height: 16px; } 113 | header a { 114 | color: #fff; } 115 | header p { 116 | float: left; 117 | color: #999; } 118 | header .header-right { 119 | float: right; 120 | margin-left: 16px; } 121 | 122 | #breadcrumbs { 123 | background-color: #f2f2f2; 124 | height: 21px; 125 | padding-top: 17px; 126 | position: fixed; 127 | width: 100%; 128 | z-index: 2; 129 | margin-top: 32px; } 130 | #breadcrumbs #carat { 131 | height: 10px; 132 | margin: 0 5px; } 133 | 134 | .sidebar { 135 | background-color: #f9f9f9; 136 | border: 1px solid #e2e2e2; 137 | overflow-y: auto; 138 | overflow-x: hidden; 139 | position: fixed; 140 | top: 70px; 141 | bottom: 0; 142 | width: 230px; 143 | word-wrap: normal; } 144 | 145 | .nav-groups { 146 | list-style-type: none; 147 | background: #fff; 148 | padding-left: 0; } 149 | 150 | .nav-group-name { 151 | border-bottom: 1px solid #e2e2e2; 152 | font-size: 1.1em; 153 | font-weight: 100; 154 | padding: 15px 0 15px 20px; } 155 | .nav-group-name > a { 156 | color: #333; } 157 | 158 | .nav-group-tasks { 159 | margin-top: 5px; } 160 | 161 | .nav-group-task { 162 | font-size: 0.9em; 163 | list-style-type: none; 164 | white-space: nowrap; } 165 | .nav-group-task a { 166 | color: #888; } 167 | 168 | .main-content { 169 | background-color: #fff; 170 | border: 1px solid #e2e2e2; 171 | margin-left: 246px; 172 | position: absolute; 173 | overflow: hidden; 174 | padding-bottom: 20px; 175 | top: 70px; 176 | width: 734px; } 177 | .main-content p, .main-content a, .main-content code, .main-content em, .main-content ul, .main-content table, .main-content blockquote { 178 | margin-bottom: 1em; } 179 | .main-content p { 180 | line-height: 1.8em; } 181 | .main-content section .section:first-child { 182 | margin-top: 0; 183 | padding-top: 0; } 184 | .main-content section .task-group-section .task-group:first-of-type { 185 | padding-top: 10px; } 186 | .main-content section .task-group-section .task-group:first-of-type .section-name { 187 | padding-top: 15px; } 188 | .main-content section .heading:before { 189 | content: ""; 190 | display: block; 191 | padding-top: 70px; 192 | margin: -70px 0 0; } 193 | .main-content .section-name p { 194 | margin-bottom: inherit; 195 | line-height: inherit; } 196 | .main-content .section-name code { 197 | background-color: inherit; 198 | padding: inherit; 199 | color: inherit; } 200 | 201 | .section { 202 | padding: 0 25px; } 203 | 204 | .highlight { 205 | background-color: #eee; 206 | padding: 10px 12px; 207 | border: 1px solid #e2e2e2; 208 | border-radius: 4px; 209 | overflow-x: auto; } 210 | 211 | .declaration .highlight { 212 | overflow-x: initial; 213 | padding: 0 40px 40px 0; 214 | margin-bottom: -25px; 215 | background-color: transparent; 216 | border: none; } 217 | 218 | .section-name { 219 | margin: 0; 220 | margin-left: 18px; } 221 | 222 | .task-group-section { 223 | margin-top: 10px; 224 | padding-left: 6px; 225 | border-top: 1px solid #e2e2e2; } 226 | 227 | .task-group { 228 | padding-top: 0px; } 229 | 230 | .task-name-container a[name]:before { 231 | content: ""; 232 | display: block; 233 | padding-top: 70px; 234 | margin: -70px 0 0; } 235 | 236 | .section-name-container { 237 | position: relative; 238 | display: inline-block; } 239 | .section-name-container .section-name-link { 240 | position: absolute; 241 | top: 0; 242 | left: 0; 243 | bottom: 0; 244 | right: 0; 245 | margin-bottom: 0; } 246 | .section-name-container .section-name { 247 | position: relative; 248 | pointer-events: none; 249 | z-index: 1; } 250 | .section-name-container .section-name a { 251 | pointer-events: auto; } 252 | 253 | .item { 254 | padding-top: 8px; 255 | width: 100%; 256 | list-style-type: none; } 257 | .item a[name]:before { 258 | content: ""; 259 | display: block; 260 | padding-top: 70px; 261 | margin: -70px 0 0; } 262 | .item code { 263 | background-color: transparent; 264 | padding: 0; } 265 | .item .token, .item .direct-link { 266 | display: inline-block; 267 | text-indent: -20px; 268 | padding-left: 3px; 269 | margin-left: 35px; 270 | font-size: 11.9px; 271 | transition: all 300ms; } 272 | .item .token-open { 273 | margin-left: 20px; } 274 | .item .discouraged { 275 | text-decoration: line-through; } 276 | .item .declaration-note { 277 | font-size: .85em; 278 | color: gray; 279 | font-style: italic; } 280 | 281 | .pointer-container { 282 | border-bottom: 1px solid #e2e2e2; 283 | left: -23px; 284 | padding-bottom: 13px; 285 | position: relative; 286 | width: 110%; } 287 | 288 | .pointer { 289 | background: #f9f9f9; 290 | border-left: 1px solid #e2e2e2; 291 | border-top: 1px solid #e2e2e2; 292 | height: 12px; 293 | left: 21px; 294 | top: -7px; 295 | -webkit-transform: rotate(45deg); 296 | -moz-transform: rotate(45deg); 297 | -o-transform: rotate(45deg); 298 | transform: rotate(45deg); 299 | position: absolute; 300 | width: 12px; } 301 | 302 | .height-container { 303 | display: none; 304 | left: -25px; 305 | padding: 0 25px; 306 | position: relative; 307 | width: 100%; 308 | overflow: hidden; } 309 | .height-container .section { 310 | background: #f9f9f9; 311 | border-bottom: 1px solid #e2e2e2; 312 | left: -25px; 313 | position: relative; 314 | width: 100%; 315 | padding-top: 10px; 316 | padding-bottom: 5px; } 317 | 318 | .aside, .language { 319 | padding: 6px 12px; 320 | margin: 12px 0; 321 | border-left: 5px solid #dddddd; 322 | overflow-y: hidden; } 323 | .aside .aside-title, .language .aside-title { 324 | font-size: 9px; 325 | letter-spacing: 2px; 326 | text-transform: uppercase; 327 | padding-bottom: 0; 328 | margin: 0; 329 | color: #aaa; 330 | -webkit-user-select: none; } 331 | .aside p:last-child, .language p:last-child { 332 | margin-bottom: 0; } 333 | 334 | .language { 335 | border-left: 5px solid #cde9f4; } 336 | .language .aside-title { 337 | color: #4b8afb; } 338 | 339 | .aside-warning, .aside-deprecated, .aside-unavailable { 340 | border-left: 5px solid #ff6666; } 341 | .aside-warning .aside-title, .aside-deprecated .aside-title, .aside-unavailable .aside-title { 342 | color: #ff0000; } 343 | 344 | .graybox { 345 | border-collapse: collapse; 346 | width: 100%; } 347 | .graybox p { 348 | margin: 0; 349 | word-break: break-word; 350 | min-width: 50px; } 351 | .graybox td { 352 | border: 1px solid #e2e2e2; 353 | padding: 5px 25px 5px 10px; 354 | vertical-align: middle; } 355 | .graybox tr td:first-of-type { 356 | text-align: right; 357 | padding: 7px; 358 | vertical-align: top; 359 | word-break: normal; 360 | width: 40px; } 361 | 362 | .slightly-smaller { 363 | font-size: 0.9em; } 364 | 365 | #footer { 366 | position: relative; 367 | top: 10px; 368 | bottom: 0px; 369 | margin-left: 25px; } 370 | #footer p { 371 | margin: 0; 372 | color: #aaa; 373 | font-size: 0.8em; } 374 | 375 | html.dash header, html.dash #breadcrumbs, html.dash .sidebar { 376 | display: none; } 377 | 378 | html.dash .main-content { 379 | width: 980px; 380 | margin-left: 0; 381 | border: none; 382 | width: 100%; 383 | top: 0; 384 | padding-bottom: 0; } 385 | 386 | html.dash .height-container { 387 | display: block; } 388 | 389 | html.dash .item .token { 390 | margin-left: 0; } 391 | 392 | html.dash .content-wrapper { 393 | width: auto; } 394 | 395 | html.dash #footer { 396 | position: static; } 397 | 398 | form[role=search] { 399 | float: right; } 400 | form[role=search] input { 401 | font: Helvetica, freesans, Arial, sans-serif; 402 | margin-top: 6px; 403 | font-size: 13px; 404 | line-height: 20px; 405 | padding: 0px 10px; 406 | border: none; 407 | border-radius: 1em; } 408 | .loading form[role=search] input { 409 | background: white url(../img/spinner.gif) center right 4px no-repeat; } 410 | form[role=search] .tt-menu { 411 | margin: 0; 412 | min-width: 300px; 413 | background: #fff; 414 | color: #333; 415 | border: 1px solid #e2e2e2; 416 | z-index: 4; } 417 | form[role=search] .tt-highlight { 418 | font-weight: bold; } 419 | form[role=search] .tt-suggestion { 420 | font: Helvetica, freesans, Arial, sans-serif; 421 | font-size: 14px; 422 | padding: 0 8px; } 423 | form[role=search] .tt-suggestion span { 424 | display: table-cell; 425 | white-space: nowrap; } 426 | form[role=search] .tt-suggestion .doc-parent-name { 427 | width: 100%; 428 | text-align: right; 429 | font-weight: normal; 430 | font-size: 0.9em; 431 | padding-left: 16px; } 432 | form[role=search] .tt-suggestion:hover, 433 | form[role=search] .tt-suggestion.tt-cursor { 434 | cursor: pointer; 435 | background-color: #4183c4; 436 | color: #fff; } 437 | form[role=search] .tt-suggestion:hover .doc-parent-name, 438 | form[role=search] .tt-suggestion.tt-cursor .doc-parent-name { 439 | color: #fff; } 440 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/carat.png -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/dash.png -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/gh.png -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/docsets/NetUtils.docset/Contents/Resources/Documents/img/spinner.gif -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NetUtils Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 |

NetUtils 4.2.1 Docs (95% documented)

20 |

GitHubView on GitHub

21 |
22 |
23 | 24 |
25 |
26 |
27 |
28 |
29 | 34 |
35 |
36 | 59 |
60 |
61 |
62 | 63 |

NetUtils for Swift

64 | 65 |

Swift Version 3 66 | Swift Version 4 67 | CocoaPods Version Badge 68 | License Badge 69 | Supported Platforms 70 | Percentage Documented Badge 71 | Carthage compatible 72 | Swift Package Manager compatible 73 | Join the chat at https://gitter.im/NetUtils-for-Swift/Lobby

74 | 75 |

Swift library that simplifies getting information about your network interfaces 76 | and their properties, both for iOS, macOS and Linux. This library is a wrapper 77 | around the BSD APIs like getifaddrs, to make it easy to use them from Swift.

78 | 79 |

Recommended way of integrating this library on macOS or iOS is using CocoaPods: 80 | https://cocoapods.org/pods/NetUtils. On Linux I recommend using the Swift 81 | Package Manager.

82 | 83 |

This library works with both Swift 5 and Swift 5.

84 |

Background Info

85 | 86 |

Some system APIs you can simply use from Swift, but others you cannot. The 87 | difference is that some are made available as a module, and some are not. The 88 | APIs around network interfaces are not exposed as a module, which means that you 89 | cannot use them from Swift without defining a module for them yourself. I 90 | documented this problem extensively in a blog post.

91 |

Installation

92 | 93 |

This library can be installed via CocoaPods, Carthage and Swift Package Manager.

94 |

Usage

95 | 96 |

This module contains only one class: Interface. This class represents a 97 | network interface. It has a static method to list all interfaces, somewhat 98 | surprisingly called allInterfaces(). This will return an array of Interface 99 | objects, which contain properties like their IP address, family, whether they 100 | are up and running, etc.

101 | 102 |

Please note that both IPv4 and IPv6 interfaces are supported.

103 |

License

104 | 105 |

This project is released under the MIT license.

106 | 107 |
108 |
109 | 113 |
114 |
115 | 116 | 117 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/js/jazzy.js: -------------------------------------------------------------------------------- 1 | // Jazzy - https://github.com/realm/jazzy 2 | // Copyright Realm Inc. 3 | // SPDX-License-Identifier: MIT 4 | 5 | window.jazzy = {'docset': false} 6 | if (typeof window.dash != 'undefined') { 7 | document.documentElement.className += ' dash' 8 | window.jazzy.docset = true 9 | } 10 | if (navigator.userAgent.match(/xcode/i)) { 11 | document.documentElement.className += ' xcode' 12 | window.jazzy.docset = true 13 | } 14 | 15 | function toggleItem($link, $content) { 16 | var animationDuration = 300; 17 | $link.toggleClass('token-open'); 18 | $content.slideToggle(animationDuration); 19 | } 20 | 21 | function itemLinkToContent($link) { 22 | return $link.parent().parent().next(); 23 | } 24 | 25 | // On doc load + hash-change, open any targetted item 26 | function openCurrentItemIfClosed() { 27 | if (window.jazzy.docset) { 28 | return; 29 | } 30 | var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token'); 31 | $content = itemLinkToContent($link); 32 | if ($content.is(':hidden')) { 33 | toggleItem($link, $content); 34 | } 35 | } 36 | 37 | $(openCurrentItemIfClosed); 38 | $(window).on('hashchange', openCurrentItemIfClosed); 39 | 40 | // On item link ('token') click, toggle its discussion 41 | $('.token').on('click', function(event) { 42 | if (window.jazzy.docset) { 43 | return; 44 | } 45 | var $link = $(this); 46 | toggleItem($link, itemLinkToContent($link)); 47 | 48 | // Keeps the document from jumping to the hash. 49 | var href = $link.attr('href'); 50 | if (history.pushState) { 51 | history.pushState({}, '', href); 52 | } else { 53 | location.hash = href; 54 | } 55 | event.preventDefault(); 56 | }); 57 | 58 | // Clicks on links to the current, closed, item need to open the item 59 | $("a:not('.token')").on('click', function() { 60 | if (location == this.href) { 61 | openCurrentItemIfClosed(); 62 | } 63 | }); 64 | 65 | // KaTeX rendering 66 | if ("katex" in window) { 67 | $($('.math').each( (_, element) => { 68 | katex.render(element.textContent, element, { 69 | displayMode: $(element).hasClass('m-block'), 70 | throwOnError: false, 71 | trust: true 72 | }); 73 | })) 74 | } 75 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/js/jazzy.search.js: -------------------------------------------------------------------------------- 1 | // Jazzy - https://github.com/realm/jazzy 2 | // Copyright Realm Inc. 3 | // SPDX-License-Identifier: MIT 4 | 5 | $(function(){ 6 | var $typeahead = $('[data-typeahead]'); 7 | var $form = $typeahead.parents('form'); 8 | var searchURL = $form.attr('action'); 9 | 10 | function displayTemplate(result) { 11 | return result.name; 12 | } 13 | 14 | function suggestionTemplate(result) { 15 | var t = '
'; 16 | t += '' + result.name + ''; 17 | if (result.parent_name) { 18 | t += '' + result.parent_name + ''; 19 | } 20 | t += '
'; 21 | return t; 22 | } 23 | 24 | $typeahead.one('focus', function() { 25 | $form.addClass('loading'); 26 | 27 | $.getJSON(searchURL).then(function(searchData) { 28 | const searchIndex = lunr(function() { 29 | this.ref('url'); 30 | this.field('name'); 31 | this.field('abstract'); 32 | for (const [url, doc] of Object.entries(searchData)) { 33 | this.add({url: url, name: doc.name, abstract: doc.abstract}); 34 | } 35 | }); 36 | 37 | $typeahead.typeahead( 38 | { 39 | highlight: true, 40 | minLength: 3, 41 | autoselect: true 42 | }, 43 | { 44 | limit: 10, 45 | display: displayTemplate, 46 | templates: { suggestion: suggestionTemplate }, 47 | source: function(query, sync) { 48 | const lcSearch = query.toLowerCase(); 49 | const results = searchIndex.query(function(q) { 50 | q.term(lcSearch, { boost: 100 }); 51 | q.term(lcSearch, { 52 | boost: 10, 53 | wildcard: lunr.Query.wildcard.TRAILING 54 | }); 55 | }).map(function(result) { 56 | var doc = searchData[result.ref]; 57 | doc.url = result.ref; 58 | return doc; 59 | }); 60 | sync(results); 61 | } 62 | } 63 | ); 64 | $form.removeClass('loading'); 65 | $typeahead.trigger('focus'); 66 | }); 67 | }); 68 | 69 | var baseURL = searchURL.slice(0, -"search.json".length); 70 | 71 | $typeahead.on('typeahead:select', function(e, result) { 72 | window.location = baseURL + result.url; 73 | }); 74 | }); 75 | -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/Documents/search.json: -------------------------------------------------------------------------------- 1 | {"Extensions.html#/Interface":{"name":"Interface"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO4ipv4yA2EmF":{"name":"ipv4","abstract":"

IPv4.

","parent_name":"Family"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO4ipv6yA2EmF":{"name":"ipv6","abstract":"

IPv6.

","parent_name":"Family"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO5otheryA2EmF":{"name":"other","abstract":"

Used in case of errors.

","parent_name":"Family"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO8toStringSSyF":{"name":"toString()","abstract":"

String representation of the address family.

","parent_name":"Family"},"Classes/Interface.html#/s:8NetUtils9InterfaceC2id10Foundation4UUIDVvp":{"name":"id","abstract":"

Undocumented

","parent_name":"Interface"},"Classes/Interface/Family.html":{"name":"Family","abstract":"

The network interface family (IPv4 or IPv6).

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC13allInterfacesSayACGyFZ":{"name":"allInterfaces()","abstract":"

Returns all network interfaces in your system. If you have an interface name (e.g. en0) that has","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC15createTestDummy_6family7address18multicastSupported16broadcastAddressACSS_AC6FamilyOSSSbSSSgtFZ":{"name":"createTestDummy(_:family:address:multicastSupported:broadcastAddress:)","abstract":"

Returns a new Interface instance that does not represent a real network interface, but can be used for (unit) testing.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC4name6family7address7netmask7running2up8loopback18multicastSupported16broadcastAddressACSS_AC6FamilyOSSSgAOS4bAOtcfc":{"name":"init(name:family:address:netmask:running:up:loopback:multicastSupported:broadcastAddress:)","abstract":"

Initialize a new Interface with the given properties.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC12addressBytesSays5UInt8VGSgvp":{"name":"addressBytes","abstract":"

Creates the network format representation of the interface’s IP address. Wraps inet_pton.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC9isRunningSbvp":{"name":"isRunning","abstract":"

IFF_RUNNING flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC4isUpSbvp":{"name":"isUp","abstract":"

IFF_UP flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC10isLoopbackSbvp":{"name":"isLoopback","abstract":"

IFF_LOOPBACK flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC17supportsMulticastSbvp":{"name":"supportsMulticast","abstract":"

IFF_MULTICAST flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC4nameSSvp":{"name":"name","abstract":"

Field ifaddrs->ifa_name.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC6familyAC6FamilyOvp":{"name":"family","abstract":"

Field ifaddrs->ifa_addr->sa_family.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC7addressSSSgvp":{"name":"address","abstract":"

Extracted from ifaddrs->ifa_addr, supports both IPv4 and IPv6.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC7netmaskSSSgvp":{"name":"netmask","abstract":"

Extracted from ifaddrs->ifa_netmask, supports both IPv4 and IPv6.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC16broadcastAddressSSSgvp":{"name":"broadcastAddress","abstract":"

Extracted from ifaddrs->ifa_dstaddr. Not applicable for IPv6.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC11descriptionSSvp":{"name":"description","abstract":"

Returns the interface name.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC16debugDescriptionSSvp":{"name":"debugDescription","abstract":"

Returns a string containing a few properties of the Interface.

","parent_name":"Interface"},"Classes/Interface.html":{"name":"Interface","abstract":"

This class represents a network interface in your system. For example, en0 with a certain IP address."},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Extensions.html":{"name":"Extensions","abstract":"

The following extensions are available globally.

"}} -------------------------------------------------------------------------------- /docs/docsets/NetUtils.docset/Contents/Resources/docSet.dsidx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/docsets/NetUtils.docset/Contents/Resources/docSet.dsidx -------------------------------------------------------------------------------- /docs/docsets/NetUtils.tgz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/docsets/NetUtils.tgz -------------------------------------------------------------------------------- /docs/img/carat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/img/carat.png -------------------------------------------------------------------------------- /docs/img/dash.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/img/dash.png -------------------------------------------------------------------------------- /docs/img/gh.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/img/gh.png -------------------------------------------------------------------------------- /docs/img/spinner.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/svdo/swift-netutils/57aad60905759cc542886874e39addced4584271/docs/img/spinner.gif -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | NetUtils Reference 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 |
19 |

NetUtils 4.2.1 Docs (95% documented)

20 |

GitHubView on GitHub

21 |
22 |
23 | 24 |
25 |
26 |
27 |
28 |
29 | 34 |
35 |
36 | 59 |
60 |
61 |
62 | 63 |

NetUtils for Swift

64 | 65 |

Swift Version 3 66 | Swift Version 4 67 | CocoaPods Version Badge 68 | License Badge 69 | Supported Platforms 70 | Percentage Documented Badge 71 | Carthage compatible 72 | Swift Package Manager compatible 73 | Join the chat at https://gitter.im/NetUtils-for-Swift/Lobby

74 | 75 |

Swift library that simplifies getting information about your network interfaces 76 | and their properties, both for iOS, macOS and Linux. This library is a wrapper 77 | around the BSD APIs like getifaddrs, to make it easy to use them from Swift.

78 | 79 |

Recommended way of integrating this library on macOS or iOS is using CocoaPods: 80 | https://cocoapods.org/pods/NetUtils. On Linux I recommend using the Swift 81 | Package Manager.

82 | 83 |

This library works with both Swift 5 and Swift 5.

84 |

Background Info

85 | 86 |

Some system APIs you can simply use from Swift, but others you cannot. The 87 | difference is that some are made available as a module, and some are not. The 88 | APIs around network interfaces are not exposed as a module, which means that you 89 | cannot use them from Swift without defining a module for them yourself. I 90 | documented this problem extensively in a blog post.

91 |

Installation

92 | 93 |

This library can be installed via CocoaPods, Carthage and Swift Package Manager.

94 |

Usage

95 | 96 |

This module contains only one class: Interface. This class represents a 97 | network interface. It has a static method to list all interfaces, somewhat 98 | surprisingly called allInterfaces(). This will return an array of Interface 99 | objects, which contain properties like their IP address, family, whether they 100 | are up and running, etc.

101 | 102 |

Please note that both IPv4 and IPv6 interfaces are supported.

103 |

License

104 | 105 |

This project is released under the MIT license.

106 | 107 |
108 |
109 | 113 |
114 |
115 | 116 | 117 | -------------------------------------------------------------------------------- /docs/js/jazzy.js: -------------------------------------------------------------------------------- 1 | // Jazzy - https://github.com/realm/jazzy 2 | // Copyright Realm Inc. 3 | // SPDX-License-Identifier: MIT 4 | 5 | window.jazzy = {'docset': false} 6 | if (typeof window.dash != 'undefined') { 7 | document.documentElement.className += ' dash' 8 | window.jazzy.docset = true 9 | } 10 | if (navigator.userAgent.match(/xcode/i)) { 11 | document.documentElement.className += ' xcode' 12 | window.jazzy.docset = true 13 | } 14 | 15 | function toggleItem($link, $content) { 16 | var animationDuration = 300; 17 | $link.toggleClass('token-open'); 18 | $content.slideToggle(animationDuration); 19 | } 20 | 21 | function itemLinkToContent($link) { 22 | return $link.parent().parent().next(); 23 | } 24 | 25 | // On doc load + hash-change, open any targetted item 26 | function openCurrentItemIfClosed() { 27 | if (window.jazzy.docset) { 28 | return; 29 | } 30 | var $link = $(`a[name="${location.hash.substring(1)}"]`).nextAll('.token'); 31 | $content = itemLinkToContent($link); 32 | if ($content.is(':hidden')) { 33 | toggleItem($link, $content); 34 | } 35 | } 36 | 37 | $(openCurrentItemIfClosed); 38 | $(window).on('hashchange', openCurrentItemIfClosed); 39 | 40 | // On item link ('token') click, toggle its discussion 41 | $('.token').on('click', function(event) { 42 | if (window.jazzy.docset) { 43 | return; 44 | } 45 | var $link = $(this); 46 | toggleItem($link, itemLinkToContent($link)); 47 | 48 | // Keeps the document from jumping to the hash. 49 | var href = $link.attr('href'); 50 | if (history.pushState) { 51 | history.pushState({}, '', href); 52 | } else { 53 | location.hash = href; 54 | } 55 | event.preventDefault(); 56 | }); 57 | 58 | // Clicks on links to the current, closed, item need to open the item 59 | $("a:not('.token')").on('click', function() { 60 | if (location == this.href) { 61 | openCurrentItemIfClosed(); 62 | } 63 | }); 64 | 65 | // KaTeX rendering 66 | if ("katex" in window) { 67 | $($('.math').each( (_, element) => { 68 | katex.render(element.textContent, element, { 69 | displayMode: $(element).hasClass('m-block'), 70 | throwOnError: false, 71 | trust: true 72 | }); 73 | })) 74 | } 75 | -------------------------------------------------------------------------------- /docs/js/jazzy.search.js: -------------------------------------------------------------------------------- 1 | // Jazzy - https://github.com/realm/jazzy 2 | // Copyright Realm Inc. 3 | // SPDX-License-Identifier: MIT 4 | 5 | $(function(){ 6 | var $typeahead = $('[data-typeahead]'); 7 | var $form = $typeahead.parents('form'); 8 | var searchURL = $form.attr('action'); 9 | 10 | function displayTemplate(result) { 11 | return result.name; 12 | } 13 | 14 | function suggestionTemplate(result) { 15 | var t = '
'; 16 | t += '' + result.name + ''; 17 | if (result.parent_name) { 18 | t += '' + result.parent_name + ''; 19 | } 20 | t += '
'; 21 | return t; 22 | } 23 | 24 | $typeahead.one('focus', function() { 25 | $form.addClass('loading'); 26 | 27 | $.getJSON(searchURL).then(function(searchData) { 28 | const searchIndex = lunr(function() { 29 | this.ref('url'); 30 | this.field('name'); 31 | this.field('abstract'); 32 | for (const [url, doc] of Object.entries(searchData)) { 33 | this.add({url: url, name: doc.name, abstract: doc.abstract}); 34 | } 35 | }); 36 | 37 | $typeahead.typeahead( 38 | { 39 | highlight: true, 40 | minLength: 3, 41 | autoselect: true 42 | }, 43 | { 44 | limit: 10, 45 | display: displayTemplate, 46 | templates: { suggestion: suggestionTemplate }, 47 | source: function(query, sync) { 48 | const lcSearch = query.toLowerCase(); 49 | const results = searchIndex.query(function(q) { 50 | q.term(lcSearch, { boost: 100 }); 51 | q.term(lcSearch, { 52 | boost: 10, 53 | wildcard: lunr.Query.wildcard.TRAILING 54 | }); 55 | }).map(function(result) { 56 | var doc = searchData[result.ref]; 57 | doc.url = result.ref; 58 | return doc; 59 | }); 60 | sync(results); 61 | } 62 | } 63 | ); 64 | $form.removeClass('loading'); 65 | $typeahead.trigger('focus'); 66 | }); 67 | }); 68 | 69 | var baseURL = searchURL.slice(0, -"search.json".length); 70 | 71 | $typeahead.on('typeahead:select', function(e, result) { 72 | window.location = baseURL + result.url; 73 | }); 74 | }); 75 | -------------------------------------------------------------------------------- /docs/search.json: -------------------------------------------------------------------------------- 1 | {"Extensions.html#/Interface":{"name":"Interface"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO4ipv4yA2EmF":{"name":"ipv4","abstract":"

IPv4.

","parent_name":"Family"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO4ipv6yA2EmF":{"name":"ipv6","abstract":"

IPv6.

","parent_name":"Family"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO5otheryA2EmF":{"name":"other","abstract":"

Used in case of errors.

","parent_name":"Family"},"Classes/Interface/Family.html#/s:8NetUtils9InterfaceC6FamilyO8toStringSSyF":{"name":"toString()","abstract":"

String representation of the address family.

","parent_name":"Family"},"Classes/Interface.html#/s:8NetUtils9InterfaceC2id10Foundation4UUIDVvp":{"name":"id","abstract":"

Undocumented

","parent_name":"Interface"},"Classes/Interface/Family.html":{"name":"Family","abstract":"

The network interface family (IPv4 or IPv6).

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC13allInterfacesSayACGyFZ":{"name":"allInterfaces()","abstract":"

Returns all network interfaces in your system. If you have an interface name (e.g. en0) that has","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC15createTestDummy_6family7address18multicastSupported16broadcastAddressACSS_AC6FamilyOSSSbSSSgtFZ":{"name":"createTestDummy(_:family:address:multicastSupported:broadcastAddress:)","abstract":"

Returns a new Interface instance that does not represent a real network interface, but can be used for (unit) testing.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC4name6family7address7netmask7running2up8loopback18multicastSupported16broadcastAddressACSS_AC6FamilyOSSSgAOS4bAOtcfc":{"name":"init(name:family:address:netmask:running:up:loopback:multicastSupported:broadcastAddress:)","abstract":"

Initialize a new Interface with the given properties.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC12addressBytesSays5UInt8VGSgvp":{"name":"addressBytes","abstract":"

Creates the network format representation of the interface’s IP address. Wraps inet_pton.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC9isRunningSbvp":{"name":"isRunning","abstract":"

IFF_RUNNING flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC4isUpSbvp":{"name":"isUp","abstract":"

IFF_UP flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC10isLoopbackSbvp":{"name":"isLoopback","abstract":"

IFF_LOOPBACK flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC17supportsMulticastSbvp":{"name":"supportsMulticast","abstract":"

IFF_MULTICAST flag of ifaddrs->ifa_flags.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC4nameSSvp":{"name":"name","abstract":"

Field ifaddrs->ifa_name.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC6familyAC6FamilyOvp":{"name":"family","abstract":"

Field ifaddrs->ifa_addr->sa_family.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC7addressSSSgvp":{"name":"address","abstract":"

Extracted from ifaddrs->ifa_addr, supports both IPv4 and IPv6.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC7netmaskSSSgvp":{"name":"netmask","abstract":"

Extracted from ifaddrs->ifa_netmask, supports both IPv4 and IPv6.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC16broadcastAddressSSSgvp":{"name":"broadcastAddress","abstract":"

Extracted from ifaddrs->ifa_dstaddr. Not applicable for IPv6.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC11descriptionSSvp":{"name":"description","abstract":"

Returns the interface name.

","parent_name":"Interface"},"Classes/Interface.html#/s:8NetUtils9InterfaceC16debugDescriptionSSvp":{"name":"debugDescription","abstract":"

Returns a string containing a few properties of the Interface.

","parent_name":"Interface"},"Classes/Interface.html":{"name":"Interface","abstract":"

This class represents a network interface in your system. For example, en0 with a certain IP address."},"Classes.html":{"name":"Classes","abstract":"

The following classes are available globally.

"},"Extensions.html":{"name":"Extensions","abstract":"

The following extensions are available globally.

"}} -------------------------------------------------------------------------------- /docs/undocumented.json: -------------------------------------------------------------------------------- 1 | { 2 | "warnings": [ 3 | { 4 | "file": "/Users/stefan/Documents/Projects/iPhoneProjects/swift-netutils/NetUtils/Interface.swift", 5 | "line": 35, 6 | "symbol": "Interface.id", 7 | "symbol_kind": "source.lang.swift.decl.var.instance", 8 | "warning": "undocumented" 9 | } 10 | ], 11 | "source_directory": "/Users/stefan/Documents/Projects/iPhoneProjects/swift-netutils" 12 | } -------------------------------------------------------------------------------- /ifaddrs/injectXcodePath.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | set -x 4 | 5 | defaultXcodePath="/Applications/Xcode.app/Contents/Developer" 6 | realXcodePath="`xcode-select -p`" 7 | 8 | fatal() { 9 | echo "[fatal] $1" 1>&2 10 | exit 1 11 | } 12 | 13 | absPath() { 14 | case "$1" in 15 | /*) 16 | printf "%s\n" "$1" 17 | ;; 18 | *) 19 | printf "%s\n" "$PWD/$1" 20 | ;; 21 | esac; 22 | } 23 | 24 | scriptDir="`dirname $0`" 25 | scriptName="`basename $0`" 26 | absScriptDir="`cd $scriptDir; pwd`" 27 | 28 | main() { 29 | xcodeMajor=$(xcrun xcodebuild -version|grep -E "Xcode \d+\.\d+(\.\d+)?"|cut -d ' ' -f 2|cut -d '.' -f 1) 30 | set -i xcodeMajor 31 | if [ ${xcodeMajor} -lt 9 ]; then 32 | echo "Xcode prior to 9: ifaddrs module maps needed." 33 | for f in `find ${absScriptDir} -name module.modulemap`; do 34 | cat ${f} | sed "s,${defaultXcodePath},${realXcodePath},g" > ${f}.new || fatal "Failed to update modulemap ${f}" 35 | mv ${f}.new ${f} || fatal "Failed to replace modulemap ${f}" 36 | done 37 | else 38 | echo "Xcode 9 and above: ifaddrs module maps not needed." 39 | cd $(dirname $0) 40 | rm -f */module.modulemap 41 | fi 42 | 43 | } 44 | 45 | main $* 46 | --------------------------------------------------------------------------------