I suspect no one at Apple is actually using Core Data or running unit tests for Xcode 8 on projects that used to rely on mogenerator.
First off, the model editor still fails to persist settings like the Language, the Codegen style and also Use Scalar Type, which cost me a lost day.
Beta 5 was errantly codegen'ing ordered to-many relationships as OrderedSet, which would not compile. That was a glaring oversight, but okay.
Beta 6 is now generating NSOrderedSet properties. But you still can't actually use those accessors, like addToBalls(_ value: Ball). You get the following internal runtime crash if you do:
-[NSSet intersectsSet:]: set argument is not an NSSet'This is the same crash I got in Beta 5 when I simply renamed OrderedSet to NSOrderedSet in my MyClass+CoreDataProperties.swift files.
So that means all that got fixed in Beta 6 was a simple string change—not the underlying code, which doesn't seem to be aware of the model editor's "Ordered" checkbox.
Here's the workaround for this bug. It's a modified mogenerator accessor, which has to be replicated for every affected relationship in your model:
func addToBalls(_ value: Ball) {
let mutable = balls?.mutableCopy() as! NSMutableOrderedSet
mutable.add(value)
balls = mutable.copy() as? NSOrderedSet
}This accessor works fine. But I can't see what Beta 6's codegen is doing because that code is hidden from the project.
When is this mess going to get fixed?