[Solved] Checking if TableView row was selected for the first time


You can maintain a set like this.

var selectedOnce = Set<Int>()

Add the selected index to this set whenever it is selected first time.

selectedOnce.insert(index)

Check next time, whether it was already selected like

        if selectedOnce.contains(indexToCheck) {

}

If something is required for one time per app. I mean, it should not happen for next launches of the app you can use user defaults. Set the key to true for first time

 UserDefaults.standard.set(true, forKey: "alreadyClicked")

Check for the key to know whether something user has already done in previous launches like this

if UserDefaults.standard.bool(forKey: "alreadyClicked") {

}

User defaults persist between app launches.
Hope that helps.

2

solved Checking if TableView row was selected for the first time