bCM bCM - 1 year ago 146
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

Answer Source

Here Is What You Want:

extension Array where Element: Equatable {

    mutating func remove(e: Element) {
        if let i = self.indexOf(e) {
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download