Swiftpack.co - svdo/swift-netutils as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Swift library that simplifies getting information about your network interfaces and their properties, both for iOS and OS X.
.package(url: "https://github.com/svdo/swift-netutils.git", from: "4.2.0")

NetUtils for Swift

Swift Version 3 Swift Version 4 CocoaPods Version Badge License Badge Supported Platforms Percentage Documented Badge Carthage compatible Swift Package Manager compatible Build Status Join the chat at https://gitter.im/NetUtils-for-Swift/Lobby

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

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

This library works with both Swift 5 and Swift 5.

Background Info

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


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


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

Please note that both IPv4 and IPv6 interfaces are supported.


This project is released under the MIT license.


Stars: 91
Last commit: 47 weeks ago

Ad: Job Offers

iOS Software Engineer @ Perry Street Software
Perry Street Software is Jack’d and SCRUFF. We are two of the world’s largest gay, bi, trans and queer social dating apps on iOS and Android. Our brands reach more than 20 million members worldwide so members can connect, meet and express themselves on a platform that prioritizes privacy and security. We invest heavily into SwiftUI and using Swift Packages to modularize the codebase.

Submit a free job ad (while I'm testing this). The analytics numbers for this website are here.

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics