Skip to content

A pure (ish) Swift implementation of NSHost that works on iOS and can be used without a bridging header.

License

Notifications You must be signed in to change notification settings

MonikerSonic/Host.swift

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Host.swift

Swift ![Platform](https://img.shields.io/badge/Platform-iOS, macOS & tvOS-lightgrey.svg?style=flat) Carthage compatible License

A Swift implementation of NSHost that works on iOS, OS X and tvOS.

Host.swift is safe to use in a framework because it does not require a bridging header.

##Motivation

Host.swift was created because NSHost is unavailable on iOS and CFHost does not offer the full functionality of it OS X counterpart.

In addition, those developers hoping for a pure-Swift solution were out of luck without using a bridging header.

Host.swift does not use a bridging header, so is safe to use in Framework development. It is 100% Swift and tries to maintain as much type safety as the low level networking C API will allow.

Example

let host = Host()
let deviceIP = host.addresses.first
print("IP: \(deviceIP)") // Will print a dot-separated IP address, e.g: 17.24.2.55

About

A pure (ish) Swift implementation of NSHost that works on iOS and can be used without a bridging header.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 94.9%
  • Objective-C 5.1%