iOS code assistance need

I trying to reuse some of Kai’s code but I’m running into an issue with this code specifically.

runAfterDelay(2) {
            self.tableView.reloadData()
        }

Full code below:

Sometimes the code fails to return all devices attached to an account. Is there a better way to make this network call?