UITableView
extension UITableView
-
Registers a UITableViewCell for use in a UITableView.
By default, the class name of the cell is used as the reuse identifier.
Example:
class CustomCell: UITableViewCell {} let tableView = UITableView() // registers the CustomCell class with a reuse identifier of "CustomCell" tableView.registerCell(CustomCell)Declaration
Swift
public func registerCell<T>(_ type: T.Type, withIdentifier reuseIdentifier: String = String(describing: T.self)) where T : UITableViewCellParameters
typeThe type of cell to register.
reuseIdentifierThe reuse identifier for the cell (optional).
-
Dequeues a UITableViewCell for use in a UITableView.
By default, the class name of the cell is used as the reuse identifier.
Example:
class CustomCell: UITableViewCell {} let tableView = UITableView() // dequeues a CustomCell class let cell = tableView.dequeueReusableCell(CustomCell)Declaration
Swift
public func dequeueCell<T>(_ type: T.Type = T.self, withIdentifier reuseIdentifier: String = String(describing: T.self)) -> T where T : UITableViewCellParameters
typeThe type of the cell.
reuseIdentifierThe reuse identifier for the cell (optional).
Return Value
A force-casted UITableViewCell of the specified type.
-
Dequeues a UITableViewCell for use in a UITableView.
By default, the class name of the cell is used as the reuse identifier.
Example:
class CustomCell: UITableViewCell {} let tableView = UITableView() // dequeues a CustomCell class let cell = tableView.dequeueReusableCell(CustomCell.self, forIndexPath: indexPath)Declaration
Swift
public func dequeueCell<T>(_ type: T.Type = T.self, withIdentifier reuseIdentifier: String = String(describing: T.self), for indexPath: IndexPath) -> T where T : UITableViewCellParameters
typeThe type of the cell.
indexPathThe index path at which to dequeue a new cell.
reuseIdentifierThe reuse identifier for the cell (optional).
Return Value
A force-casted UITableViewCell of the specified type.
-
Inserts rows into self.
Declaration
Swift
public func insert(_ indices: [Int], section: Int = 0, animation: UITableView.RowAnimation = .automatic)Parameters
indicesThe rows indices to insert into self.
sectionThe section in which to insert the rows (optional, defaults to 0).
animationThe animation to use for the row insertion (optional, defaults to
.Automatic). -
Deletes rows from self.
Declaration
Swift
public func delete(_ indices: [Int], section: Int = 0, animation: UITableView.RowAnimation = .automatic)Parameters
indicesThe rows indices to delete from self.
sectionThe section in which to delete the rows (optional, defaults to 0).
animationThe animation to use for the row deletion (optional, defaults to
.Automatic). -
Reloads rows in self.
Declaration
Swift
public func reload(_ indices: [Int], section: Int = 0, animation: UITableView.RowAnimation = .automatic)Parameters
indicesThe rows indices to reload in self.
sectionThe section in which to reload the rows (optional, defaults to 0).
animationThe animation to use for reloading the rows (optional, defaults to
.Automatic).
-
The minimum (
starting
)IndexPathfor traversing aUITableViewsequentially
.Declaration
Swift
public var minimumIndexPath: IndexPath { get } -
The maximum (
ending
)IndexPathfor traversing aUITableViewsequentially
.Declaration
Swift
public var maximumIndexPath: IndexPath { get } -
When
sequentially
traversing aUITableView, what’s the nextIndexPathafter the givenIndexPath.See also
var maximumIndexpathDeclaration
Swift
public func indexPath(after indexPath: IndexPath) -> IndexPath?Parameters
indexPathThe current indexPath; the path we want to find what comes after.
Return Value
The next indexPath, or nil if we’re at the maximumIndexPath
-
When
sequentially
traversing aUITableView, what’s the previousIndexPathbefore the givenIndexPath.See also
var minimumIndexPathDeclaration
Swift
public func indexPath(before indexPath: IndexPath) -> IndexPath?Parameters
indexPathThe current indexPath; the path we want to find what comes before.
Return Value
The prior indexPath, or nil if we’re at the minimumIndexPath
View on GitHub
Install in Dash
UITableView Extension Reference