How do you make lines of code only for a specific destination in Xcode?

Hi! I am trying to create an iOS application but also for visionOS. In the target settings, I have iPhone and Vision Pro added under the supported destinations. The problem that I am running into is that the Firebase messaging and the user notifications are not supported with Vision Pro. Is there anyway to just make those lines of code only for the iOS supported destination?

If you could help, that would be greatly appreciated!

Use the #if os statement to run code for a specific platform.

#if os(iOS)
  // Run iOS code here
#endif

You can also place the code that Vision Pro does not support into its own file and tell Xcode to compile that file only for the iOS destination. More details are in the following article:

https://www.swiftdevjournal.com/xcode-multiplatform-app-targets/

How do you make lines of code only for a specific destination in Xcode?
 
 
Q