Skip to content

Instantly share code, notes, and snippets.

@Daemon-Devarshi
Last active August 2, 2017 14:05
Show Gist options
  • Save Daemon-Devarshi/266c33e982899956ebcd257223949ef2 to your computer and use it in GitHub Desktop.
Save Daemon-Devarshi/266c33e982899956ebcd257223949ef2 to your computer and use it in GitHub Desktop.
A protocol to be used to avoid hardcoding of reuse identifier
protocol Reusable: class {
static var reuseIdentifier: String { get }
}
extension Reusable {
static var reuseIdentifier: String {
// I like to use the class's name as an identifier
// so this makes a decent default value.
return String(describing: self)
}
}
// Uncomment for Global Confirmance
// extension UITableViewCell: Reusable { }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment