From 546f779373d1a46d4bf1ec5af83e8f766ec6e945 Mon Sep 17 00:00:00 2001 From: Hristo Staykov Date: Tue, 22 Oct 2024 15:54:29 -0700 Subject: [PATCH] Make RecurrenceRule and its friends conform to Hashable As agreed in SF-0010. Resolves rdar://136704624 --- .../FoundationEssentials/Calendar/RecurrenceRule.swift | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/FoundationEssentials/Calendar/RecurrenceRule.swift b/Sources/FoundationEssentials/Calendar/RecurrenceRule.swift index b9ebb6dfd..98fa4db53 100644 --- a/Sources/FoundationEssentials/Calendar/RecurrenceRule.swift +++ b/Sources/FoundationEssentials/Calendar/RecurrenceRule.swift @@ -109,7 +109,7 @@ extension Calendar { public var interval: Int /// When a recurring event stops recurring public struct End: Sendable, Equatable { - private enum _End: Equatable { + private enum _End: Equatable, Hashable { case never case afterDate(Date) case afterOccurrences(Int) @@ -449,7 +449,7 @@ extension Calendar.RecurrenceRule: Codable { } @available(FoundationPreview 6.0.2, *) -extension Calendar.RecurrenceRule.End: CustomStringConvertible { +extension Calendar.RecurrenceRule.End: CustomStringConvertible, Hashable { public var description: String { switch self._guts { case .never: "Never" @@ -458,3 +458,9 @@ extension Calendar.RecurrenceRule.End: CustomStringConvertible { } } } +@available(FoundationPreview 6.0.2, *) +extension Calendar.RecurrenceRule.Month: Hashable { } +@available(FoundationPreview 6.0.2, *) +extension Calendar.RecurrenceRule.Weekday: Hashable { } +@available(FoundationPreview 6.0.2, *) +extension Calendar.RecurrenceRule: Hashable { }