Swiftpack.co -  HackingGate/Swift-Public-IP as Swift Package
Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
Swift library for checking your public IP address
.package(url: "https://github.com/HackingGate/Swift-Public-IP.git", from: "0.0.2")


SwiftLint Test

Swift library for checking your public IP address

Supports macOS, iOS, tvOS, watchOS and Linux.

Uses icanhazip, ipv6test, seeip, whatismyipaddress, ident and etc.


import SwiftPublicIP

SwiftPublicIP.getPublicIP(url: PublicIPAPIURLs.IPv4.icanhazip.rawValue) { (string, error) in
    if let error = error {
    } else if let string = string {
        print(string) // Your IP address



Add it in the Cartfile.

github "HackingGate/Swift-Public-IP" "0.0.2"

Run carthage update.

Add the SwiftPublicIP framework as an embedded binary to your .xcodeproj file.


Add it in the Podfile

pod 'SwiftPublicIP', '~> 0.0.2'

Run pod install.

If you only want try this pod without import it. Run pod try SwiftPublicIP.

Swift Package Manager (SPM)

You need Package.swift file.

// swift-tools-version:5.0

import PackageDescription

let package = Package(
    name: "YourAwesomeApp",
    dependencies: [
        .package(url: "https://github.com/HackingGate/Swift-Public-IP", from: "0.0.2"),
    targets: [
            name: "YourAwesomeApp",
            dependencies: ["SwiftPublicIP"],
            path: "Sources")

Git Submodule or Manual

Add as a git submodule.

git submodule add https://github.com/HackingGate/Swift-Public-IP

If you don't use git, just download it manually.

Drag SwiftPublicIP.xcodeproj to your project.

Add the SwiftPublicIP framework as an embedded binary to your .xcodeproj file.

If you want to remove git submodule Swift-Public-IP.

git submodule deinit Swift-Public-IP

And don't forget remove reference from Xcode.


Stars: 8
Last commit: 2 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.

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