If you set datasource at the beginning when your view loads it starts view with empty state and then loads data which is not quite right. To avoid this I am setting datasource once I have data ready to load So that time either it shows data or empty state.
tableView.emptyDataSetDataSource = self
tableView.updateEmptyDataSetIfNeeded() IMP - Need to call this after setting data source.