You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-3Lines changed: 52 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -16,7 +16,7 @@ The free plan is limited to 50,000 requests per month, and doesn't include some
16
16
17
17
### Swift Package Manager
18
18
19
-
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
19
+
The [Swift Package Manager](https://swift.org/package-manager/) is a tool for automating the distribution of Swift code and is integrated into the `swift` compiler.
20
20
21
21
Once you have your Swift package set up, adding ipinfo as a dependency is as easy as adding it to the `dependencies` value of your `Package.swift`.
This library provides a system to lookup if a country is a member of the European Union (EU) through ISO2 country codes.
113
+
112
114
```swift
113
115
IPINFO.shared.getDetails(ip: "8.8.8.8") { status, response, msg in
114
116
guardlet response else {return}
@@ -197,11 +199,58 @@ case .ip(let ip):
197
199
}
198
200
```
199
201
202
+
# Core API
203
+
204
+
The library also supports the [Core API](https://ipinfo.io/developers/data-types#core-data), which provides city-level geolocation with nested geo and AS objects. Authentication with your token is required.
205
+
206
+
```swift
207
+
let client =IPInfoCore(token: "YOUR TOKEN")
208
+
let response =tryawait client.lookup(ip: "8.8.8.8")
209
+
210
+
print(response.ip) // 8.8.8.8
211
+
print(response.geo.city) // Mountain View
212
+
print(response.geo.country) // United States
213
+
print(response.as.asn) // AS15169
214
+
print(response.as.name) // Google LLC
215
+
```
216
+
217
+
# Plus API
218
+
219
+
The library also supports the [Plus API](https://ipinfo.io/developers/data-types#plus-data), which provides enhanced data including mobile carrier info and privacy detection. Authentication with your token is required.
220
+
221
+
```swift
222
+
let client =IPInfoPlus(token: "YOUR TOKEN")
223
+
let response =tryawait client.lookup(ip: "8.8.8.8")
224
+
225
+
print(response.ip) // 8.8.8.8
226
+
print(response.geo.city) // Mountain View
227
+
print(response.mobile) // mobile carrier info
228
+
print(response.anonymous.isProxy) // false
229
+
```
230
+
231
+
# Residential Proxy API
232
+
233
+
The library also supports the [Residential Proxy API](https://ipinfo.io/developers/residential-proxy-api), which allows you to check if an IP address is a residential proxy. Authentication with your token is required.
234
+
235
+
```swift
236
+
IPINFO.shared.getResproxyDetails(ip: "175.107.211.204") { status, data, msg in
237
+
switch status {
238
+
case .success:
239
+
print(data?.ip) // 175.107.211.204
240
+
print(data?.lastSeen) // 2025-01-20
241
+
print(data?.percentDaysSeen) // 0.85
242
+
print(data?.service) // Bright Data
243
+
case .failure:
244
+
print(msg)
245
+
}
246
+
}
247
+
```
248
+
200
249
# Contributing
201
250
202
251
## Running the tests
203
252
204
-
Some tests require a [token](https://ipinfo.io/dashboard/token) to pass. You can add yours as an [environment variable of the scheme](https://developer.apple.com/documentation/xcode/customizing-the-build-schemes-for-a-project/#Specify-launch-arguments-and-environment-variables).
253
+
Some tests require a [token](https://ipinfo.io/dashboard/token) to pass. You can add yours as an [environment variable of the scheme](https://developer.apple.com/documentation/xcode/customizing-the-build-schemes-for-a-project/#Specify-launch-arguments-and-environment-variables).
0 commit comments