From 30cf8c6a0838cba680cd4e0ab0b5cf07f5408276 Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Sat, 1 Feb 2020 15:00:36 -0800 Subject: [PATCH] Add, as a micro-optimization, a custom hash function for FeedIdentifier. --- Frameworks/Account/FeedIdentifier.swift | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Frameworks/Account/FeedIdentifier.swift b/Frameworks/Account/FeedIdentifier.swift index 1bd3230d7..eed0a7555 100644 --- a/Frameworks/Account/FeedIdentifier.swift +++ b/Frameworks/Account/FeedIdentifier.swift @@ -79,5 +79,19 @@ public enum FeedIdentifier: CustomStringConvertible, Hashable { return nil } } - + + // MARK: - Hashable + + public func hash(into hasher: inout Hasher) { + switch self { + case .smartFeed(let id): + hasher.combine(id) + case .script(let id): + hasher.combine(id) + case .webFeed(_, let webFeedID): + hasher.combine(webFeedID) + case .folder(_, let folderName): + hasher.combine(folderName) + } + } }