protobuf-swift
protobuf-swift copied to clipboard
Classes VS Structs
I noticed that the generated Swift code uses classes to represent data. Was there a reason behind using classes instead of structs?
Thank you!
In the official languages (C++ / Java / Python) - PB used classes. Therefore, I use classes.
I will add new option for generate structs instead of classes. But by default pb-swift will generate classes.
:+1:
It would be interesting to run some performance tests and see what difference it makes to common operations.
FYI, the official Google Protobuf project is planning to use struct
s once they get to Swift generation. I think their reasoning is sound, and I'd love to see this happen.
https://github.com/google/protobuf/pull/1442
Wow, does the protobuf project have anyone actively working on a Swift implementation? Is it possible to resolve the BSD/Apache license difference between protobuf-swift and protobuf, and one day have protobuf-swift become the official Swift implementation? Doesn’t really make sense to duplicate all this work.
@DouglasHeriot Change license - it is no problems.