1import { IOSConfig, InfoPlist, withInfoPlist, ConfigPlugin } from '@expo/config-plugins'; 2import { ExpoConfig } from 'expo/config'; 3 4import getDefaultScheme from './getDefaultScheme'; 5 6export const withGeneratedIosScheme: ConfigPlugin = (config) => { 7 return withInfoPlist(config, (config) => { 8 config.modResults = setGeneratedIosScheme(config, config.modResults); 9 return config; 10 }); 11}; 12 13export function setGeneratedIosScheme( 14 config: Pick<ExpoConfig, 'scheme' | 'slug'>, 15 infoPlist: InfoPlist 16): IOSConfig.InfoPlist { 17 // Generate a cross-platform scheme used to launch the dev client. 18 const scheme = getDefaultScheme(config); 19 20 if (!IOSConfig.Scheme.hasScheme(scheme, infoPlist)) { 21 infoPlist = IOSConfig.Scheme.appendScheme(scheme, infoPlist); 22 } 23 return infoPlist; 24} 25