use Bool for flatbuffers bool instead of Byte (#7876)

Add test for Bool type in swift

Co-authored-by: mustiikhalil <26250654+mustiikhalil@users.noreply.github.com>
This commit is contained in:
blindspotbounty
2023-03-26 19:45:48 -04:00
committed by GitHub
parent 1cb1c4baee
commit 477b1b5d13
5 changed files with 14 additions and 10 deletions

View File

@@ -725,9 +725,9 @@ class SwiftGenerator : public BaseGenerator {
code_.SetValue("CONSTANT", default_value);
code_.SetValue("VALUETYPE", "Bool");
code_ += GenReaderMainBody(optional) + "\\";
code_.SetValue("VALUETYPE", "Byte");
code_ += GenOffset() + "return o == 0 ? {{CONSTANT}} : 0 != " +
GenReader("VALUETYPE", "o") + " }";
code_ += GenOffset() +
"return o == 0 ? {{CONSTANT}} : " + GenReader("VALUETYPE", "o") +
" }";
if (parser_.opts.mutable_buffer) code_ += GenMutate("o", GenOffset());
return;
}