Actually, this question is for earlier builds of Xcode version 12, and this issue is disappeared in version 13.x
I doubt anyone use version 12, but for fixing on Xcode 12, running and debugging on physical device could be a valid solution.
solved Fresh init React Native Build has CompileSwiftSources normal x86_64 com.apple.xcode.tools.swift.compiler error on Xcode 12