Skip to content

Instantly share code, notes, and snippets.

@zakbarlow1995
Last active August 6, 2019 14:23
Show Gist options
  • Save zakbarlow1995/d7e3a1263a29ea2f55370f51ea3bd424 to your computer and use it in GitHub Desktop.
Save zakbarlow1995/d7e3a1263a29ea2f55370f51ea3bd424 to your computer and use it in GitHub Desktop.
Added an areEmptyRowsHidden property to UITableView: if set to true, hides the empty cells at the bottom of a table view by adding a view with a height of zero as a footer.
import UIKit
extension UITableView {
@IBInspectable var areEmptyRowsHidden: Bool {
set {
tableFooterView = newValue ? UIView(frame: .zero) : nil
}
get {
return tableFooterView != nil
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment