Support existing CLI apple project use cases without relying on podfile existing on the disk (projects using SPM)
Describe the Feature
Since RN 0.87 there's an experimental SPM support introduced
Right now when project is migrated from Cocoapods to SPM, all the commands that rely on the getProjectConfig from @react-native-community/cli-config-apple (e.g. react-native spm) will fail once the Podfile is removed from its default location. Having dead Podfile just to keep the config command work doesn't make any sense
Possible Implementations
looking at where findPodfilePath or findPodfilePaths are used, there're 2 internal use cases
https://github.com/react-native-community/cli/blob/9013a480c66aece0e23cc8082ee23f92274e3cf4/packages/cli-config-apple/src/config/index.ts#L36(getProjectConfig)https://github.com/react-native-community/cli/blob/9013a480c66aece0e23cc8082ee23f92274e3cf4/packages/cli-doctor/src/tools/healthchecks/xcodeEnv.ts#L33(relies on the project config)
One idea would be to at least prioritize user config (project.ios.sourceDir from react-native.config.js) and use it instead of always returning null config when there's no Podfile. That way the amount of changes in CLI will be minimal and SPM users will be able to just set the value to e.g. ios and to drop the Podfile.
Another idea would be to look for .spm-injected.json within the candidate directory (it's a file injected via react-native spm command) - if it's found, it means that its parent directory is in fact the one that consists .pbxproj file and the directory with swift/objc source code.
Last one I can think of is to look for .xcode.env file, which is afaik should exist in each RN project next to Podfile
The resolving order should be like this: (user-config) -> (.spm-injected.json OR .xcode.env) -> (Podfile) - if none of those exist only then return null for the project config value
Related Issues
Source: react-native-community/cli