mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-13 00:04:29 +00:00
[Swift] Migrate to swift 6.0 and Implements support gRPC v2 (#8983)
* Migrate to swift 6.0 & swift-gRPC 2.0 The following migrates to swift 6.0, and also migrate to swift-grpc 2.0 that uses swift-nio under the hood to provide nicer API and async await Adds sendable to enum & update @_implementationOnly imports to use internal imports * Address PR comments regarding misspelling & proper method naming.
This commit is contained in:
@@ -170,9 +170,8 @@ class SwiftGenerator : public BaseGenerator {
|
||||
code_ += "// swiftformat:disable all\n";
|
||||
|
||||
if (parser_.opts.include_dependence_headers || parser_.opts.generate_all) {
|
||||
code_.SetValue("IMPLEMENTONLY", parser_.opts.swift_implementation_only
|
||||
? "@_implementationOnly "
|
||||
: "");
|
||||
code_.SetValue("IMPLEMENTONLY",
|
||||
parser_.opts.swift_implementation_only ? "internal " : "");
|
||||
code_ += "#if canImport(Common)";
|
||||
code_ += "{{IMPLEMENTONLY}}import Common";
|
||||
code_ += "#endif";
|
||||
@@ -549,13 +548,14 @@ class SwiftGenerator : public BaseGenerator {
|
||||
code_.SetValue("SHORT_STRUCTNAME", namer_.Type(struct_def));
|
||||
code_.SetValue("STRUCTNAME", namer_.NamespacedType(struct_def));
|
||||
code_.SetValue("OBJECTTYPE", struct_def.fixed ? "Struct" : "Table");
|
||||
code_.SetValue("PROTOCOL", struct_def.fixed ? "FlatBufferStruct"
|
||||
: "FlatBufferVerifiableTable");
|
||||
code_.SetValue("MUTABLE", struct_def.fixed ? Mutable() : "");
|
||||
|
||||
GenOSVersionChecks();
|
||||
code_ +=
|
||||
"{{ACCESS_TYPE}} struct {{STRUCTNAME}}{{MUTABLE}}: "
|
||||
"FlatBuffer{{OBJECTTYPE}}, FlatbuffersVectorInitializable\\";
|
||||
if (!struct_def.fixed) code_ += ", Verifiable\\";
|
||||
"{{PROTOCOL}}, FlatbuffersVectorInitializable\\";
|
||||
if (!struct_def.fixed && parser_.opts.generate_object_based_api)
|
||||
code_ += ", ObjectAPIPacker\\";
|
||||
code_ += " {\n";
|
||||
|
||||
Reference in New Issue
Block a user