GooglePlacesSwift Framework Reference

Place

struct Place
extension Place : CustomStringConvertible, Equatable, Hashable, PlaceProtocol

Represents a particular physical place.

A Place encapsulates information about a physical location, including its name, location, and any other information we might have about it. This class is immutable.

  • 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 == (lhs: Place, rhs: Place) -> Bool

    Parameters

    lhs

    A value to compare.

    rhs

    Another value to compare.

  • Place Attribute indicating place is wheelchair accessible at the entrance.

    Declaration

    Swift

    var accessibilityOptions: AccessibilityOptions? { get }
  • An array of AddressComponent objects representing the components in the place’s address.

    These components are provided for the purpose of extracting structured information about the place’s address: for example, finding the city that a place is in.

    These components should not be used for address formatting. If a formatted address is required, use the formattedAddress property.

    Declaration

    Swift

    var addressComponents: [AddressComponent]? { get }
  • The data provider attribution string for this place.

    These are provided as an AttributedString, which may contain hyperlinks to the website of each provider.

    In general, these must be shown to the user if data from this Place is shown, as described in the Places SDK Terms of Service.

    Declaration

    Swift

    var attributions: AttributedString? { get }
  • The BusinessStatus of the place.

    Declaration

    Swift

    var businessStatus: BusinessStatus { get }
  • Returns this place’s hours of operation over the next seven days.

    The time period starts at midnight on the date of the request and ends at 11:59 pm six days later.

    SpecialDay entries on OpeningHours will only be present for Place currentOpeningHours and Place secondaryOpeningHours.

    Declaration

    Swift

    var currentOpeningHours: OpeningHours? { get }
  • Returns an array of this place’s secondary hour(s) of operation over the next seven days.

    Secondary hours are different from a business’s main hours. For example, a restaurant can specify drive through hours or delivery hours as its secondary hours.

    See HoursType for the different types of secondary hours.

    SpecialDay entries on OpeningHours will only be present for Place currentOpeningHours and Place currentSecondaryOpeningHours.

    Declaration

    Swift

    var currentSecondaryOpeningHours: [OpeningHours]? { get }
  • A textual representation of this instance.

    Calling this property directly is discouraged. Instead, convert an instance of any type to a string by using the String(describing:) initializer. This initializer works with any type, and uses the custom description property for types that conform to CustomStringConvertible:

    struct Point: CustomStringConvertible {
        let x: Int, y: Int
    
        var description: String {
            return "(\(x), \(y))"
        }
    }
    
    let p = Point(x: 21, y: 30)
    let s = String(describing: p)
    print(s)
    // Prints "(21, 30)"
    

    The conversion of p to a string in the assignment to s uses the Point type’s description property.

    Declaration

    Swift

    var description: String { get }
  • Name of the place.

    Declaration

    Swift

    var displayName: String? { get }
  • Returns this place’s editorial summary.

    Declaration

    Swift

    var editorialSummary: String? { get }
  • A string containing the human-readable address of this place.

    Often this address is equivalent to the postal address. Note that some countries, such as the United Kingdom, do not allow distribution of true postal addresses due to licensing restrictions.

    The formatted address is logically composed of one or more address components. For example, the address “111 8th Avenue, New York, NY” consists of the following components: “111” (the street number), “8th Avenue” (the route), “New York” (the city) and “NY” (the US state).

    Do not parse the formatted address programmatically. Instead you should use the individual address components, which the API response includes in addition to the formatted address field.

    Declaration

    Swift

    var formattedAddress: String? { get }
  • Undocumented

    Declaration

    Swift

    var hash: Int { get }
  • Hashes the essential components of this value by feeding them into the given hasher.

    Implement this method to conform to the Hashable protocol. The components used for hashing must be the same as the components compared in your type’s == operator implementation. Call hasher.combine(_:) with each of these components.

    Important

    In your implementation of hash(into:), don’t call finalize() on the hasher instance provided, or replace it with a different instance. Doing so may become a compile-time error in the future.

    Declaration

    Swift

    func hash(into hasher: inout Hasher)
  • The hash value.

    Hash values are not guaranteed to be equal across different executions of your program. Do not save hash values to use during a future execution.

    Important

    hashValue is deprecated as a Hashable requirement. To conform to Hashable, implement the hash(into:) requirement instead. The compiler provides an implementation for hashValue for you.

    Declaration

    Swift

    var hashValue: Int { get }
  • Background color of the icon according to Place type, to color the view behind the icon.

    Declaration

    Swift

    var iconBackgroundColor: UIColor? { get }
  • The URL to a PNG icon mask.

    Note

    URL link does not expire and the image size aspect ratio may be different depending on type.

    Declaration

    Swift

    var iconMaskURL: URL? { get }
  • The phone number of this place, in international format.

    i.e. including the country code prefixed with “+”. For example, Google Sydney’s phone number is “+61 2 9374 4000”.

    Declaration

    Swift

    var internationalPhoneNumber: String? { get }
  • Place Attribute indicating place is popular with tourists.

    Declaration

    Swift

    var isReservable: Bool? { get }
  • The data provider attribution string for this place.

    These are provided as a NSAttributedString, which may contain hyperlinks to the website of each provider.

    In general, these must be shown to the user if data from this Place is shown, as described in the Places SDK Terms of Service.

    Declaration

    Swift

    var legacyAttributions: NSAttributedString? { get }
  • The location coordinates of the place.

    The location is not necessarily the center of the Place, or any particular entry or exit point, but some arbitrarily chosen point within the geographic extent of the Place.

    Declaration

    Swift

    var location: CLLocationCoordinate2D { get }
  • Represents how many reviews make up this place’s rating.

    Declaration

    Swift

    var numberOfUserRatings: Int { get }
  • An array of Photo objects representing the photos of the place.

    Declaration

    Swift

    var photos: [Photo]? { get }
  • Place ID of this place.

    Declaration

    Swift

    var placeID: String? { get }
  • The Plus code representation of location for this place.

    Declaration

    Swift

    var plusCode: PlusCode? { get }
  • Price level for this place.

    Declaration

    Swift

    var priceLevel: PriceLevel { get }
  • Five-star rating for this place based on user reviews.

    Ratings range from 1.0 to 5.0. nil if we have no rating for this place (e.g. because not enough users have reviewed this place).

    Declaration

    Swift

    var rating: Float? { get }
  • The normal business Opening Hours information for this place.

    Includes open status, periods and weekday text when available.

    Declaration

    Swift

    var regularOpeningHours: OpeningHours? { get }
  • An array of Reviews representing the user reviews of the place.

    Declaration

    Swift

    var reviews: [Review] { get }
  • Place Attribute indicating place serves beer.

    Declaration

    Swift

    var servesBeer: Bool? { get }
  • Place Attribute indicating place serves breakfast.

    Declaration

    Swift

    var servesBreakfast: Bool? { get }
  • Place Attribute indicating place serves brunch.

    Declaration

    Swift

    var servesBrunch: Bool? { get }
  • Place Attribute indicating place serves dinner.

    Declaration

    Swift

    var servesDinner: Bool? { get }
  • Place Attribute indicating place serves lunch.

    Declaration

    Swift

    var servesLunch: Bool? { get }
  • Place Attribute indicating place serves vegetarian food.

    Declaration

    Swift

    var servesVegetarianFood: Bool? { get }
  • Place Attribute indicating place serves wine.

    Declaration

    Swift

    var servesWine: Bool? { get }
  • Place Attribute for curbside pickup services.

    Declaration

    Swift

    var supportsCurbsidePickup: Bool? { get }
  • Place Attribute for delivery services.

    Declaration

    Swift

    var supportsDelivery: Bool? { get }
  • Place Attribute for dine in experience.

    Declaration

    Swift

    var supportsDineIn: Bool? { get }
  • Place Attribute for takeout experience.

    Declaration

    Swift

    var supportsTakeout: Bool? { get }
  • The timezone UTC offset of the place in minutes.

    Declaration

    Swift

    var timeZone: TimeZone? { get }
  • The types of this place.

    Types are PlaceType, whose raw string values are any types documented at https://developers.google.com/places/ios-sdk/supported_types.

    Declaration

    Swift

    var types: Set<PlaceType> { get }
  • The recommended viewport for this place. May be nil if the size of the place is not known.

    This returns a viewport of a size that is suitable for displaying this place. For example, a Place object representing a store may have a relatively small viewport, while a Place object representing a country may have a very large viewport.

    Declaration

    Swift

    var viewportInfo: RectangularCoordinateRegion? { get }
  • The website for this place.

    Declaration

    Swift

    var websiteURL: URL? { get }