Swift IndexPath counting continuous over multiple sections?

I have multiple sections in a UITableView. I am using the IndexPath of the cells to set some values. What I am asking is if at the start of a new section, the counting of the IndexPaths restarts to zero. Any help is greatly appreciated. Thanks!


it does. If you implement the basic example below, you'll see how the row index restarts from 0 in each section

class ViewController: UIViewController, UITableViewDelegate, UITableViewDataSource {
    @IBOutlet var myTableView: UITableView!

    let myDataSource = ["Andrew", "Anthony", "Bill", "Brad", "Charlie", "Craig"]

    override func viewDidLoad() {

        myTableView.delegate = self
        myTableView.dataSource = self

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        let cell = tableView.dequeueReusableCell(withIdentifier: "myCell", for: indexPath) as! MyTableViewCell

        cell.myCellLabel.text = myDataSource[indexPath.row + indexPath.section*2] + "  [Row = \(indexPath.row), Section = \(indexPath.section)]"
        return cell

    func numberOfSections(in tableView: UITableView) -> Int {
        return 3

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        return 2

    func tableView(_ tableView: UITableView, titleForHeaderInSection section: Int) -> String? {

        var title = ""
        switch section {
        case 0:
            title = "A"
        case 1:
            title = "B"
        case 2:
            title = "C"

        return title



 ? How to draw segments (geom_segment) dynamically in R ggplot?
 ? How to create C# dynamic object?
 ? How can I move my labels to the right with CSS?
 ? Javafx I want to remove the dynamic element in Accordion
 ? Dynamic MVC Model Server side validation
 ? laravel 5.4 dynamic database connection
 ? How to initialize a char array as null within a default constructor?
 ? Java Play Framework creating logged in navigation bar - inserting dynamic html in scala template
 ? Dynamic search and filtering in Excel
 ? Dynamic TableView Swift 3 With Beginning Graph