Core Data codeine problems (Xcode 8 beta 5)

I have an iOS app containing a Core Data model with 6 entities. The entity "Name" is set up as follows:


Class Name: Name

Module: Current Product Module

Codegen: Class Definition


(all 5 other entities are set up similarly).


Problem 1

Code IS generated in the derived data folder… not as class definitions as expected, but as extensions instead (named like Name+CoreDataProperties.swift. It doesn't seem to matter whether the Codegen is set to Class Definition or Category/Extension - I still get the same result.


OK, hold that thought - all of a sudden both the class and extensino files ARE now being generated… although I don't know what I did to make it happen. Deleted derived data maybe? It seem to happen out of the blue.


Problem 2

Generated files ignore the data model Optional flag setting for String attributes and relationships - they are all generated as optionals


Problem 3

Ordered relationships are generated as OrderedSet rather than NSOrderedSet (can't change them as they get re-generated).


Workaround for me was to temporarily add to the project…

public typealias OrderedSet = NSOrderedSet


Problem 4

None of the above really matters, because the compiler can't find the files it's just generated. For the Name entity above:


<unknown>:0: error: no such file or directory: '/Users/ashleymills/Library/Developer/Xcode/DerivedData/<project>-grfqveelvqtlydbpwjmfdietnrss/Build/Intermediates/<project>.build/Debug-iphonesimulator/<project>.build/DerivedSources/CoreDataGenerated/<project>/.Name+CoreDataClass.swift'

<unknown>:0: error: no such file or directory: '/Users/ashleymills/Library/Developer/Xcode/DerivedData/<project>-grfqveelvqtlydbpwjmfdietnrss/Build/Intermediates/<project>.build/Debug-iphonesimulator/<project>.build/DerivedSources/CoreDataGenerated/<project>/.Name+CoreDataProperties.swift'


It's looking in derived data for files .Name+CoreDataClass.swift and .Name+CoreDataProperties.swift - notice the '.' at the front of the file names.


I assume I'm doing something wrong, as if this was the case for everyone, no-one would be able to build a Core Data project… or are these bugs that need raising?


Cheers

Ash

Gah! The title should be "Core Data codegen problems (Xcode 8 beta 5)" - **** you autocorrect!!

To fix problem 4:


Class Name: Name

Module: Global namespace

Codegen: Class Definition


If you delete 'Current Product Module' it will default to 'Global namespace'. Then clean the project and it should build okay.


A week ago I filed a bug for problem 3 - #27689124, and a year ago I filed a bug for problem 2 - #22020804. It would be great if you would file bugs as well. The rumor is that the more duplicate bugs, the sooner it gets fixed.

Core Data codeine problems (Xcode 8 beta 5)
 
 
Q