Skip to content

Commit ffe63c9

Browse files
authored
[visionOS] Add support for Firebase Performance on visionOS (#11950)
1 parent 54d4d70 commit ffe63c9

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

FirebasePerformance/Sources/Instrumentation/UIKit/FPRUIViewControllerInstrument.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
// See the License for the specific language governing permissions and
1313
// limitations under the License.
1414

15+
#import <TargetConditionals.h>
1516
#import <UIKit/UIKit.h>
1617

1718
#import "FirebasePerformance/Sources/AppActivity/FPRScreenTraceTracker+Private.h"
@@ -68,9 +69,12 @@ void InstrumentViewDidAppear(FPRUIViewControllerInstrument *instrument,
6869

6970
// This has to be called on the main thread and so it's done here instead of in
7071
// FPRScreenTraceTracker.
72+
// TODO: Replace keyWindow usage (deprecated in iOS and unavailable in visionOS).
73+
#if !defined(TARGET_OS_VISION) || !TARGET_OS_VISION
7174
if ([((UIViewController *)_self).view isDescendantOfView:FPRSharedApplication().keyWindow]) {
7275
[[FPRScreenTraceTracker sharedInstance] viewControllerDidAppear:_self];
7376
}
77+
#endif
7478
}];
7579
}
7680

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,7 @@ let package = Package(
897897
.target(
898898
name: "FirebasePerformanceTarget",
899899
dependencies: [.target(name: "FirebasePerformance",
900-
condition: .when(platforms: [.iOS, .tvOS]))],
900+
condition: .when(platforms: [.iOS, .tvOS, .firebaseVisionOS]))],
901901
path: "SwiftPM-PlatformExclude/FirebasePerformanceWrap"
902902
),
903903
.target(

0 commit comments

Comments
 (0)