mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-23 10:30:00 +00:00
Adds JSON encoding to swift (#6874)
Updates generated code & removes unneeded protocol Updates cpp to only generate code when flag is passed Updates code gen script
This commit is contained in:
@@ -42,6 +42,17 @@ public struct models_HelloReply: FlatBufferObject, Verifiable {
|
||||
}
|
||||
}
|
||||
|
||||
extension models_HelloReply: Encodable {
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case message = "message"
|
||||
}
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(message, forKey: .message)
|
||||
}
|
||||
}
|
||||
|
||||
public struct models_HelloRequest: FlatBufferObject, Verifiable {
|
||||
|
||||
static func validateVersion() { FlatBuffersVersion_2_0_0() }
|
||||
@@ -80,3 +91,14 @@ public struct models_HelloRequest: FlatBufferObject, Verifiable {
|
||||
}
|
||||
}
|
||||
|
||||
extension models_HelloRequest: Encodable {
|
||||
|
||||
enum CodingKeys: String, CodingKey {
|
||||
case name = "name"
|
||||
}
|
||||
public func encode(to encoder: Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encodeIfPresent(name, forKey: .name)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user