Skip to content

Instantly share code, notes, and snippets.

@eilonkr
Created May 13, 2022 21:35
Show Gist options
  • Save eilonkr/5d879e9ab177968cb689424911795f7f to your computer and use it in GitHub Desktop.
Save eilonkr/5d879e9ab177968cb689424911795f7f to your computer and use it in GitHub Desktop.
extension CGImagePropertyOrientation {
init(_ uiOrientation: UIImage.Orientation) {
switch uiOrientation {
case .up: self = .up
case .upMirrored: self = .upMirrored
case .down: self = .down
case .downMirrored: self = .downMirrored
case .left: self = .left
case .leftMirrored: self = .leftMirrored
case .right: self = .right
case .rightMirrored: self = .rightMirrored
@unknown default: self = .up
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment