Skip to content

Instantly share code, notes, and snippets.

@DungeonDev78
Last active January 9, 2022 10:15
UITableViewSections001.swift
func numberOfSections(in tableView: UITableView) -> Int {
3
}
func tableView(_ tableView: UITableView,
numberOfRowsInSection section: Int) -> Int {
if indexPath.section == 0 {
// return something...
} else if indexPath.section == 1 {
// return something different...
} else if indexPath.section == 2 {
// return something different again...
}
}
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
if indexPath.section == 0 {
// Do stuff...
} else if indexPath.section == 1 {
// Do other stuff...
} else if indexPath.section == 2 {
// Do other different stuff...
}
// ...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment