Removing extra cell lines in a UITableView
Using Swift 5!
In this quick & short article, I will show you how to remove those extra lines, or you could say those “extra UITableViewCells”, from your UITableView. Keep in mind, this totally depends on how you like to design your Table View. So then, let’s proceed!
1. Creating an Extension
I find that creating extensions in our code base just helps a ton since it has the ability to have a better and organized code base and that you can extend functionalities to an existing class. Therefore, create a new file, for now I am calling it: “UITableView+Ext” or just name it whatever you want, and add these few lines of code.
2. Putting it into action
I am going to assume that you know how to setup a UITableView (with it’s delegate and dataSource protocols). So by creating a function, we can the add the logic to configure the table view.
3. And that’s it!
Just in case, here are some images for visual examples and the code snippets for you “copy & pasters” 😉
I hope that helps you out with your current or future projects! Thank you so much for your time into reading this article! 😁
Happy Coding!