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.
Contains all Periods of open and close events for the week.
Note
Multiple periods can be associated with a day (eg. Monday 7am - Monday 2pm, Monday
5pm - Monday 10pm). Periods may also span multiple days (eg Friday 7pm - Saturday 2am).
[[["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\u003eOpeningHours\u003c/code\u003e stores and manages opening hours information for Google Places.\u003c/p\u003e\n"],["\u003cp\u003eIt provides properties like \u003ccode\u003eperiods\u003c/code\u003e, \u003ccode\u003eweekdayText\u003c/code\u003e, and \u003ccode\u003especialDays\u003c/code\u003e for detailed hour data.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eOpeningHours\u003c/code\u003e conforms to \u003ccode\u003eCustomStringConvertible\u003c/code\u003e, \u003ccode\u003eEquatable\u003c/code\u003e, and \u003ccode\u003eHashable\u003c/code\u003e protocols.\u003c/p\u003e\n"],["\u003cp\u003eYou can create an \u003ccode\u003eOpeningHours\u003c/code\u003e instance using a JSON dictionary or access it from a \u003ccode\u003ePlace\u003c/code\u003e object.\u003c/p\u003e\n"]]],["The `OpeningHours` type manages a place's operational hours, supporting string conversion, equality checks, and hashing. It stores data like `hoursType`, `periods` (open/close times), `specialDays` (deviating hours), and `weekdayText` (daily hour strings). The data can be provided using `jsonDictionary` for testing. It can be compared using the `==` operator and uses `hash(into:)` and `hashValue` to be hashable.\n"],null,["# GooglePlacesSwift Framework Reference\n\nOpeningHours\n============\n\n struct OpeningHours\n\n extension OpeningHours : Copyable, CustomStringConvertible, Equatable, Escapable, Hashable, Sendable\n\nA type to handle storing and accessing opening hours information for [Place](../Structs/Place.html).\n- `\n ``\n ``\n `\n\n ### [==(_:_:)](#/s:17GooglePlacesSwift12OpeningHoursV2eeoiySbAC_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 == (lhs: OpeningHours, rhs: OpeningHours) -\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:17GooglePlacesSwift12OpeningHoursV11descriptionSSvp)\n\n `\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\n Swift \n\n var description: String { get }\n\n- `\n ``\n ``\n `\n\n ### [hash(into:)](#/s:17GooglePlacesSwift12OpeningHoursV4hash4intoys6HasherVz_tF)\n\n `\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\n Swift \n\n func hash(into hasher: inout Hasher)\n\n- `\n ``\n ``\n `\n\n ### [hashValue](#/s:17GooglePlacesSwift12OpeningHoursV9hashValueSivp)\n\n `\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/OpeningHours.html#/s:17GooglePlacesSwift12OpeningHoursV4hash4intoys6HasherVz_tF) requirement instead. The compiler provides an implementation for `hashValue` for you. \n\n #### Declaration\n\n Swift \n\n var hashValue: Int { get }\n\n- `\n ``\n ``\n `\n\n ### [hoursType](#/s:17GooglePlacesSwift12OpeningHoursV9hoursTypeAA0eG0OSgvp)\n\n `\n ` \n Returns the [HoursType](../Enums/HoursType.html) of the opening hours. \n\n #### Declaration\n\n Swift \n\n var hoursType: ../Enums/HoursType.html? { get }\n\n- `\n ``\n ``\n `\n\n ### [init(jsonDictionary:)](#/s:17GooglePlacesSwift12OpeningHoursV14jsonDictionaryACSDySSypG_tcfc)\n\n `\n ` \n Instantiates an `OpeningHours` with the specified information.\n\n `OpeningHours`s can be gotten from a [Place](../Structs/Place.html) object. This initializer can be used for\n testing.\n\n Example: \n\n let openingHoursDict = [\n \"open_now\": true,\n \"periods\": [\n [\n \"close\": [\"day\": 1, \"time\": \"1730\"],\n \"open\": [\"day\": 1, \"time\": \"0830\"],\n ],\n [\n \"close\": [\"day\": 4, \"time\": \"1930\"],\n \"open\": [\"day\": 4, \"time\": \"0730\"],\n ],\n ]\n\n #### Declaration\n\n Swift \n\n init(jsonDictionary: [String : Any])\n\n- `\n ``\n ``\n `\n\n ### [periods](#/s:17GooglePlacesSwift12OpeningHoursV7periodsSayAA6PeriodVGvp)\n\n `\n ` \n Contains all [Period](../Structs/Period.html)s of open and close events for the week. \n Note\n Multiple periods can be associated with a day (eg. Monday 7am - Monday 2pm, Monday 5pm - Monday 10pm). Periods may also span multiple days (eg Friday 7pm - Saturday 2am). \n\n #### Declaration\n\n Swift \n\n var periods: [../Structs/Period.html] { get }\n\n- `\n ``\n ``\n `\n\n ### [specialDays](#/s:17GooglePlacesSwift12OpeningHoursV11specialDaysSayAA10SpecialDayVGvp)\n\n `\n ` \n Returns a list of [SpecialDay](../Structs/SpecialDay.html) entries, corresponding to the next\n seven days which may have opening hours that differ from the normal operating hours. \n\n #### Declaration\n\n Swift \n\n var specialDays: [../Structs/SpecialDay.html] { get }\n\n- `\n ``\n ``\n `\n\n ### [weekdayText](#/s:17GooglePlacesSwift12OpeningHoursV11weekdayTextSaySSGvp)\n\n `\n ` \n Contains localized strings of the daily opening hours for the week. \n Note\n The order of the text depends on the language and may begin on Monday or Sunday. Do not use the [DayOfWeek](../Enums/DayOfWeek.html)\\` enum to index into the array. \n\n #### Declaration\n\n Swift \n\n var weekdayText: [String] { get }"]]