code: private void setDefaultSimulatorPreference(String key, String value) {
      List<String> com = new ArrayList<>();
      com.add("defaults");
      com.add("write");
      com.add("com.apple.iphonesimulator");
      com.add(key);
      com.add(String.format("\"%s\"", value));
  
      Command updatePreference = new Command(com, true);
      updatePreference.executeAndWait();
    }
docs: update the preference of the simulator. Similar to using the IOS Simulator menu > Hardware >
  [DeviceType | Version ]