Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-3041

Generate asynchronous clients for Cocoa

    XMLWordPrintableJSON

Details

    • Patch Available

    Description

      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.

      Attachments

        1. async-clients.diff
          26 kB
          Mike Riley

        Activity

          People

            jensg Jens Geyer
            yelirekim Mike Riley
            Votes:
            1 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: