Giter Club home page Giter Club logo

swift-public-ip's Introduction

Swift-Public-IP

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.

Usage

import SwiftPublicIP

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

Implementation

Carthage

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.

CocoaPods

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: [
        .target(
            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.

swift-public-ip's People

Contributors

bi119ate5hxk avatar hackinggate avatar renovate-bot avatar renovate[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

swift-public-ip's Issues

Release a new version

It’s been a while since CaseIterable was added to enum by @bi119aTe5hXk .
But there’s still no new version being released.

Another thing I wanted to do is to make getPublicIP() a static method. It will be SwiftPublicIP.getPublicIP() when calling in your project. It's like + methods in Objective-C.

I don’t have much experience on making Swift packages. If you came up with a better idea. Please comment.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

github-actions
.github/workflows/swiftlint.yml
  • actions/checkout v4
  • norio-nomura/action-swiftlint 3.2.1
.github/workflows/test.yml
  • actions/checkout v4
  • actions/upload-artifact v3
  • actions/download-artifact v3
  • HackingGate/lcov-reporter-action a1c0d02b814fedd5aff86d9e7eac73834eb6e091
  • actions/github-script v6

  • Check this box to trigger a request for Renovate to run again on this repository

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.