Thanks to visit codestin.com
Credit goes to github.com

Skip to content

JorgeOOMM/IPAddress2Geolocation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IPAddress2Geolocation

IPAddress2Geolocation is a Swift package that geo locate and geo coordinate a internet IP address

Features

  • 1
  • 2
  • 3
  • 4

Requirements

iOS 13.0+ / macOS 10.15+

Installation

SPM

.package(url: "https://github.com/jorgeoomm/IPAddress2Geolocation.git", from: "0.0.1")

Usage

Get the geo location of ip address and print the country with the flag

import IPAddress2Geolocation

let lookup = IPAddress2Location()

guard let var location = try? lookup.location(with: "102.130.125.86") else {
    return
}

print("\(location.country(with: location)) [\(location.flag(with: location))]")

Print a geo location from a IP address string.

import IPAddress2Geolocation

let lookup = IPAddress2Location()

lookup.printAddress(for: "102.130.125.86")

Get a geo coordinate for a geo location from a IP address string.

import IPAddress2Geolocation

let lookup = IPAddress2Location()

guard let var location = try? lookup.location(with: "102.130.125.86") else {
    return
}

let coordinateLookup = GeoCoordinateLookup()

let locationName = location.subdiv + " - " + location.country

let coordinate = try await coordinateLookup.location(with: locationName)

print("\(coordinate.name) at longitude:\(coordinate.longitude), latitude:\(coordinate.latitude)")

Principle

IPAddress2Geolocation ...

How it works

TODO

  • [ ]
  • [ ]

Contributing & Support

  • Please open an issue or PR.
  • Any bugs or feature requests, please open an issue.

License

Apache

About

IPAddress2Geolocation

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages