From e05eb6e60c37ec56b516d3dc7407129c2b627f5c Mon Sep 17 00:00:00 2001 From: Brent Simmons Date: Tue, 21 May 2019 22:23:26 -0700 Subject: [PATCH] =?UTF-8?q?Use=20=3D=3D=20instead=20of=20=3D=3D=3D=20when?= =?UTF-8?q?=20comparing=20feeds=20in=20the=20sidebar=20=E2=80=94=C2=A0you?= =?UTF-8?q?=20might=20have=20duplicate=20feeds.=20(Duplicate=20feeds=20are?= =?UTF-8?q?=20totally=20allowed.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sidebar/SidebarViewController.swift | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Mac/MainWindow/Sidebar/SidebarViewController.swift b/Mac/MainWindow/Sidebar/SidebarViewController.swift index 748aedc6c..7b5e64f85 100644 --- a/Mac/MainWindow/Sidebar/SidebarViewController.swift +++ b/Mac/MainWindow/Sidebar/SidebarViewController.swift @@ -581,9 +581,8 @@ private extension SidebarViewController { } func applyToCellsForRepresentedObject(_ representedObject: AnyObject, _ callback: (SidebarCell, Node) -> Void) { - applyToAvailableCells { (cell, node) in - if node.representedObject === representedObject { + if node.representsSidebarObject(representedObject) { callback(cell, node) } } @@ -607,3 +606,15 @@ private extension SidebarViewController { } +private extension Node { + + func representsSidebarObject(_ object: AnyObject) -> Bool { + if representedObject === object { + return true + } + if let feed1 = object as? Feed, let feed2 = representedObject as? Feed { + return feed1 == feed2 + } + return false + } +}