Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fpseverino/apple-maps-kit
🗺️ Integrate the Apple Maps Server API into Swift server applications
https://github.com/fpseverino/apple-maps-kit
apple-maps directions eta geocoding location map search server-side-swift swift swift-library swift-linux swift-on-server swift-package swift-package-manager
Last synced: 4 days ago
JSON representation
🗺️ Integrate the Apple Maps Server API into Swift server applications
- Host: GitHub
- URL: https://github.com/fpseverino/apple-maps-kit
- Owner: fpseverino
- License: mit
- Created: 2024-09-07T21:43:17.000Z (26 days ago)
- Default Branch: main
- Last Pushed: 2024-09-24T18:10:43.000Z (9 days ago)
- Last Synced: 2024-09-26T01:13:25.353Z (7 days ago)
- Topics: apple-maps, directions, eta, geocoding, location, map, search, server-side-swift, swift, swift-library, swift-linux, swift-on-server, swift-package, swift-package-manager
- Language: Swift
- Homepage: https://swiftpackageindex.com/fpseverino/apple-maps-kit
- Size: 42 KB
- Stars: 7
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# AppleMapsKit
🗺️ Integrate the [Apple Maps Server API](https://developer.apple.com/documentation/applemapsserverapi) into Swift server applications
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Ffpseverino%2Fapple-maps-kit%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/fpseverino/apple-maps-kit)
[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Ffpseverino%2Fapple-maps-kit%2Fbadge%3Ftype%3Dplatforms)](https://swiftpackageindex.com/fpseverino/apple-maps-kit)## Overview
Use this web-based service to streamline your app’s API by moving georelated searches for places, points of interest, geocoding, directions, possible autocompletions for searches, and estimated time of arrival (ETA) calculations from inside your app to your server.
### Getting Started
Use the SPM string to easily include the dependendency in your `Package.swift` file
```swift
.package(url: "https://github.com/fpseverino/apple-maps-kit.git", from: "0.1.0")
```and add it to your target's dependencies:
```swift
.product(name: "AppleMapsKit", package: "apple-maps-kit")
```### Geocode an address
Returns the latitude and longitude of the address you specify.
```swift
import AppleMapsKit
import AsyncHTTPClientlet client = try await AppleMapsClient(
httpClient: HTTPClient(...),
teamID: "DEF123GHIJ",
keyID: "ABC123DEFG",
key: """
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
"""
)let places = try await client.geocode(address: "1 Apple Park, Cupertino, CA")
```### Reverse geocode a location
Returns an array of addresses present at the coordinates you provide.
```swift
import AppleMapsKit
import AsyncHTTPClientlet client = try await AppleMapsClient(
httpClient: HTTPClient(...),
teamID: "DEF123GHIJ",
keyID: "ABC123DEFG",
key: """
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
"""
)let places = try await client.reverseGeocode(latitude: 37.33182, longitude: -122.03118)
```### Search for places that match specific criteria
Find places by name or by specific search criteria.
```swift
import AppleMapsKit
import AsyncHTTPClientlet client = try await AppleMapsClient(
httpClient: HTTPClient(...),
teamID: "DEF123GHIJ",
keyID: "ABC123DEFG",
key: """
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
"""
)let searchResponse = try await client.search(for: "eiffel tower")
```### Search for places that meet specific criteria to autocomplete a place search
Find results that you can use to autocomplete searches.
```swift
import AppleMapsKit
import AsyncHTTPClientlet client = try await AppleMapsClient(
httpClient: HTTPClient(...),
teamID: "DEF123GHIJ",
keyID: "ABC123DEFG",
key: """
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
"""
)let results = try await client.searchAutoComplete(for: "eiffel")
```### Search for directions and estimated travel time between locations
Find directions by specific criteria.
```swift
import AppleMapsKit
import AsyncHTTPClientlet client = try await AppleMapsClient(
httpClient: HTTPClient(...),
teamID: "DEF123GHIJ",
keyID: "ABC123DEFG",
key: """
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
"""
)let directions = try await client.directions(
origin: "37.7857,-122.4011",
destination: "San Francisco City Hall, CA"
)
```### Determine estimated arrival times and distances to one or more destinations
Returns the estimated time of arrival (ETA) and distance between starting and ending locations.
```swift
import AppleMapsKit
import AsyncHTTPClientlet client = try await AppleMapsClient(
httpClient: HTTPClient(...),
teamID: "DEF123GHIJ",
keyID: "ABC123DEFG",
key: """
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
"""
)let coordinateEtas = try await client.eta(
from: (latitude: 37.331423, longitude: -122.030503),
to: [
(latitude: 37.32556561130194, longitude: -121.94635203581443),
(latitude: 37.44176585512703, longitude: -122.17259315798667)
]
)let addressEtas = try await client.etaBetweenAddresses(
from: "San Francisco City Hall, CA",
to: ["Golden Gate Park, San Francisco"],
)
```