Problem: I had tried the following code for tableview header for cell reused but sometimes the header disappears. func tableView ( _ tableView: UITableView , viewForHeaderInSection section: Int ) -> UIView ? { let myCell = table . dequeueReusableCell ( w ithIdentifier : " my Cell " ) as ! my Cell return myCell } Solution: You can use the below code to solve the issue. func tableView ( _ tableView: UITableView , viewForHeaderInSection section: Int ) -> UIView ? { let myCell = table . dequeueReusableCell ( w ithIdentifier : " my Cell " ) as ! my Cell return myCell. contentView // This line changes for solving }