From 94329c442ab879d16a23413c666093dd9f57a7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ce=CC=81dric=20Foellmi?= Date: Wed, 24 Oct 2018 18:53:30 +0200 Subject: [PATCH] Handling multiple selection --- KPCJumpBarControl/Helpers.swift | 15 +++++++++++++++ KPCJumpBarControl/JumpBarControl.swift | 20 +++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/KPCJumpBarControl/Helpers.swift b/KPCJumpBarControl/Helpers.swift index 4c93c91..8ed9cc3 100644 --- a/KPCJumpBarControl/Helpers.swift +++ b/KPCJumpBarControl/Helpers.swift @@ -37,3 +37,18 @@ internal func >= (lhs: T?, rhs: T?) -> Bool { } } +extension IndexPath { + static func commonAncestor(indexPaths: [IndexPath]) -> IndexPath? { + let shortestLength = indexPaths.reduce(1000) { $0 < $1.count ? $0 : $1.count } + var common = IndexPath() + for index in 0..