Chapter 2, page 45. Errors creating Bowtie+CoreDataClass.swift and Bowtie+CoreDataProperties.swift

Hi,
my problem starts when I create the managed object subclasses.

  • I went to Editor\Create NSManagedObject Subclass
  • Then I selected Bowtie data model and then Bowtie entity
  • Before creating the two new files, I don’t have any option for selecting Swift language
  • Then I clicked Create

After creating the files Xcode gives me this error:

‘Command /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc failed with exit code 1’

Any ideas how to solve it?

Thanks

Which version of xcode are you using?

I have the same issue. I’m using Xcode 8.2.1

Ok, I seemed to have an answer…in the book it says

Note: Make sure you change this code generation setting before your first compilation after you add the Bowtie entity to the model.
If you set the code generation setting after your first compilation, you’ll have two versions of the managed object subclass: one in derived data and a second one in your source code. If this happens, you’ll run into problems when you try to compile again.

But in the book it doesn’t tell you how to fix this if you do run into problems. What I can upon is to find <home>/Library/Developer/Xcode/DerivedData/Bow_Ties.... and delete the folder. Then it builds cleanly.

Hope it helps somebody.

Sorry if I didn’t answer…I found the solution to my problem here: