Repository: Automattic/pocket-casts-ios
File: podcasts/PodcastViewController+TableData.swift (Swift)

Code before:
            }

            var sectionCount = 1 // Always show header section
            if (recommendations?.podroll?.count ?? 0) > 0 {
                sectionCount += 1 // Add podroll section if it has content
            }
            if (recommendations?.podcasts?.count ?? 0) > 0 {
                sectionCount += 1 // Add podcasts section if it has content
            }
            return sectionCount
        }
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if loadingPodcastInfo { return 0 }

        switch currentViewMode {
        case .episodes:
            return episodeInfo[safe: section]?.elements.count ?? 0
        case .bookmarks:
            return 0
        case .youMightLike:
            switch youMightLikeSectionType(for: section) {
            case .header:
                return 1
            case .loading:
                return 1
            case .empty:
                return 1
            case .podroll:
                return recommendations?.podroll?.count ?? 0
            case .podcasts:
                return recommendations?.podcasts?.count ?? 0
            }
        }
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        switch currentViewMode {
        case .episodes:
            if indexPath.section == PodcastViewController.headerSection {
                if FeatureFlag.podcastViewChanges.enabled {
                    let cell = podcastHeaderCell
                    return cell
                } else {
                    let cell = podcastHeadingCell
                    cell.populateFrom(tintColor: podcast?.iconTintColor(), delegate: self, parentController: self)
                    cell.buttonsEnabled = !isMultiSelectEnabled
                    return cell
                }
            }

Review comment (suggestion):
can these be grouped?
```
case .header, .loading, .empty: return 1
...
```

Code after:
            }

            var sectionCount = 1 // Always show header section
            if (recommendations?.podroll?.count ?? 0) > 0 {
                sectionCount += 1 // Add podroll section if it has content
            }
            if (recommendations?.podcasts?.count ?? 0) > 0 {
                sectionCount += 1 // Add podcasts section if it has content
            }
            return sectionCount
        }
    }

    func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
        if loadingPodcastInfo { return 0 }

        switch currentViewMode {
        case .episodes:
            return episodeInfo[safe: section]?.elements.count ?? 0
        case .bookmarks:
            return 0
        case .youMightLike:
            switch youMightLikeSectionType(for: section) {
            case .header, .loading, .empty:
                return 1
            case .podroll:
                return recommendations?.podroll?.count ?? 0
            case .podcasts:
                return recommendations?.podcasts?.count ?? 0
            }
        }
    }

    func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
        switch currentViewMode {
        case .episodes:
            if indexPath.section == PodcastViewController.headerSection {
                if FeatureFlag.podcastViewChanges.enabled {
                    let cell = podcastHeaderCell
                    return cell
                } else {
                    let cell = podcastHeadingCell
                    cell.populateFrom(tintColor: podcast?.iconTintColor(), delegate: self, parentController: self)
                    cell.buttonsEnabled = !isMultiSelectEnabled
                    return cell
                }
            }

            guard let itemAtRow = episodeInfo[safe: indexPath.section]?.elements[safe: indexPath.row] as? ListItem else {
                FileLog.shared.addMessage("EpisodeInfo missing ListItem in section \(indexPath.section), row \(indexPath.row)")
                return UITableViewCell()