If you have a mistake on your code, This error may happen.
I've faced the same, when I forget to pass a param, which is used inside the function. This error occurs.
I've tried clear derived data, restart the mac, pod de integrate/reinstall. But still error exists.
Once I checked my recently added codes one by one, I've seen the missed param.
But We expect xCode will throw an error like Cannot find '' in scope . Instead of showing the error, xCode taking too much of time and struggling to build.
Once added the missed params on that function, xCode build successfully.
Hope It'll help. :)