[ 
https://issues.apache.org/jira/browse/THRIFT-3041?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14366488#comment-14366488
 ] 

Jeremy W. Sherman commented on THRIFT-3041:
-------------------------------------------

Nice work, and definitely something I'd like to see by default be part of 
Thrift.

In generating the service's async protocol, in addition to declaring 
conformance to the {{<NSObject>}} protocol, you should also check if the 
service's {{get_extends()}} returns anything, and if so, add that to the list 
of protocols conformed to.

(The existing codebase fails to handle service extension as well, but no reason 
to perpetuate the problem. :))

Also, your new library files, such as lib/cocoa/src/TBaseClient.h, should avoid 
the declaration of ivars on {{@interface}}, as that's been deprecated. Instead, 
put them on the class extension or on {{@implementation}}. See THRIFT-2982.

> Generate asynchronous clients for Cocoa
> ---------------------------------------
>
>                 Key: THRIFT-3041
>                 URL: https://issues.apache.org/jira/browse/THRIFT-3041
>             Project: Thrift
>          Issue Type: Improvement
>          Components: Cocoa - Compiler, Cocoa - Library
>            Reporter: Mike Riley
>             Fix For: 0.9.3
>
>         Attachments: async-clients.diff
>
>
> I've been using thrift on a decent variety of iOS projects for the last ~4 
> years. Every time I set a new project up, I invariably end up inventing some 
> way to invoke thrift RPC calls via Objective-C block syntax.  I usually end 
> up ripping apart the generated classes by declaring their private methods, 
> and then writing a bunch of boilerplate all so that I can avoid using the 
> provided HTTP client, which makes synchronous requests.
> This is a decent stab at letting the generator take care of this problem for 
> me, and everyone else.  It ended up being pretty heavy handed with 
> t_cocoa_generator.cc, but I've spent a while testing this and am pretty 
> confident I managed to avoid breaking anything.  I realize this is a large 
> change, so I've put up the sandbox I was using to test on github if that 
> makes it easier to review.  If you want the tl;dr; about what practical 
> changes this has on generated sources:
> https://github.com/yelirekim/thrift-cocoa-love/blob/master/thrift-cocoa-love/ViewController.m
> https://github.com/yelirekim/thrift-cocoa-love/blob/master/gen-cocoa/asdf.h
> I'd welcome feedback or proposed modifications if this approach isn't quite 
> right.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to