GooglePlacesSwift Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
SearchNearbyRequest
struct SearchNearbyRequest
extension SearchNearbyRequest : Equatable, Sendable
-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values a
and b
,
a == b
implies that a != b
is false
.
Declaration
Swift
static func == (a: SearchNearbyRequest, b: SearchNearbyRequest) -> Bool
-
How results will be ranked in the response.
Declaration
Swift
enum RankPreference
extension SearchNearbyRequest.RankPreference : CaseIterable, Equatable, Hashable, Identifiable, Sendable
-
Declaration
Swift
var excludedPrimaryTypes: Set<PlaceType>? { get }
-
Declaration
Swift
var excludedTypes: Set<PlaceType>? { get }
-
Declaration
Swift
var includedPrimaryTypes: Set<PlaceType>? { get }
-
Declaration
Swift
var includedTypes: Set<PlaceType>? { get }
-
Instantiates a SearchNearbyRequest
with a text query and place properties to return.
Parameters
locationRestriction
|
The restricted region to search.
|
placeProperties
|
The PlaceProperty s that should be included in place results. Must not
be empty. An empty list will result in an error when trying to send the request.
|
includedTypes
|
The set of place types to include in a search.
|
excludedTypes
|
The set of place types to exclude from a search.
|
includedPrimaryTypes
|
The set of primary place types to include in a search.
|
excludedPrimaryTypes
|
The set of primary place types to exclude from a search
|
maxResultCount
|
The maximum number of results to return. Must be between 1 and 20
(default), inclusive.
|
rankPreference
|
|
regionCode
|
The unicode country/region code (CLDR) of the request location.
|
-
The region to search specified as a circle, defined by center point and radius in meters.
The radius must be between 0.0 and 50000.0, inclusive. The locationRestriction
must be
specified with CircularCoordinateRegion
. Using RectangularCoordinateRegion
will result
in an error.
-
The maximum number of Place
results to return. Must be between 1 and 20 (default)
inclusive. Breaking this restriction will result in an error returned.
Declaration
Swift
var maxResultCount: Int { get }
-
The array of PlaceProperty
that should be included in place results.
-
-
Declaration
Swift
var regionCode: String? { get }
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-27 UTC.
[null,null,["Last updated 2025-08-27 UTC."],[[["\u003cp\u003e\u003ccode\u003eSearchNearbyRequest\u003c/code\u003e structures parameters for nearby place searches within a specified region.\u003c/p\u003e\n"],["\u003cp\u003eIt allows filtering results by place types, including or excluding specific primary and regular types.\u003c/p\u003e\n"],["\u003cp\u003eUsers can customize the ranking preference (distance or prominence), the maximum number of results, and the properties returned for each place.\u003c/p\u003e\n"],["\u003cp\u003eThe request can be further refined using a region code and by specifying a circular search area with a center point and radius.\u003c/p\u003e\n"]]],["`SearchNearbyRequest` allows for defining criteria for place searches. Key actions include specifying `locationRestriction` within a radius (0-50,000m), setting `maxResultCount` (1-20), and choosing `placeProperties` to include. Filters involve `includedTypes`/`excludedTypes` and `includedPrimaryTypes`/`excludedPrimaryTypes` (up to 50 types each). Results can be sorted by `rankPreference`. The `regionCode` can be provided. A constructor initializes these properties. Conflicting types cause an error.\n"],null,["# GooglePlacesSwift Framework Reference\n\nSearchNearbyRequest\n===================\n\n struct SearchNearbyRequest\n\n extension SearchNearbyRequest : Equatable, Sendable\n\n- `\n ``\n ``\n `\n\n ### [==(_:_:)](#/s:17GooglePlacesSwift19SearchNearbyRequestV2eeoiySbAC_ACtFZ)\n\n `\n ` \n Returns a Boolean value indicating whether two values are equal.\n\n Equality is the inverse of inequality. For any values `a` and `b`,\n `a == b` implies that `a != b` is `false`. \n\n #### Declaration\n\n Swift \n\n static func == (a: SearchNearbyRequest, b: SearchNearbyRequest) -\u003e Bool\n\n- `\n ``\n ``\n `\n\n ### [RankPreference](../Structs/SearchNearbyRequest/RankPreference.html)\n\n `\n ` \n How results will be ranked in the response. \n\n #### Declaration\n\n Swift \n\n enum RankPreference\n\n extension ../Structs/SearchNearbyRequest.html.RankPreference : CaseIterable, Equatable, Hashable, Identifiable, Sendable\n\n- `\n ``\n ``\n `\n\n ### [excludedPrimaryTypes](#/s:17GooglePlacesSwift19SearchNearbyRequestV20excludedPrimaryTypesShyAA9PlaceTypeVGSgvp)\n\n `\n ` \n The set of primary place types to exclude from a search. If conflicting types are\n specified (e.g., types appearing in [includedTypes](../Structs/SearchNearbyRequest.html#/s:17GooglePlacesSwift19SearchNearbyRequestV13includedTypesShyAA9PlaceTypeVGSgvp) and [excludedTypes](../Structs/SearchNearbyRequest.html#/s:17GooglePlacesSwift19SearchNearbyRequestV13excludedTypesShyAA9PlaceTypeVGSgvp)), an INVALID_REQUEST\n error is returned. Up to 50 types can be specified. If a request is specified with multiple\n type restrictions, only places that satisfy all of the restrictions are returned. For more\n information about primary types see:\n \u003chttps://developers.google.com/maps/documentation/places/web-service/nearby-search#includedtypesexcludedtypes,-includedprimarytypesexcludedprimarytypes\u003e \n\n #### Declaration\n\n Swift \n\n var excludedPrimaryTypes: Set\u003c../Structs/PlaceType.html\u003e? { get }\n\n- `\n ``\n ``\n `\n\n ### [excludedTypes](#/s:17GooglePlacesSwift19SearchNearbyRequestV13excludedTypesShyAA9PlaceTypeVGSgvp)\n\n `\n ` \n The set of place types to exclude from a search. Up to 50 types can be specified. If a\n request is specified with multiple type restrictions, only places that satisfy all of the\n restrictions are returned. If conflicting types are specified (e.g., types appearing in\n [includedTypes](../Structs/SearchNearbyRequest.html#/s:17GooglePlacesSwift19SearchNearbyRequestV13includedTypesShyAA9PlaceTypeVGSgvp) and `excludedTypes`), an INVALID_REQUEST error is returned.\n\n See Table A for a list of supported types\n \u003chttps://developers.google.com/maps/documentation/places/web-service/place-types#table-a\u003e. \\*/ \n\n #### Declaration\n\n Swift \n\n var excludedTypes: Set\u003c../Structs/PlaceType.html\u003e? { get }\n\n- `\n ``\n ``\n `\n\n ### [includedPrimaryTypes](#/s:17GooglePlacesSwift19SearchNearbyRequestV20includedPrimaryTypesShyAA9PlaceTypeVGSgvp)\n\n `\n ` \n The set of primary place types to include in a search. Up to 50 types can be specified. If\n a request is specified with multiple type restrictions, only places that satisfy all of the\n restrictions are returned. For more information about primary types see:\n \u003chttps://developers.google.com/maps/documentation/places/web-service/nearby-search#includedtypesexcludedtypes,-includedprimarytypesexcludedprimarytypes\u003e \n\n #### Declaration\n\n Swift \n\n var includedPrimaryTypes: Set\u003c../Structs/PlaceType.html\u003e? { get }\n\n- `\n ``\n ``\n `\n\n ### [includedTypes](#/s:17GooglePlacesSwift19SearchNearbyRequestV13includedTypesShyAA9PlaceTypeVGSgvp)\n\n `\n ` \n The set of place types to include in a search. Up to 50 types can be specified. If a\n request is specified with multiple type restrictions, only places that satisfy all of the\n restrictions are returned. If the set is empty, then all places of all types are returned.\n\n See Table A for a list of supported types\n \u003chttps://developers.google.com/maps/documentation/places/web-service/place-types#table-a\u003e. \\*/ \n\n #### Declaration\n\n Swift \n\n var includedTypes: Set\u003c../Structs/PlaceType.html\u003e? { get }\n\n- `\n ``\n ``\n `\n\n ### [init(locationRestriction:placeProperties:includedTypes:excludedTypes:includedPrimaryTypes:excludedPrimaryTypes:maxResultCount:rankPreference:regionCode:)](#/s:17GooglePlacesSwift19SearchNearbyRequestV19locationRestriction15placeProperties13includedTypes08excludedL00k7PrimaryL00mnL014maxResultCount14rankPreference10regionCodeAcA016CoordinateRegionH0_p_SayAA13PlacePropertyOGShyAA0X4TypeVGSgA3TSiAC04RankS0OSSSgtcfc)\n\n `\n ` \n Instantiates a `SearchNearbyRequest` with a text query and place properties to return. \n\n #### Declaration\n\n Swift \n\n init(locationRestriction: any ../Protocols/CoordinateRegionRestriction.html, placeProperties: [../Enums/PlaceProperty.html], includedTypes: Set\u003c../Structs/PlaceType.html\u003e? = nil, excludedTypes: Set\u003c../Structs/PlaceType.html\u003e? = nil, includedPrimaryTypes: Set\u003c../Structs/PlaceType.html\u003e? = nil, excludedPrimaryTypes: Set\u003c../Structs/PlaceType.html\u003e? = nil, maxResultCount: Int = 20, rankPreference: SearchNearbyRequest.../Structs/SearchNearbyRequest/RankPreference.html = .popularity, regionCode: String? = nil)\n\n #### Parameters\n\n |------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | ` `*locationRestriction*` ` | The restricted region to search. |\n | ` `*placeProperties*` ` | The [PlaceProperty](../Enums/PlaceProperty.html)s that should be included in place results. Must not be empty. An empty list will result in an error when trying to send the request. |\n | ` `*includedTypes*` ` | The set of place types to include in a search. |\n | ` `*excludedTypes*` ` | The set of place types to exclude from a search. |\n | ` `*includedPrimaryTypes*` ` | The set of primary place types to include in a search. |\n | ` `*excludedPrimaryTypes*` ` | The set of primary place types to exclude from a search |\n | ` `*maxResultCount*` ` | The maximum number of results to return. Must be between 1 and 20 (default), inclusive. |\n | ` `*rankPreference*` ` | The [RankPreference](../Structs/SearchNearbyRequest/RankPreference.html) to sort the results. Defaults to `.popularity`. |\n | ` `*regionCode*` ` | The unicode country/region code (CLDR) of the request location. |\n\n- `\n ``\n ``\n `\n\n ### [locationRestriction](#/s:17GooglePlacesSwift19SearchNearbyRequestV19locationRestrictionAA016CoordinateRegionH0_pvp)\n\n `\n ` \n The region to search specified as a circle, defined by center point and radius in meters.\n The radius must be between 0.0 and 50000.0, inclusive. The `locationRestriction` must be\n specified with [CircularCoordinateRegion](../Structs/CircularCoordinateRegion.html). Using [RectangularCoordinateRegion](../Structs/RectangularCoordinateRegion.html) will result\n in an error. \n\n #### Declaration\n\n Swift \n\n var locationRestriction: any ../Protocols/CoordinateRegionRestriction.html { get }\n\n- `\n ``\n ``\n `\n\n ### [maxResultCount](#/s:17GooglePlacesSwift19SearchNearbyRequestV14maxResultCountSivp)\n\n `\n ` \n The maximum number of [Place](../Structs/Place.html) results to return. Must be between 1 and 20 (default)\n inclusive. Breaking this restriction will result in an error returned. \n\n #### Declaration\n\n Swift \n\n var maxResultCount: Int { get }\n\n- `\n ``\n ``\n `\n\n ### [placeProperties](#/s:17GooglePlacesSwift19SearchNearbyRequestV15placePropertiesSayAA13PlacePropertyOGvp)\n\n `\n ` \n The array of [PlaceProperty](../Enums/PlaceProperty.html) that should be included in place results. \n\n #### Declaration\n\n Swift \n\n var placeProperties: [../Enums/PlaceProperty.html] { get }\n\n- `\n ``\n ``\n `\n\n ### [rankPreference](#/s:17GooglePlacesSwift19SearchNearbyRequestV14rankPreferenceAC04RankH0Ovp)\n\n `\n ` \n The [SearchNearbyRequest.RankPreference](../Structs/SearchNearbyRequest/RankPreference.html) used to sort the results returned from the request.\n The default value is `.distance.` \\*/ \n\n #### Declaration\n\n Swift \n\n var rankPreference: SearchNearbyRequest.../Structs/SearchNearbyRequest/RankPreference.html { get }\n\n- `\n ``\n ``\n `\n\n ### [regionCode](#/s:17GooglePlacesSwift19SearchNearbyRequestV10regionCodeSSSgvp)\n\n `\n ` \n The unicode country/region code (CLDR) of the location where the request is coming from.\n\n See \u003chttps://www.unicode.org/cldr/charts/44/supplemental/territory_language_information.html\u003e\n for region codes. \n\n #### Declaration\n\n Swift \n\n var regionCode: String? { get }"]]