Book Image

RestKit for iOS

By : Taras Kalapun
Book Image

RestKit for iOS

By: Taras Kalapun

Overview of this book

<p>RestKit is an iOS framework for streamlining communication with web services, and it relies on the AFNetworking library that is used by thousands of app developers. It has an interface that is elegant and well designed, and it provides a powerful object-mapping engine that integrates well with the CoreData database. RestKit for iOS will teach you everything from loading a simple list of objects to creating a fully-featured app.<br /><br />RestKit for iOS delivers constructive tools and insights into app development that will benefit any app developer. The book starts with a simple example and then moves on to more complex ones as your knowledge increases. By the end of the guide, you will be able to build a fully-featured app that uses RESTful web services and performs CRUD object manipulation.<br /><br />RestKit for iOS will provide you with all the information you need to boost the development process of both simple and complex apps. Once you have executed a simple example and reviewed the basic theory, you will move on to more advanced concepts with descriptions of real-life scenarios and how to overcome bottlenecks. RestKit for iOS is full of real-life examples that show you how to simplify data loading, basic and advanced object mapping, metadata mapping, and routing. This book also teaches you about routing, RESTful object manipulation and synchronization, integration with the user interface, and caching</p>
Table of Contents (13 chapters)

Routing inside out


One of the most useful powers of object manager is that it has a so-called Router. It simplifies the generation of request URLs and helps developers maintain the path patterns. Once the Router is configured, it gives the ability to stop worrying about what endpoint to be used to make the next request, as all the object manager request methods will use the power of the Router. Using a centralized knowledge, a Router will know how to generate an appropriate URL for specific objects, request methods, or names. This greatly simplifies the amount of code you write and improves readability.

URLs will be generated by the Router using three types of routes:

  • Named routes: They are like a named symbolic link. This type of route is not related to any particular class. It represents a single path and an optional HTTP request method. As an example, one can define such a route with the name database_list, which will be a GET request to a list of databases with the path /databases.

  • Class...