I'm running into this issue on Sonoma as well. The only workaround I found was to import AppKit and Foundation instead of Cocoa or create an iOS playground instead. Also, Xcode's inline hints and error messages seem to be gone.
Post
Replies
Boosts
Views
Activity
Updating to Sonoma 14.1 fixes this issue somehow.