======================================
ip-api.com offers a web service to resolve a requesting client's location based on the client's IP address.
| Here's an example |
|---|
IPAPI.location(NSURLSession.sharedSession())
.observeOn(MainScheduler.instance)
.subscribeNext { (geoData: IPGeoData?) in
// do something with geoData
// geoData.ispName => ISP Name
// geoData.ipAddress => IP Address
// geoData.city => City
// geoData.region => Region
// geoData.zipCode => Zip Code
self.updateLocation(geoData.lat, geoData.lng)
}
.addDisposableTo(disposeBag)
|
-
Xcode 7+
-
Swift 2.3
-
iOS 8.0+
IPAPI has an external dependency on RxSwift
These are currently the supported options:
Add this to Cartfile
github "agoodman/IPAPI"
$ carthage update