Skip to content

Instantly share code, notes, and snippets.

@pxpgraphics
Last active January 3, 2016 20:16
Show Gist options
  • Save pxpgraphics/76784af7e6eb34d4881d to your computer and use it in GitHub Desktop.
Save pxpgraphics/76784af7e6eb34d4881d to your computer and use it in GitHub Desktop.
extension RawRepresentable where RawValue == String {
var description: String {
return rawValue
}
}
extension RawRepresentable where RawValue: CustomStringConvertible {
var description: String {
return rawValue.description
}
}
enum PXPLogLevel: String {
case Debug = "DEBUG"
case Info = "INFO"
case Warn = "WARN"
case Error = "ERROR"
}
@objc
class PXPLogLevelBridge: NSObject {
class func Debug() -> NSString {
return PXPLogLevel.Debug.description
}
class func Info() -> NSString {
return PXPLogLevel.Info.description
}
class func Warn() -> NSString {
return PXPLogLevel.Warn.description
}
class func Error() -> NSString {
return PXPLogLevel.Error.description
}
}
@pxpgraphics
Copy link
Author

NSString *debugRawValue = [PXPLogLevelBridge Debug];
NSLog(@"%@", debugRawValue);
2016-01-03 12:04:04.485 PXPLogLevel[27976:5049936] DEBUG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment