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:
structPoint:CustomStringConvertible{letx:Int,y:Intvardescription:String{return"(\(x), \(y))"}}letp=Point(x:21,y:30)lets=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.
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.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-28 UTC."],[[["\u003cp\u003e\u003ccode\u003eAddressComponent\u003c/code\u003e represents parts of an address like street number, city, or postcode.\u003c/p\u003e\n"],["\u003cp\u003eIt conforms to \u003ccode\u003eCustomStringConvertible\u003c/code\u003e, \u003ccode\u003eEquatable\u003c/code\u003e, and \u003ccode\u003eHashable\u003c/code\u003e for textual representation, comparison, and hashing.\u003c/p\u003e\n"],["\u003cp\u003eProperties include \u003ccode\u003ename\u003c/code\u003e, \u003ccode\u003eshortName\u003c/code\u003e, and \u003ccode\u003etypes\u003c/code\u003e to describe the address component.\u003c/p\u003e\n"],["\u003cp\u003eIt can be initialized with types, name, and an optional short name.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAddressComponent\u003c/code\u003e instances are typically obtained from a \u003ccode\u003ePlace\u003c/code\u003e object.\u003c/p\u003e\n"]]],["The `AddressComponent` struct represents a part of an address. It stores the component's `name`, optional `shortName`, and associated `types`. Key actions include initializing an `AddressComponent` with specific information, checking if two components are equal using the `==` operator, and providing a string representation via the `description` property. The struct also implements `Hashable`, enabling hash value computation via `hash(into:)`. This struct can be utilized for testing or obtained through a `Place` object.\n"],null,["AddressComponent \n\n struct AddressComponent\n\n extension AddressComponent : Copyable, CustomStringConvertible, Equatable, Escapable, Hashable, Sendable\n\nRepresents a component of an address, e.g., street number, postcode, city, etc.\n- `\n ``\n ``\n `\n\n [==(_:_:)](#/s:17GooglePlacesSwift16AddressComponentV2eeoiySbAC_ACtFZ)`\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 Swift \n\n static func == (lhs: AddressComponent, rhs: AddressComponent) -\u003e Bool\n\n Parameters\n\n |-------------|---------------------------|\n | ` `*lhs*` ` | A value to compare. |\n | ` `*rhs*` ` | Another value to compare. |\n\n- `\n ``\n ``\n `\n\n [description](#/s:17GooglePlacesSwift16AddressComponentV11descriptionSSvp)`\n ` \n A textual representation of this instance.\n\n Calling this property directly is discouraged. Instead, convert an\n instance of any type to a string by using the `String(describing:)`\n initializer. This initializer works with any type, and uses the custom\n `description` property for types that conform to\n `CustomStringConvertible`: \n\n struct Point: CustomStringConvertible {\n let x: Int, y: Int\n\n var description: String {\n return \"(\\(x), \\(y))\"\n }\n }\n\n let p = Point(x: 21, y: 30)\n let s = String(describing: p)\n print(s)\n // Prints \"(21, 30)\"\n\n The conversion of `p` to a string in the assignment to `s` uses the\n `Point` type's `description` property. \n\n Declaration \n Swift \n\n var description: String { get }\n\n- `\n ``\n ``\n `\n\n [hash(into:)](#/s:17GooglePlacesSwift16AddressComponentV4hash4intoys6HasherVz_tF)`\n ` \n Hashes the essential components of this value by feeding them into the\n given hasher.\n\n Implement this method to conform to the `Hashable` protocol. The\n components used for hashing must be the same as the components compared\n in your type's `==` operator implementation. Call `hasher.combine(_:)`\n with each of these components. \n Important\n\n In your implementation of `hash(into:)`,\n don't call `finalize()` on the `hasher` instance provided,\n or replace it with a different instance.\n Doing so may become a compile-time error in the future. \n\n Declaration \n Swift \n\n func hash(into hasher: inout Hasher)\n\n- `\n ``\n ``\n `\n\n [hashValue](#/s:17GooglePlacesSwift16AddressComponentV9hashValueSivp)`\n ` \n The hash value.\n\n Hash values are not guaranteed to be equal across different executions of\n your program. Do not save hash values to use during a future execution. \n Important\n `hashValue` is deprecated as a `Hashable` requirement. To conform to `Hashable`, implement the [hash(into:)](../Structs/AddressComponent.html#/s:17GooglePlacesSwift16AddressComponentV4hash4intoys6HasherVz_tF) requirement instead. The compiler provides an implementation for `hashValue` for you. \n\n Declaration \n Swift \n\n var hashValue: Int { get }\n\n- `\n ``\n ``\n `\n\n [init(types:name:shortName:)](#/s:17GooglePlacesSwift16AddressComponentV5types4name9shortNameACShyAA9PlaceTypeVG_S2SSgtcfc)`\n ` \n Instantiates an `AddressComponent` with the specified information.\n\n `AddressComponent`s can be gotten from a [Place](../Structs/Place.html) object. This initializer can be used for\n testing. \n\n Declaration \n Swift \n\n init(types: Set\u003c../Structs/PlaceType.html\u003e, name: String, shortName: String? = nil)\n\n Parameters\n\n |-------------------|------------------------------------------------------------------------------------------------------|\n | ` `*types*` ` | The set of [PlaceType](../Structs/PlaceType.html) that represent the various types of the component. |\n | ` `*name*` ` | The name of the component. |\n | ` `*shortName*` ` | The (optional) short name of the component. Defaults to `nil`. |\n\n Return Value\n\n An `AddressComponent` containing the specified information.\n- `\n ``\n ``\n `\n\n [name](#/s:17GooglePlacesSwift16AddressComponentV4nameSSvp)`\n ` \n Name of the address component, e.g. \"Sydney\" \n\n Declaration \n Swift \n\n var name: String { get }\n\n- `\n ``\n ``\n `\n\n [shortName](#/s:17GooglePlacesSwift16AddressComponentV9shortNameSSSgvp)`\n ` \n Short name of the address component, e.g. \"AU\" \n\n Declaration \n Swift \n\n var shortName: String? { get }\n\n- `\n ``\n ``\n `\n\n [types](#/s:17GooglePlacesSwift16AddressComponentV5typesShyAA9PlaceTypeVGvp)`\n ` \n Types associated with the address component. For a list of supported types, see\n \u003chttps://developers.google.com/places/ios-sdk/supported_types#table2\u003e. This set will contain one\n or more [PlaceType](../Structs/PlaceType.html) defined in PlaceTypes.swift. \n\n Declaration \n Swift \n\n var types: Set\u003c../Structs/PlaceType.html\u003e { get }"]]