Skip to content
Snippets Groups Projects
Commit 208795c0 authored by Benjamin Herzog's avatar Benjamin Herzog
Browse files

Added nullability to service declaration in objc

parent c2b6a0bc
No related branches found
No related tags found
No related merge requests found
...@@ -75,11 +75,11 @@ void PrintMethodSignature(Printer *printer, const MethodDescriptor *method, ...@@ -75,11 +75,11 @@ void PrintMethodSignature(Printer *printer, const MethodDescriptor *method,
if (method->server_streaming()) { if (method->server_streaming()) {
printer->Print(vars, printer->Print(vars,
" eventHandler:(void(^)(BOOL done, " " eventHandler:(void(^)(BOOL done, "
"$response_class$ *response, NSError *error))eventHandler"); "$response_class$ *_Nullable response, NSError *_Nullable error))eventHandler");
} else { } else {
printer->Print(vars, printer->Print(vars,
" handler:(void(^)($response_class$ *response, " " handler:(void(^)($response_class$ *_Nullable response, "
"NSError *error))handler"); "NSError *_Nullable error))handler");
} }
} }
......
...@@ -64,7 +64,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ...@@ -64,7 +64,8 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
".pbobjc.h\"\n\n" ".pbobjc.h\"\n\n"
"#import <ProtoRPC/ProtoService.h>\n" "#import <ProtoRPC/ProtoService.h>\n"
"#import <RxLibrary/GRXWriteable.h>\n" "#import <RxLibrary/GRXWriteable.h>\n"
"#import <RxLibrary/GRXWriter.h>\n"; "#import <RxLibrary/GRXWriter.h>\n\n"
"NS_ASSUME_NONNULL_BEGIN\n\n";
// TODO(jcanizales): Instead forward-declare the input and output types // TODO(jcanizales): Instead forward-declare the input and output types
// and import the files in the .pbrpc.m // and import the files in the .pbrpc.m
...@@ -81,8 +82,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator { ...@@ -81,8 +82,10 @@ class ObjectiveCGrpcGenerator : public grpc::protobuf::compiler::CodeGenerator {
declarations += grpc_objective_c_generator::GetHeader(service); declarations += grpc_objective_c_generator::GetHeader(service);
} }
::grpc::string nonNullEnd = "\nNS_ASSUME_NONNULL_END\n";
Write(context, file_name + ".pbrpc.h", Write(context, file_name + ".pbrpc.h",
imports + '\n' + proto_imports + '\n' + declarations); imports + '\n' + proto_imports + '\n' + declarations + nonNullEnd);
} }
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment