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 = NSOrderedSetProblem 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