Coder Social home page Coder Social logo

stefanrenne / swift-netutils Goto Github PK

View Code? Open in Web Editor NEW

This project forked from svdo/swift-netutils

1.0 2.0 0.0 392 KB

Swift library that simplifies getting information about your network interfaces and their properties, both for iOS and OS X.

License: MIT License

Swift 82.81% Objective-C 2.68% Shell 12.89% Ruby 1.61%

swift-netutils's Introduction

NetUtils for Swift

Swift Version 3 Swift Version 4 CocoaPods Version Badge License Badge Supported Platforms Badge Percentage Documented Badge Carthage compatible Swift Package Manager compatible Build Status

Swift library that simplifies getting information about your network interfaces and their properties, both for iOS and OS X. 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 is using CocoaPods: https://cocoapods.org/pods/NetUtils.

This library works with both Swift 3 and Swift 4.

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 over here: https://ind.ie/labs/blog/using-system-headers-in-swift.

Installation

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

Usage

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.

License

This project is released under the MIT license.

swift-netutils's People

Contributors

abuobaida avatar svdo avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.