aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Muxi Yan <muxi@users.noreply.github.com>2018-05-01 16:47:09 -0700
committerGravatar GitHub <noreply@github.com>2018-05-01 16:47:09 -0700
commit83601d6b4b197867f90a9861a2d806c86dd6a967 (patch)
tree90d4fa3924570aa1b222327b0307ab0cbca7e3ef
parentb5ba47013aff176c9fc742e3087ccd10312ec9a6 (diff)
parentbf0b8798d6de1023f7a9b7a5539fefa58f4d47bb (diff)
Merge pull request #15193 from muxi/service-init-protocol
Provide protocol for initializer of generated messages
-rw-r--r--src/compiler/objective_c_generator.cc2
-rw-r--r--src/objective-c/ProtoRPC/ProtoService.h6
2 files changed, 7 insertions, 1 deletions
diff --git a/src/compiler/objective_c_generator.cc b/src/compiler/objective_c_generator.cc
index 39f68cb956..7d4d4d1f5a 100644
--- a/src/compiler/objective_c_generator.cc
+++ b/src/compiler/objective_c_generator.cc
@@ -248,7 +248,7 @@ void PrintMethodImplementations(Printer* printer,
" */\n");
printer.Print(vars,
"@interface $service_class$ :"
- " GRPCProtoService<$service_class$>\n");
+ " GRPCProtoService<$service_class$, GRPCProtoServiceInit>\n");
printer.Print(
"- (instancetype)initWithHost:(NSString *)host"
" NS_DESIGNATED_INITIALIZER;\n");
diff --git a/src/objective-c/ProtoRPC/ProtoService.h b/src/objective-c/ProtoRPC/ProtoService.h
index 29c4e9be36..c411bed60f 100644
--- a/src/objective-c/ProtoRPC/ProtoService.h
+++ b/src/objective-c/ProtoRPC/ProtoService.h
@@ -22,6 +22,12 @@
@protocol GRXWriteable;
@class GRXWriter;
+@protocol GRPCProtoServiceInit
+
+- (instancetype)initWithHost:(NSString *)host;
+
+@end
+
__attribute__((deprecated("Please use GRPCProtoService."))) @interface ProtoService
: NSObject -
(instancetype)initWithHost : (NSString *)host packageName