I have been working recently on DevSketch 1.3 with all the Swift things which means upgrading the Core Data model and adding support for Enums and Structs. Extensions are basically Obj-C categories so that doesn't involve extra work.
Problem is it turns out Structs aren't so different to Classes in Swift land and i'm left with a structure issue.
Currently Protocols and Classes descend from Object as they can both carry messages(functions) and properties(vars) and my initial instinct was to do the same thing for Structs. Now I'm wondering whether or not to smoosh Structs as a simple Boolean property on Class or just subclass off Class instead of Object.
Semantically I would be saying "struct is-a class" . I know this is incorrect at an official level but it does make sense from a development level.
Struct and Classes are basically equal opportunity employers at a syntax level. At runtime they are different but that's not where DevSketch lives and it would make the relationship management a lot easier. It would also give the opportunity to flip between struct and class.
Got a Foo that you have set up as a Struct but now it's getting too heavy. Just give a nudge and now it's a class.
So am I backing myself into a big hole ? Such is the peril of Core Data as a storage medium. Small decisions become big thumping PITA later on.
Think I'll go and look at kittens on the Internet instead.#swiftlang #coredata