scripts/lib/iosWKWebViewEngineSupport.js
function setMacro(xcodeProject) {
  var configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection());
  var config;
  var buildSettings;

  for (config in configurations) {
    buildSettings = configurations[config].buildSettings;
    var preprocessorDefs = buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] ? buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] : [];
    if (!preprocessorDefs.length && !isWkWebViewEngineUsed) {
      continue;
    }

    if (!Array.isArray(preprocessorDefs)) {
      preprocessorDefs = [preprocessorDefs];
    }

    var isModified = false;
    var injectedDefinition = strFormat('"%s=%d"', WKWEBVIEW_MACRO, isWkWebViewEngineUsed);
    preprocessorDefs.forEach(function(item, idx) {
      if (item.indexOf(WKWEBVIEW_MACRO) !== -1) {
        preprocessorDefs[idx] = injectedDefinition;
        isModified = true;
      }
    });

    if (!isModified) {
      preprocessorDefs.push(injectedDefinition);
    }

    if (preprocessorDefs.length === 1) {
      buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] = preprocessorDefs[0];
    } else {
      buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] = preprocessorDefs;
    }
  }
}
function setMacro(xcodeProject) {
  var configurations = nonComments(xcodeProject.pbxXCBuildConfigurationSection());
  var config;
  var buildSettings;

  for (config in configurations) {
    buildSettings = configurations[config].buildSettings;
    var preprocessorDefs = buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] ? buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] : [];
    if (!preprocessorDefs.length && !isWkWebViewEngineUsed) {
      continue;
    }

    if (!Array.isArray(preprocessorDefs)) {
      preprocessorDefs = [preprocessorDefs];
    }

    var isModified = false;
    var injectedDefinition = strFormat('"%s=%d"', WKWEBVIEW_MACRO, isWkWebViewEngineUsed);
    preprocessorDefs.forEach(function(item, idx) {
      if (item.indexOf(WKWEBVIEW_MACRO) !== -1) {
        preprocessorDefs[idx] = injectedDefinition;
        isModified = true;
      }
    });

    if (!isModified) {
      preprocessorDefs.push(injectedDefinition);
    }

    if (preprocessorDefs.length === 1) {
      buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] = preprocessorDefs[0];
    } else {
      buildSettings['GCC_PREPROCESSOR_DEFINITIONS'] = preprocessorDefs;
    }
  }
}
function setMacro ( xcodeProject ) { var configurations = nonComments ( xcodeProject . pbxXCBuildConfigurationSection ( ) ) ; var config ; var buildSettings ; for ( config in configurations ) { buildSettings = configurations [ config ] . buildSettings ; var preprocessorDefs = buildSettings [ 'GCC_PREPROCESSOR_DEFINITIONS' ] ? buildSettings [ 'GCC_PREPROCESSOR_DEFINITIONS' ] : [ ] ; if ( ! preprocessorDefs . length && ! isWkWebViewEngineUsed ) { continue ; } if ( ! Array . isArray ( preprocessorDefs ) ) { preprocessorDefs = [ preprocessorDefs ] ; } var isModified = false ; var injectedDefinition = strFormat ( '"%s=%d"' , WKWEBVIEW_MACRO , isWkWebViewEngineUsed ) ; preprocessorDefs . forEach ( function ( item , idx ) { if ( item . indexOf ( WKWEBVIEW_MACRO ) !== - 1 ) { preprocessorDefs [ idx ] = injectedDefinition ; isModified = true ; } } ) ; if ( ! isModified ) { preprocessorDefs . push ( injectedDefinition ) ; } if ( preprocessorDefs . length === 1 ) { buildSettings [ 'GCC_PREPROCESSOR_DEFINITIONS' ] = preprocessorDefs [ 0 ] ; } else { buildSettings [ 'GCC_PREPROCESSOR_DEFINITIONS' ] = preprocessorDefs ; } } }
region Macros injection 
Inject WKWebView macro into project configuration file.

@param {Object} xcodeProject - xcode project file instance
region Macros injection Inject WKWebView macro into project configuration file .