Closed hactar closed 9 months ago
Thanks for your involvement @hactar! It's great to have others using it!
But even for my limited use case I already see that there's going to be a LOT of boilerplate code to support all properties that the underlying MLNCircleStyleLayer supports - and any addition to MLNCircleStyleLayer will need an update to CircleStyleLayer...
Yes, by my count it's going to be dozens if not hundreds of properties per layer type to get to complete support :/
So my question is, is this the right approach? Wouldn't it be wiser to take this a step further and auto-generate these properties/modifiers from the definitions of MLNCircleStyleLayer etc themselves? Or is this something the current Swift cannot help us with? Maybe this is the goal already and I'm just stating the obvious, in which case, sorry - but wanted to contribute to any discussion 😊
Yes, a lot more auto-generation is definitely the long-term goal. Recently I haven't had as much headspace to devote to this, but here's a quick brain dump from me:
Jumping back to your direct question about auto-generation, at the moment, Swift macros don't give you compile-time type introspection of obj-c class hierarchies. They are just syntax transformers. So this is not presently possible. However, I have a very half-baked thought in the back of my head about writing an actual preprocessor that generates most of the Swift code in this project (I guess from the Obj-C), and uses macros for the heavy lifting, but I have not yet given too much thought to that.
Please feel free to brainstorm on this thread :) cc @Archdoog.
Alright - so for the time being, this is the right approach. I'll submit a PR for CircleStyleLayer
later then, it won't cover all possible modifiers, but will include the ones I need for my project :) - leaving issue open in case Archdoog still wants to comment, but feel free to close, my question has been answered, thanks!
Great; thanks! And yes, I'd love a PR for your circle style layer. I think as more people start building more with it we'll hit a point where it makes sense to spend more time on the automatic generation (figure out what we want the APIs to look like first; then figure out how to scale it).
If anyone has any ideas, feel free to either open an issue with a proposal, or I think discussions are also enabled for more open-ended stuff :)
So in the spirit of this playground, I've started trying to add it to a real project to see how far this takes me.
I have created a CircleStyleLayer based on the SymbolStyleLayer - all is working well, and thanks to the Macros, adding the properties is less work then without them. But even for my limited use case I already see that there's going to be a LOT of boilerplate code to support all properties that the underlying MLNCircleStyleLayer supports - and any addition to MLNCircleStyleLayer will need an update to CircleStyleLayer...
So my question is, is this the right approach? Wouldn't it be wiser to take this a step further and auto-generate these properties/modifiers from the definitions of MLNCircleStyleLayer etc themselves? Or is this something the current Swift cannot help us with? Maybe this is the goal already and I'm just stating the obvious, in which case, sorry - but wanted to contribute to any discussion 😊