Skip to content

Instantly share code, notes, and snippets.

@bmoliveira
Last active May 10, 2016 10:29
Show Gist options
  • Save bmoliveira/93a0c37d96c01aba4418 to your computer and use it in GitHub Desktop.
Save bmoliveira/93a0c37d96c01aba4418 to your computer and use it in GitHub Desktop.
Reusable UICollectionViewCell
extension ReusableCell where Self: UICollectionViewCell {
static func uiNibFromClass() -> UINib? {
return UINib(nibName: Self.className, bundle: nil)
}
static func reuseIdentifier() -> String? {
return Self.className
}
}
extension NSObject {
/// Returns the className for the Class, removing the project namespace.
static var className: String {
return NSStringFromClass(self).componentsSeparatedByString(".").last ?? NSStringFromClass(self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment