bCM bCM - 2 months ago 12x
Swift Question

Deselect Tablerow remove indexrow

When I select multiple rows they should add in the array with a maximum size of 2.

For example I select row 1 and 2 with names "A" and "B". If I deselect "A" I want the array to remove the value.

I select
["A", "B"]

I decide to deselect "A" then it should remove A from the array ["B"]

var rows: [String] = []

func tableView(tableView: UITableView, willSelectRowAtIndexPath indexPath: NSIndexPath) -> NSIndexPath? {

func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {

extension Array where Element: Equatable {
func remove(e: Element) {
// Iam stuck here


Here Is What You Want:

extension Array where Element: Equatable {

    mutating func remove(e: Element) {
        if let i = self.indexOf(e) {