alexeyxo / protobuf-swift

Google ProtocolBuffers for Apple Swift
http://protobuf.io/#swift
Apache License 2.0
937 stars 138 forks source link

Classes VS Structs #41

Open NachoSoto opened 9 years ago

NachoSoto commented 9 years ago

I noticed that the generated Swift code uses classes to represent data. Was there a reason behind using classes instead of structs?

Thank you!

alexeyxo commented 9 years ago

In the official languages (C++ / Java / Python) - PB used classes. Therefore, I use classes.

alexeyxo commented 8 years ago

I will add new option for generate structs instead of classes. But by default pb-swift will generate classes.

NachoSoto commented 8 years ago

:+1:

DouglasHeriot commented 8 years ago

It would be interesting to run some performance tests and see what difference it makes to common operations.

dpassage commented 8 years ago

FYI, the official Google Protobuf project is planning to use structs 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

DouglasHeriot commented 8 years ago

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.

alexeyxo commented 8 years ago

@DouglasHeriot Change license - it is no problems.