Last active
August 2, 2017 14:05
-
-
Save Daemon-Devarshi/266c33e982899956ebcd257223949ef2 to your computer and use it in GitHub Desktop.
A protocol to be used to avoid hardcoding of reuse identifier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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