diff --git a/Demo/ViewController.swift b/Demo/ViewController.swift index f9ec1e63..09d1ea10 100644 --- a/Demo/ViewController.swift +++ b/Demo/ViewController.swift @@ -178,8 +178,8 @@ class ViewController: UIViewController { self?.chooseArticleButton.setTitle(item, for: .normal) } - chooseArticleDropDown.multiSelectionAction = { [weak self] (indices, items) in - print("Muti selection action called with: \(items)") + chooseArticleDropDown.multiSelectionAction = { [weak self] (lastClickedIndex,indices, items) in + print("Muti selection action called with: \(items) & last clicked index : \(lastClickedIndex)") if items.isEmpty { self?.chooseArticleButton.setTitle("", for: .normal) } diff --git a/DropDown/src/DropDown.swift b/DropDown/src/DropDown.swift index a1b6b39e..e031990f 100644 --- a/DropDown/src/DropDown.swift +++ b/DropDown/src/DropDown.swift @@ -11,7 +11,7 @@ import UIKit public typealias Index = Int public typealias Closure = () -> Void public typealias SelectionClosure = (Index, String) -> Void -public typealias MultiSelectionClosure = ([Index], [String]) -> Void +public typealias MultiSelectionClosure = (Int,[Index], [String]) -> Void public typealias ConfigurationClosure = (Index, String) -> String public typealias CellConfigurationClosure = (Index, String, DropDownCell) -> Void private typealias ComputeLayoutTuple = (x: CGFloat, y: CGFloat, width: CGFloat, offscreenHeight: CGFloat) @@ -1038,7 +1038,7 @@ extension DropDown: UITableViewDataSource, UITableViewDelegate { let selectedRowIndicesArray = Array(selectedRowIndices) let selectedRows = selectedRowIndicesArray.map { dataSource[$0] } - multiSelectionCallback(selectedRowIndicesArray, selectedRows) + multiSelectionCallback(selectedRowIndex,selectedRowIndicesArray, selectedRows) return } else { @@ -1048,7 +1048,7 @@ extension DropDown: UITableViewDataSource, UITableViewDelegate { let selectedRows = selectedRowIndicesArray.map { dataSource[$0] } selectionAction?(selectedRowIndex, dataSource[selectedRowIndex]) - multiSelectionCallback(selectedRowIndicesArray, selectedRows) + multiSelectionCallback(selectedRowIndex,selectedRowIndicesArray, selectedRows) tableView.reloadData() return }