Skip to content

Instantly share code, notes, and snippets.

@JoshuaSullivan
Created December 3, 2018 17:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshuaSullivan/7b01141fe82c308519ee537d9120cc70 to your computer and use it in GitHub Desktop.
Save JoshuaSullivan/7b01141fe82c308519ee537d9120cc70 to your computer and use it in GitHub Desktop.
An extension on `UIImage.Orientation` to convert it to the corresponding `CGImagePropertyOrientation` case.
extension UIImage.Orientation {
/// Get the equivalent `CGImagePropertyOrientation` enum case.
var cgOrientation: CGImagePropertyOrientation {
switch self {
case .up: return .up
case .down: return .down
case .left: return .left
case .right: return .right
case .upMirrored: return .upMirrored
case .downMirrored: return .downMirrored
case .leftMirrored: return .leftMirrored
case .rightMirrored: return .rightMirrored
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment