No such module 'Cocoa' in Swift Playground

前端 未结 3 1974
清酒与你
清酒与你 2020-12-24 06:20

I\'m trying to follow some of the code used in the WWDC playgrounds session, I\'m trying to import the Cocoa framework with:

import Cocoa

B

3条回答
  •  长情又很酷
    2020-12-24 06:51

    If you are getting this or a similar type of error despite having the playground set properly, try the following:

    Close XCode and from the terminal run:

     rm -rf "$(getconf DARWIN_USER_CACHE_DIR)/org.llvm.clang/ModuleCache"
    

    Then reopen XCode and most times this fixes many Playground issues. I run this command quite frequently during an intensive Playground work session (sometimes as many as a few times per hour) and have found liberal use of removing the ModuleCache to solve a multitude of strange playground behaviors.

    If you're still having issues with playgrounds you can try:

    rm -rf ~/Library/Developer/Xcode/DerivedData
    

    and/or

    rm -rf ~/Library/Caches/com.apple.dt.Xcode
    

提交回复
热议问题