Selaa lähdekoodia

[visionOS] Fix Storage SDK build on Xcode 15 beta 6 (#11667)

In Xcode 15 beta 6, `#if os(iOS)` no longer evaluates to true when building for visionOS.

Note: `TARGET_OS_IOS` continues to be defined so Objective-C code is unchanged.
Andrew Heard 2 vuotta sitten
vanhempi
sitoutus
df56264781
1 muutettua tiedostoa jossa 11 lisäystä ja 1 poistoa
  1. 11 1
      FirebaseStorage/Sources/Internal/StorageUtils.swift

+ 11 - 1
FirebaseStorage/Sources/Internal/StorageUtils.swift

@@ -17,7 +17,17 @@ import Foundation
   import MobileCoreServices
 #elseif os(macOS) || os(watchOS)
   import CoreServices
-#endif
+#endif // os(iOS) || os(tvOS)
+
+// swift(>=5.9) implies Xcode 15+
+// Need to have this Swift version check to use os(visionOS) macro, VisionOS support.
+// TODO: Remove this check and add `os(visionOS)` to the `os(iOS) || os(tvOS)` conditional above
+// when Xcode 15 is the minimum supported by Firebase.
+#if swift(>=5.9)
+  #if os(visionOS)
+    import MobileCoreServices
+  #endif // os(visionOS)
+#endif // swift(>=5.9)
 
 class StorageUtils {
   internal class func defaultRequestForReference(reference: StorageReference,