Last active
May 10, 2016 10:29
-
-
Save bmoliveira/93a0c37d96c01aba4418 to your computer and use it in GitHub Desktop.
Reusable UICollectionViewCell
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
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