Xcode Simulator build

I would like to use viro in the project I am working on. I am able to build and run project on actual iPhone, however running project in simulator does not seems possible due to different CPU architecture and no symbols included. I am aware that Viro does not support simulator, but my question is:
Is there a way I can dynamically disable Viro when building for simulator, so I can keep working on and testing other features of my app?
So far I’ve tried to do conditional import:

#import <ViroReact/VRTBundleURLProvider.h>

But in that case I get a different error:

ld: framework not found ViroKit
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Thank you,

1 possible answer(s) on “Xcode Simulator build

  1. Hi @VitaliiK91 ,
    Is your project a hybrid app (Native iOS + Viro React) or React Native + Viro React app? In the case it is React Native + Viro React, the easiest way I can think of (Not fully knowing how your app structure is, so may be completely wrong) is to do this check in your AppDelegate where the RCTRootView is initialized, as you would do in a regular iOS app; and then pass this info to the react root-view as initialProperties. Something on the lines of

    BOOL isSimulatorTarget = NO;
      isSimulatorTarget = YES;

    And then passing this as initial property where RCTRootView is initialized, as follows:

    RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation
                                                   initialProperties:@{@"isSimulatorTarget": @(isSimulatorTarget)}

    And then in the react-native code, rely on value of this.props.isSimulatorTarget to conditionally render Viro components based on whether the app is running on simulator or a device. There are multiple ways to do conditional rendering, but an easy solution we have relied in some of our projects – is to write a conditional rendering module:

    export default function renderIf(condition, content) {
        if (condition) {
            return content;
        } else {
            return null;

    And then using the above module to selectively render Viro components –

                <View style={localStyles.viroContainer}>
                    initialScene={{scene: InitialARScene}} 
                    ... />

    Hope this helps! Let us know if you have more questions.