Skip to content

Instantly share code, notes, and snippets.

@kbinani
Created February 23, 2018 08:06
Show Gist options
  • Save kbinani/b589d9fdf603e9eaa555f0352b44f637 to your computer and use it in GitHub Desktop.
Save kbinani/b589d9fdf603e9eaa555f0352b44f637 to your computer and use it in GitHub Desktop.
enum CGContextType : Int {
case unknown
case pdf
case postscript
case window
case bitmap
case gl
case displaylist
case kseparation
case iosurface
}
extension CGContextType : CustomDebugStringConvertible {
var debugDescription: String {
switch self {
case .unknown:
return "unknown"
case .pdf:
return "pdf"
case .postscript:
return "postscript"
case .window:
return "window"
case .bitmap:
return "bitmap"
case .gl:
return "gl"
case .displaylist:
return "displaylist"
case .kseparation:
return "kseparation"
case .iosurface:
return "iosurface"
}
}
}
@_silgen_name("CGContextGetType") func CGContextGetType(_ ctx: CGContext) -> CGContextType
extension CGContext {
var type: CGContextType {
return CGContextGetType(self)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment