Created
January 1, 2017 04:54
-
-
Save simonbromberg/b01e61e06f92c8290188dc2cf7b4a528 to your computer and use it in GitHub Desktop.
Extension for getting string of class name in Swift (could extend any type of class really, perhaps even AnyObject); replacement for NSStringFromClass() in Objective C
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
import Foundation | |
extension NSObject { | |
var className: String { | |
return String(describing: type(of: self)) | |
} | |
class var className: String { | |
return String(describing: self) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment