Xcode 6 Beta: No such module 'Cocoa'
I'm trying to use the standard Cocoa library in a swift file in Xcode 6 Beta. I followed this instructions but when I import the library
import Cocoa
XCode complains with the error
No such module 'Cocoa'
I also tried with the REPL and I have no problems at all. I suppose it's a bug, cause I started different projects and only sometimes I get this error. Any suggestions? I'm using Mavericks (10.9.3)
Replace
import Cocoa
With:
import UIKit
You can't import Cocoa
from an iOS playground or application. Make sure your code is running in a Cocoa playground (select OS X > Source in the new file dialog).
From your question, it seems that you are trying to add Cocoa class
into your iOS Application instead of Cocoa Touch class
. So this is not a bug of Xcode.
Be sure to select template which are under the iOS section shown in the following screenshot, as we are choosing it for an iOS Application.