A runtime check would be great, but the person compiling the app knows which they are targeting (a compatible iPad app, or a visionOS app), so a custom compiler flag could be set and tested in the code with #if, right?
In Build Settings-> Swift Compiler - Custom Flags -> Active Compiler definitions -> add e.g. ISVISIONOS
for a true visionOS app, and leave it out for iPad apps. The different Xcode targets have their own build settings.
and in swift:
#if ISVISIONOS
Sorry if I'm missing something from your question.
Topic:
App & System Services
SubTopic:
Core OS
Tags: