Skip to content

Instantly share code, notes, and snippets.

@aaustin
Last active August 29, 2015 14:05
Show Gist options
  • Save aaustin/a9f5ddd18ba2b734d895 to your computer and use it in GitHub Desktop.
Save aaustin/a9f5ddd18ba2b734d895 to your computer and use it in GitHub Desktop.

BRANCH IOS MOBILE CHALLENGE

Thanks for your interest in Branch!

Specs

The challenge is to build a crash-resistent, and globally accesssible queue (+ extra) for our iOS SDK. Using Objective C, build a queue that holds ServerRequest custom objects (see below for the spec on that).

Some specs:

  1. The same instance of the queue should be accessible anywhere in the app without passing it as a parameter. For example, the state of the queue to persist throughout the entire life cycle of the application, and be accessible from any View Controller. That means, in View Controller 1, a user could insert a ServerRequest object into the queue. Then in View Controller 2, the user could consume that same ServerRequest object.
  2. It must be crash/close resistant, and recover queue state in the event of an app crash or app close. That means that any ServerRequests in the queue would still be there on app restart (post crash).
  3. Stores ServerRequest objects
  4. Support the functions
  • enqueue
  • dequeue
  • peek
  • peek at
  • insert at
  • remove at
  • get size
// ServerRequest.h

@interface ServerRequest : NSObject

@property (strong, nonatomic) NSString *tag;
@property (strong, nonatomic) NSDictionary *postData;

@end

Format of submission

Send alex@branchmetrics.io the .h and .m files for your class.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment