Modifications to the > layout engine must not be performed from a background thread after it has been accessed from the main thread

Your network fetch code is almost right – you are reloading the table on the main queue but not stopping the activity indicator.

You just need to move that line inside the closure:

let downloadedData_user = try decoder.decode(Top_us.self, from: data)
    self.Top_Search = downloadedData_user.users
    DispatchQueue.main.async {
        self.tableView.reloadData()
        self.Indicator.stopAnimating()
    }

Note that by convention, properties should start with a lower case letter while classes should start with an upper case letter. Both should use camelCase, so Top_Search should be topSearch, Top_us should be TopUsers and Indicator should be indicator.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)