Getting the following error when importing Darwin or Foundation in Swift

FYI, if you use triple backquote delimiters, your code blocks won’t get interpreted by the Markdown parser.

So your setup looks very similar to mine [1], suggesting two theories:

  • There’s something broken with your Xcode.

  • There’s something weird about your user configuration.

We can test both of these.


To test your Xcode:

% codesign -v -v --strict --deep /Applications/Xcode.app                                                                            
/Applications/Xcode.app: valid on disk
/Applications/Xcode.app: satisfies its Designated Requirement

This will take a while, enough time for a tea break!

What does this show?


To test your user configuration:

  1. Use System Preferences > Users & Groups to create a new test user.

  2. Log in as that user.

  3. Repeat the steps from my first response.

Do things still fail in that context?

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

[1] The difference between macOS 12.2 and 12.2.1 doesn’t matter in this context, although you should update because the latter some some important security fixes.