How to pin to top in a TableView in Swift?

1.5k views Asked by At

I have a tableView with hundreds of cells. I want to add a feature to pin to top favorite cells, for example by swipe. Is there a way to do that? Or is it easier to have a different tableView with favorite cells?

1

There are 1 answers

1
Ankur Lahiry On

Section for this.

Add your favorites to view, you can create it using storyboard or programmatically using following code. If you use storyboard, create and make a reference to the tableViewController and just return in this code.

override func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView?
{
   // create and return yourView
}