I have the same problem that was reported in a previous thread on devforums.apple.com in thread/231762/
I have an existing document-based Mac app that I ported to Swift. The code compiles, but when I try to create a new document, an alert opens saying "No document can be created." The Xcode debug console has the following message:
The XXX type doesn't map to any NSDocumentClass.
I have read the solution from Mark Szymczyk :
give the Product Module Name build setting a value. In the Info.plist file, enter the following for the Cocoa NSDocument Class field:
Module.ClassWhere Module is the value you entered for the Product Module Name build setting and Class is the name of your NSDocument subclass.
I did it, I cleaned the build, but still have the problem ; I suspect I do not enter the right Module name.
What is exactly the module name to enter (where is it defined exactly ?) ; I have a project name with spaces ; I have replaced the space by hyphens " - " ; is it the right thing to do ?
According to the Using Swift with Cocoa and Objective-C documentation, any non-alphanumeric characters in the module name are replaced with an underscore.
The name of the Xcode-generated header for Swift code, and the name of the Objective-C bridging header that Xcode creates for you, are generated from your product module name. By default, your product module name is the same as your product name. However, if your product name has any nonalphanumeric characters, such as a period (.), they are replaced with an underscore (_) in your product module name. If the name begins with a number, the first number is replaced with an underscore.You can also provide a custom name for the product module name and Xcode will use this when naming the bridging and generated headers. To do this, change the Product Module Name build setting.
NOTE: You cannot override the product module name of a framework.