Skip to content

Instantly share code, notes, and snippets.

@AlexPinhasov
Created July 1, 2020 15:36
Show Gist options
  • Save AlexPinhasov/6aa2d3ec6fc6476ee846ee73f9257e76 to your computer and use it in GitHub Desktop.
Save AlexPinhasov/6aa2d3ec6fc6476ee846ee73f9257e76 to your computer and use it in GitHub Desktop.
protocol ObjectInfoable: NSObjectProtocol {}
extension ObjectInfoable {
static var fileName: String {
return String(describing: Self.self)
}
}
extension ObjectInfoable where Self: UIView {
static var nibName: UINib {
return UINib(nibName: fileName, bundle: nil)
}
static var reuseIdentifier: String {
return self.fileName
}
}
extension NSObject: ObjectInfoable {}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment