Crippling Code Generator bugs in Beta 6

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?

Apple takes a dim view of people who use Core Data. Whether it is pulling the plug on Core Data sync without so much as a "sorry it didn't work out and you wasted 5 years trying to help us with it", still not having any way to properly model Core Data properties as Swift classses (e.g. I have to use NSDecimalNumber not Decimal, NSDate, not Date, etc), the lack of any properly Swifty way to make predicates, or just little jerk moves like changing NSPredicate to Predicate and back again from one beta to the next, Apple is always very clear- Core Data is for suckers.

Crippling Code Generator bugs in Beta 6
 
 
Q