[Swift - Feature Request] Expose a property in the generate code for the file identifier.
kennycarruthers opened this issue · comments
Kenny Carruthers commented
When using a file_identifier
in your Schema, the generated C++ code includes a function for accessing its value. However, in the generated Swift code, the value is used inline and there is no equivalent accessor. It would be helpful if the file_identifier
was exposed as a Swift property similar to how it's exposed in C++.
Schema.fbs
table Entity {
x:int;
}
file_identifier "ENTT";
root_type Entity;
C++ Code
inline const char *EntityIdentifier() {
return "ENTT";
}
inline bool EntityBufferHasIdentifier(const void *buf) {
return flatbuffers::BufferHasIdentifier(
buf, EntityIdentifier());
}
Swift Code
public struct Entity: FlatBufferObject, Verifiable, ObjectAPIPacker {
// ... snip ...
public static func finish(_ fbb: inout FlatBufferBuilder, end: Offset, prefix: Bool = false) {
fbb.finish(offset: end, fileId: "ENTT", addPrefix: prefix)
}
// ... snip ...
}