Camelcasing & Underscoring Strings in Objective-C
Nowadays it’s all about API’s, 3rd party services and what not. In iOS universe this means connecting to remote web servers and fetching the data in [mostrly] JSON format. This is the place where the trouble starts. It’s all fine and dandy if you’re pals with web developer that coded the service and you don’t have to “map” the web parameter names to your core data attributes. But what if you’re not?
If you still haven’t recognized the problem from post’s title - I am talking about making web_app_url_parameters to pretty coreDataObjectAttributes and back. There are many heavy-weight solutions for this. I think RestKit is one of them, but I haven’t tried it so can not speak for it.
Me? I like to be dead simple. You know, SRP’n’stuff. I wrote a couple of categories for NSString class that does exactly that. With some options. So probably there goes my “dead simple”, but none the less. And as an extra bonus I did it using TDD (mad propz to Jon Reid and Graham Lee). To make it even simpler and faster I used only C string functions and no calls to Objective-C string/array methods.