Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/samasaur1/swiftip
A library to help with getting IP addresses in Swift.
https://github.com/samasaur1/swiftip
hacktoberfest ip swift
Last synced: 19 days ago
JSON representation
A library to help with getting IP addresses in Swift.
- Host: GitHub
- URL: https://github.com/samasaur1/swiftip
- Owner: Samasaur1
- Created: 2018-11-04T18:06:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2024-01-24T20:11:50.000Z (12 months ago)
- Last Synced: 2024-12-06T00:16:15.623Z (about 1 month ago)
- Topics: hacktoberfest, ip, swift
- Language: Swift
- Homepage: https://samasaur1.github.io/projects/swiftip.html
- Size: 490 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# SwiftIP
A library to help with getting IP addresses in Swift.
## Installing
Add the following to your `Package.swift`:
```swift
.package(url: "https://github.com/Samasaur1/SwiftIP.git", from: "2.0.0"),
```Or use [Ice](https://github.com/jakeheis/Ice):
```sh
$ ice add SwiftIP
```## Usage
The documentation is available here: [https://samasaur1.github.io/SwiftIP/](https://samasaur1.github.io/SwiftIP/)
Effectively, however, you do this:
```swift
import SwiftIPguard let localIP = IP.local() else {
fatalError("Could not find local IP")
}let publicIP: String? = IP.public()
print("Local IP: \(localIP); public IP: \(publicIP ?? "Not connected")")
```