FlatBuffersSwift icon indicating copy to clipboard operation
FlatBuffersSwift copied to clipboard

Support namespaces

Open mzaks opened this issue 8 years ago • 4 comments

This feature will also make it possible to include all infrastructure code inside the generated file. This way users don't have to include FlatBuffersSwift module, generating code will be self sufficient.

mzaks avatar Feb 27 '16 22:02 mzaks

Shouldn't the reader/builder also be using namespaces in the generated code - seeing them as top level in contactList.swift generated code - would cause trouble if having multiple schemas in the same app?

hassila avatar Apr 30 '16 08:04 hassila

(specifically, the flatbench now uses the contactList builder&reader instead of the framework one... A bit unexpected.)

hassila avatar Apr 30 '16 08:04 hassila

Sadly Swift doesn't let me :) Declaration of protocols typealias and extension has to be on file level and can't be wrapped inside of an enum for example. This way Scalar and Offset has to be outside of the namespace and when generated, it will be duplicated. This is why for now I decided to solve it as described in #23 So as user you can decide if you want to import the lib or include it for the first file and than exclude it for the later once. Not a beauty, but let's see maybe with time we get a better idea, or Swift adds some support for internal protocol definition. Btw. I also added https://github.com/mzaks/FlatBuffersSwift/blob/master/generate.sh To being able to generate code before the Performance test build but today at 2 A.M. didn't manage to make XCode execute the shell script.

mzaks avatar Apr 30 '16 10:04 mzaks

Ah, I see (not a Swift expert by any means yet). Will ponder if I can think of any better solution for packaging.

hassila avatar Apr 30 '16 15:04 hassila