GooglePlacesSwift Framework Reference
Stay organized with collections
Save and categorize content based on your preferences.
FetchPhotoRequest
struct FetchPhotoRequest
extension FetchPhotoRequest : Sendable
The request for a specific placeID and place properties to include in the Place response.
-
Request object to use with PlacesClient
to fetch a photo.
If the image is smaller than the values specified, the original image will be returned. If
the image is larger in either dimension, it will be scaled to match the smaller of the two
dimensions, restricted to its original aspect ratio. CGSize height and width should be set
to an integer between 1 and 4800. If not, the PlacesClient
request callback will return
an error.
Declaration
Swift
init(photo: Photo, maxSize: CGSize)
Parameters
photo
|
|
maxSize
|
The maximum desired size in pixels of the image returned by the Place Photos
service.
|
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\u003eFetchPhotoRequest\u003c/code\u003e is a struct used to request a photo for a specific place, along with its properties.\u003c/p\u003e\n"],["\u003cp\u003eIt initializes with a \u003ccode\u003ePhoto\u003c/code\u003e object and a \u003ccode\u003emaxSize\u003c/code\u003e of type \u003ccode\u003eCGSize\u003c/code\u003e to define the desired photo dimensions.\u003c/p\u003e\n"],["\u003cp\u003eThe returned photo will either be the original if smaller than \u003ccode\u003emaxSize\u003c/code\u003e or scaled down while maintaining aspect ratio.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003emaxSize\u003c/code\u003e height and width must be within the range of 1 to 4800, otherwise, the request will result in an error.\u003c/p\u003e\n"]]],["The `FetchPhotoRequest` struct is used to request a photo from a specific place, including specified properties. It initializes with a `Photo` and `maxSize` (CGSize). The photo will be scaled down if it exceeds the `maxSize` dimensions, maintaining its aspect ratio. Dimensions must be integers between 1 and 4800; otherwise, the request will fail. The struct interacts with `PlacesClient` to fetch the requested photo.\n"],null,["# GooglePlacesSwift Framework Reference\n\nFetchPhotoRequest\n=================\n\n struct FetchPhotoRequest\n\n extension FetchPhotoRequest : Sendable\n\nThe request for a specific placeID and place properties to include in the Place response.\n- `\n ``\n ``\n `\n\n ### [init(photo:maxSize:)](#/s:17GooglePlacesSwift17FetchPhotoRequestV5photo7maxSizeAcA0E0V_So6CGSizeVtcfc)\n\n `\n ` \n Request object to use with [PlacesClient](../Classes/PlacesClient.html) to fetch a photo.\n\n If the image is smaller than the values specified, the original image will be returned. If\n the image is larger in either dimension, it will be scaled to match the smaller of the two\n dimensions, restricted to its original aspect ratio. CGSize height and width should be set\n to an integer between 1 and 4800. If not, the [PlacesClient](../Classes/PlacesClient.html) request callback will return\n an error. \n\n #### Declaration\n\n Swift \n\n init(photo: ../Structs/Photo.html, maxSize: CGSize)\n\n #### Parameters\n\n |-----------------|---------------------------------------------------------------------------------------|\n | ` `*photo*` ` | The [Photo](../Structs/Photo.html) to request. |\n | ` `*maxSize*` ` | The maximum desired size in pixels of the image returned by the Place Photos service. |"]]