OpeningHours

public struct OpeningHours

Defines the OpeningHours of a POI.

Important

This is a Public Preview API. It may be changed or removed at any time.

Lifecycle

  • Create new instance of OpeningHours.

    Declaration

    Swift

    public init(mode: OpeningHoursMode, timeRanges: [ClosedRange<Date>])

    Parameters

    mode

    describes the scope of timeRanges.

    timeRanges

    A sorted series of date ranges starting from today in the POI local time

Public

  • Describes the scope of timeRanges (e.g. the .nextSevenDays mode means that timeRanges property contains the time ranges that cover only that period - 7 days starting from today in the POI local time).

    Declaration

    Swift

    public let mode: OpeningHoursMode
  • A sorted series of date ranges starting from today in the POI local time.

    Note

    The sequence is sorted with the closest dates first.

    Declaration

    Swift

    public let timeRanges: [ClosedRange<Date>]
  • Defines if the POI is open at the specified date.

    Note

    throws an error if the given date is out of the provided opening hours scope

    Declaration

    Swift

    public func isOpen(at date: Date) throws -> Bool

    Parameters

    date

    specifies the day and time for which opening hours are checked

    Return Value

    true if the POI is open at the given date, false otherwise.

  • Defines the opening hours related to the specific day in the POI local time

    Note

    throws an error if the given date is out of the provided opening hours scope

    Declaration

    Swift

    public func openingHours(for date: Date) throws -> [ClosedRange<Date>]

    Parameters

    date

    specified the day for which the opening hours returned.

    Return Value

    a sorted series of date ranges for the given day in the POI local time