Restaurants
Use client.restaurants to find nearby restaurants, search their menu items, and load one restaurant's menu. These examples use the client from Authentication.
The SDK doesn't read the device location. Get coordinates from Core Location, which needs NSLocationWhenInUseUsageDescription in your Info.plist.
Search restaurants
let restaurants = try await client.restaurants.search(
.init(
query: "mediterranean",
latitude: 37.7749,
longitude: -122.4194,
radius: 8_000,
limit: 10
)
)
for restaurant in restaurants.items {
print(restaurant.name ?? "", restaurant.distance as Any)
}Search menu items
Menu-item results can include nutrition, serving choices, photos, restaurant names, and distance.
Load a restaurant menu
Pass the ID from a restaurant search to getMenuItems to load that restaurant's menu without repeating the search text or location:
The response has only items, with no totalCount, so keep paging while full pages come back. An empty page ends the menu, including for a restaurant with no menu on record. An unknown restaurant fails with .notFound; in a discovery UI, fall back to searchMenuItems with the user's original query and location when the first page is empty or the restaurant is not found.
Input limits
Restaurant ID: not blank
Query: 1–256 characters
Latitude: −90 through 90; longitude: −180 through 180, in decimal degrees
Radius: 1–50,000 meters; default 8,000 (about 5 miles)
Limit: 1–100
Menu offset: 0 or more
Next: Food analysis.
Last updated
Was this helpful?