GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - arturgrigor/IPAPI: http://ip-api.com Geolocation API client written in Swift.

BranchesTags
Open more actions menu

Latest commit

 

History

37 Commits
37 Commits

Folders and files

NameName
Last commit message
Last commit date
Carthage/Checkouts
Carthage/Checkouts
 
 
Demo iOS
Demo iOS
 
 
IPAPI.xcodeproj
IPAPI.xcodeproj
 
 
Sources
Sources
 
 
Tests
Tests
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
.swift-version
.swift-version
 
 
.travis.yml
.travis.yml
 
 
Cartfile.private
Cartfile.private
 
 
Cartfile.resolved
Cartfile.resolved
 
 
IPAPI.podspec
IPAPI.podspec
 
 
LICENSE
LICENSE
 
 
Package.swift
Package.swift
 
 
README.md
README.md
 
 

Repository files navigation

SwiftPM compatible Carthage compatible Build Status CocoaPods Compatible Platform Twitter

IPAPI

http://ip-api.com Geolocation API client written in Swift.

Requirements

  • iOS 8.0+ / macOS 10.10+ / tvOS 9.0+ / watchOS 2.0+
  • Xcode 10.2+
  • Swift 5.1+

Installation

Carthage

Carthage is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks.

You can install Carthage with Homebrew using the following command:

$ brew update
$ brew install carthage

To integrate IPAPI into your Xcode project using Carthage, specify it in your Cartfile:

github "arturgrigor/IPAPI" ~> 3.0

Run carthage update to build the framework and drag the built IPAPI.framework into your Xcode project.

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

CocoaPods 1.1.0+ is required.

To integrate IPAPI into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '10.0'
use_frameworks!

target '<Your Target Name>' do
    pod 'IPAPI', '~> 3.0'
end

Then, run the following command:

$ pod install

Swift Package Manager

The Swift Package Manager is a tool for automating the distribution of Swift code and is integrated into the swift compiler.

Once you have your Swift package set up, adding IPAPI as a dependency is as easy as adding it to the dependencies value of your Package.swift.

dependencies: [
    .Package(url: "https://github.com/arturgrigor/IPAPI.git", majorVersion: 3)
]

Usage

🎯 Lookup the current IP address

import IPAPI

IPAPI.Service.default.fetch {
    if let result = try? $0.get() {
        print("Geo IP result \(result).")
    }
}

🔍 Lookup a domain

import IPAPI

Service.default.fetch(query: "apple.com") {
    if let result = try? $0.get() {
        print("Geo IP result \(result).")
    }
}

✂️ Ask only for some specific fields

import IPAPI

Service.default.fetch(fields: [.ip, .latitude, .longitude, .organization]) {
    if let result = try? $0.get() {
        print("Geo IP result \(result).")
    }
}

🇷🇴 Localization

import IPAPI

Service.default.fetch(language: "es") {
    if let result = try? $0.get() {
        print("Geo IP result \(result).")
    }
}

*Checkout this page for the available languages.

📦 Batch request

import IPAPI

Service.default.batch([Service.Request(query: "208.80.152.201",
                                       fields: [.countryName, .countryCode, .latitude, .longitude, .organization, .ip]),
                       Service.Request(query: "91.198.174.192", language: "es")]) {
    if let result = try? $0.get() {
        print("Geo IP result \(result).")
    }
}

🔒 HTTPS requests

In order to use the API via HTTPS you must register for the "Pro" plan to get an API key. After you've done that you can set the API key like this and all your requests will use HTTPS.

import IPAPI

IPAPI.Service(pricingPlan: .pro(apiKey: "test-demo-pro")).fetch {
    if let result = try? $0.get() {
        print("Geo IP result \(result).")
    }
}

Contact

  • GitHub
  • Twitter

Let me know if you're using or enjoying this product.

About

http://ip-api.com Geolocation API client written in Swift.

Topics

cocoapodsiosipapilookupmacosswifttvoswatchosxcode

Resources

Readme
License
Activity

Stars

16 stars

Watchers

1 watching

Forks

2 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.