Skip to content

Commit f24c79a

Browse files
authored
fix: Fix iOS build by restoring UIImage.Orientation references after rename (#3757)
The rename in #3754 (Orientation to CameraOrientation) also replaced references to UIKit's nested UIImage.Orientation enum, which caused iOS builds to fail with: 'CameraOrientation' is not a member type of class 'UIKit.UIImage' UIImage is an Apple UIKit class and its nested enum is literally named Orientation, so the references must remain UIImage.Orientation. UIImageOrientation+exif.swift already uses the correct name, which is how the partial rename was spotted. Affected (8 occurrences across 7 files): - packages/react-native-vision-camera/ios/Extensions/Converters/UI+CameraOrientation.swift (x3) - packages/react-native-vision-camera/ios/Extensions/AVFoundation/AVCapturePhoto+getMediaSampleMetadata.swift - packages/react-native-vision-camera/ios/Extensions/AVFoundation/AVDepthData+toUIImage.swift - packages/react-native-vision-camera/ios/Extensions/CoreMedia/CMSampleBuffer+toUIImage.swift - packages/react-native-vision-camera/ios/Extensions/CIImage+toUIImage.swift - packages/react-native-vision-camera/ios/Public/MediaSampleMetadata.swift - packages/react-native-vision-camera-barcode-scanner/ios/Extensions/UI+CameraOrientation.swift
1 parent 448d7bf commit f24c79a

7 files changed

Lines changed: 9 additions & 9 deletions

File tree

packages/react-native-vision-camera-barcode-scanner/ios/Extensions/UI+CameraOrientation.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import UIKit
88
import VisionCamera
99

1010
extension CameraOrientation {
11-
func toUIImageOrientation(isMirrored: Bool = false) -> UIImage.CameraOrientation {
11+
func toUIImageOrientation(isMirrored: Bool = false) -> UIImage.Orientation {
1212
switch self {
1313
case .up:
1414
return isMirrored ? .upMirrored : .up

packages/react-native-vision-camera/ios/Extensions/AVFoundation/AVCapturePhoto+getMediaSampleMetadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension AVCapturePhoto {
1616
throw RuntimeError.error(
1717
withMessage: "Photo did not contain a `kCGImagePropertyOrientation` metadata key!")
1818
}
19-
let uiOrientation = try UIImage.CameraOrientation(fromExif: exifOrientation)
19+
let uiOrientation = try UIImage.Orientation(fromExif: exifOrientation)
2020
let orientation = CameraOrientation(uiOrientation: uiOrientation)
2121
let isMirrored = uiOrientation.isMirrored
2222
let timestamp = self.timestamp

packages/react-native-vision-camera/ios/Extensions/AVFoundation/AVDepthData+toUIImage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import NitroModules
1111

1212
extension AVDepthData {
13-
func toUIImage(orientation: UIImage.CameraOrientation) throws -> UIImage {
13+
func toUIImage(orientation: UIImage.Orientation) throws -> UIImage {
1414
// No-copy create CIImage from AVDepthData
1515
guard let ciImage = CIImage(depthData: self) else {
1616
throw RuntimeError.error(withMessage: "Failed to convert Depth to Image!")

packages/react-native-vision-camera/ios/Extensions/CIImage+toUIImage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import NitroModules
1212
extension CIImage {
1313
private static let context = CIContext(options: [.useSoftwareRenderer: false])
1414

15-
func toUIImage(orientation: UIImage.CameraOrientation) throws -> UIImage {
15+
func toUIImage(orientation: UIImage.Orientation) throws -> UIImage {
1616
// Copy the CIImage into a CGImage (render)
1717
guard
1818
let cgImage = Self.context.createCGImage(

packages/react-native-vision-camera/ios/Extensions/Converters/UI+CameraOrientation.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import Foundation
99
import NitroModules
1010

1111
extension CameraOrientation {
12-
init(uiOrientation: UIImage.CameraOrientation) {
12+
init(uiOrientation: UIImage.Orientation) {
1313
switch uiOrientation {
1414
case .up, .upMirrored:
1515
self = .up
@@ -20,7 +20,7 @@ extension CameraOrientation {
2020
case .right, .rightMirrored:
2121
self = .right
2222
@unknown default:
23-
fatalError("UIImage.CameraOrientation has unknown value: \(uiOrientation)")
23+
fatalError("UIImage.Orientation has unknown value: \(uiOrientation)")
2424
}
2525
}
2626
init(interfaceOrientation: UIInterfaceOrientation) {
@@ -40,7 +40,7 @@ extension CameraOrientation {
4040
}
4141
}
4242

43-
func toUIImageOrientation(isMirrored: Bool) -> UIImage.CameraOrientation {
43+
func toUIImageOrientation(isMirrored: Bool) -> UIImage.Orientation {
4444
switch self {
4545
case .up:
4646
return isMirrored ? .upMirrored : .up

packages/react-native-vision-camera/ios/Extensions/CoreMedia/CMSampleBuffer+toUIImage.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import Foundation
1010
import NitroModules
1111

1212
extension CMSampleBuffer {
13-
func toUIImage(orientation: UIImage.CameraOrientation) throws -> UIImage {
13+
func toUIImage(orientation: UIImage.Orientation) throws -> UIImage {
1414
guard let imageBuffer else {
1515
throw RuntimeError.error(withMessage: "This Frame does not have a PixelBuffer!")
1616
}

packages/react-native-vision-camera/ios/Public/MediaSampleMetadata.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public struct MediaSampleMetadata {
3232
self.isMirrored = isMirrored
3333
}
3434

35-
var uiImageOrientation: UIImage.CameraOrientation {
35+
var uiImageOrientation: UIImage.Orientation {
3636
return orientation.toUIImageOrientation(isMirrored: isMirrored)
3737
}
3838
}

0 commit comments

Comments
 (0)