AI-generated Key Takeaways
-
SearchByTextRequestenables searching for places using textual queries and various filters. -
It allows specifying location bias, restriction, desired place properties, rating, price levels, and more.
-
Results can be ranked by distance or prominence according to
RankPreference. -
Developers can refine searches by including or excluding specific place types using
includedTypeandisStrictTypeFiltering. -
SearchByTextRequestoffers flexibility for tailoring place searches to specific needs.
SearchByTextRequest
struct SearchByTextRequestextension SearchByTextRequest : Equatable, Sendable-
Returns a Boolean value indicating whether two values are equal.
Equality is the inverse of inequality. For any values
aandb,a == bimplies thata != bisfalse.Declaration
Swift
static func == (a: SearchByTextRequest, b: SearchByTextRequest) -> Bool -
How results will be ranked in the response.
Declaration
Swift
enum RankPreferenceextension SearchByTextRequest.RankPreference : CaseIterable, Equatable, Hashable, Identifiable, Sendable -
The requested place type.
See https://developers.google.com/maps/documentation/places/web-service/search-textual#supported-types for the most up-to-date list of supported types available
Declaration
Swift
var includedType: PlaceType? { get } -
init(textQuery:placeProperties:locationBias:includedType:maxResultCount:minRating:isOpenNow:priceLevels:rankPreference:regionCode:isStrictTypeFiltering:shouldIncludePureServiceAreaBusinesses:)
Instantiates a
SearchByTextRequestwith a text query and place properties to return.Declaration
Swift
init(textQuery: String, placeProperties: [PlaceProperty], locationBias: any CoordinateRegionBias, includedType: PlaceType? = nil, maxResultCount: Int = 20, minRating: Float = 0.0, isOpenNow: Bool = true, priceLevels: Set<PriceLevel>? = nil, rankPreference: SearchByTextRequest.RankPreference = .distance, regionCode: String? = nil, isStrictTypeFiltering: Bool = false, shouldIncludePureServiceAreaBusinesses: Bool = false)Parameters
textQueryThe string query for the search request.
placePropertiesThe
PlacePropertys 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. When used in aPlaceSearchViewcontext, this parameter will be ignored, as the place properties will be automatically determined.locationBiasThe biased region to search.
includedTypeThe requested place type.
maxResultCountThe maximum number of results to return. Must be between 1 and 20 (default), inclusive.
minRatingThe minimum average user rating for places to be included in the results, between 0.0 (default) and 5.0, inclusive.
isOpenNowFilter results to places that are currently open. Defaults to
true.priceLevelsA set of
PriceLevelvalues to filter places included in the results.rankPreferenceThe
RankPreferenceto sort the results. Defaults to.distance.regionCodeThe unicode country/region code (CLDR) of the request location.
isStrictTypeFilteringDefines if only results of
includedTypeshould be returned. Defaults tofalse.shouldIncludePureServiceAreaBusinessesDefines whether to include pure service area businesses in the results. Defaults to
false. -
init(textQuery:placeProperties:locationRestriction:includedType:maxResultCount:minRating:isOpenNow:priceLevels:rankPreference:regionCode:isStrictTypeFiltering:shouldIncludePureServiceAreaBusinesses:)
Instantiates a
SearchByTextRequestwith a text query and place properties to return.Declaration
Swift
init(textQuery: String, placeProperties: [PlaceProperty], locationRestriction: any CoordinateRegionRestriction, includedType: PlaceType? = nil, maxResultCount: Int = 20, minRating: Float = 0.0, isOpenNow: Bool = true, priceLevels: Set<PriceLevel>? = nil, rankPreference: SearchByTextRequest.RankPreference = .distance, regionCode: String? = nil, isStrictTypeFiltering: Bool = false, shouldIncludePureServiceAreaBusinesses: Bool = false)Parameters
textQueryThe string query for the search request.
placePropertiesThe
PlacePropertys 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. When used in aPlaceSearchViewcontext, this parameter will be ignored, as the place properties will be automatically determined.locationRestrictionThe restricted region to search.
includedTypeThe requested place type.
maxResultCountThe maximum number of results to return. Must be between 1 and 20 (default), inclusive.
minRatingThe minimum average user rating for places to be included in the results, between 0.0 (default) and 5.0, inclusive.
isOpenNowFilter results to places that are currently open. Defaults to
true.priceLevelsA set of
PriceLevelvalues to filter places included in the results.rankPreferenceThe
RankPreferenceto sort the results. Defaults to.distance.regionCodeThe unicode country/region code (CLDR) of the request location.
isStrictTypeFilteringDefines if only results of
includedTypeshould be returned. Defaults tofalse.shouldIncludePureServiceAreaBusinessesDefines whether to include pure service area businesses in the results. Defaults to
false. -
Filter results to places that are currently open. */
Declaration
Swift
var isOpenNow: Bool { get } -
Defines whether only results of
includedTypeshould be returned.Default value is
false`.Declaration
Swift
var isStrictTypeFiltering: Bool { get } -
The biased region to search.
This location serves as a bias, which means there is a preference for results in the given location.
If set along with
locationRestriction`, this will be ignored.Declaration
Swift
var locationBias: (any CoordinateRegionBias)? { get } -
The restricted region to search.
This location serves as a restriction which means results outside the given location will not be returned.
Cannot be used with
locationBias`.Declaration
Swift
var locationRestriction: (any CoordinateRegionRestriction)? { get } -
Returns the maximum number of results to return between
PlaceResultCountMinResultCountandPlaceResultCountMaxResultCount.The allowed range of this field can be found at https://developers.google.com/maps/documentation/places/web-service/search-textual#maxresultcount. Defaults to the upper limit.
Declaration
Swift
var maxResultCount: Int { get } -
The minimum average user rating for places to be included in the results. Rating will be within a range between 0.0 and 5.0.
The specified rating will be rounded up to the nearest 0.5. See
Placerating property.Declaration
Swift
var minRating: Float { get } -
The array of
PlacePropertythat should be included in place results.Declaration
Swift
var placeProperties: [PlaceProperty] { get } -
An array of the
PriceLevelvalues that should filter the places included in the results.Any combination of price levels can be selected; default is all price levels.
Declaration
Swift
var priceLevels: Set<PriceLevel>? { get } -
The
RankPreferenceused to sort the results returned from the request.Declaration
Swift
var rankPreference: SearchByTextRequest.RankPreference { get } -
The unicode country/region code (CLDR) of the location where the request is coming from.
It is used to display the place details, like region-specific place name, if available.
See https://unicode.org/cldr/charts/latest/supplemental/territory_containment_un_m_49.html for region codes.
Declaration
Swift
var regionCode: String? { get } -
A pure service area business is a business that visits or delivers to customers directly, but does not serve customers at their business address. For example, businesses like cleaning services or plumbers. Those businesses do not have a physical address or location on Google Maps.
Default value is
false.Declaration
Swift
var shouldIncludePureServiceAreaBusinesses: Bool { get } -
The text query for the search.
Declaration
Swift
var textQuery: String { get }