<a href="http://stackkit.com">**StackKit**</a>
============

StackKit is a library for accessing the Stack Exchange API from within Cocoa/Cocoa Touch applications.  It is heavily modeled after Core Data and behaves very similarly.

**Sample Code**
---------------

Using StackKit relies upon creating an `SKSite` object:

    SKSite * stackOverflow = [SKSite siteWithAPIURL:[NSURL URLWithString:@"http://api.stackoverflow.com"]];

Sites can also be discovered via the StackAuth API, like so:

    NSArray * knownSites = [SKSite knownSites]; //returns an array of SKSite objects

Requesting information can be done via an `SKFetchRequest` object (nearly identical to an `NSFetchRequest`):

    SKFetchRequest * request = [[SKFetchRequest alloc] init];

    //The kind of object you want to request:
    [request setEntity:[SKUser class]];

    //The predicate to limit the results.  This particular predicate will fetch one user with the id "115730"
    [request setPredicate:[NSPredicate predicateWithFormat:@"%K = %d", SKUserID, 115730]];

Once you've created your fetch request, there are two ways you can execute it: synchronously (which will block the calling thread) or asynchronously (which won't block the thread).

Synchronous:

    NSError * error = nil;
    NSArray * results = [stackOverflow executeSynchronousFetchRequest:request error:&error];

If the request was successful, then `results` will contain one or more `SKUser` objects (depending on the predicate).  If there was an error with the request, then the `NSError` object will be filled in with appropriate information and `results` will be `nil`.

Asynchronous:

    [request setDelegate:self];  //self must conform to the <SKFetchRequestDelegate> protocol
    [stackOverflow executeFetchRequest:request];

When the request finishes, it will invoke one of:

    - (void) fetchRequest:(SKFetchRequest *)request didReturnResults:(NSArray *)results;
    - (void) fetchRequest:(SKFetchRequest *)request didFailWithError:(NSError *)error;

**About**
---------

StackKit is being developed by myself ([Dave DeLong][davedelong]), with assistance from [Perspx][perspx].  It is currently in active development, and not all features may be working yet. :)

**License**
-----------

StackKit is available under the [MIT license][1].

**Platforms**
-------------

StackKit is being developed as a Mac framework (compatible with both 10.5 and 10.6) and as an iPhone/iPad static library.  Two project files are included in the source: one for the Mac framework, and the other for the static library.

**Contributing**
----------------

If you'd like to contribute, please visit http://stackkit.com.  If you can't contribute time, you could consider donating via our <a href="http://pledgie.com/campaigns/10823">Pledgie account</a> to further incentivize us to keep working on it.

  [1]: http://creativecommons.org/licenses/MIT/
  [davedelong]: http://stackoverflow.com/users/115730/dave-delong
  [perspx]: http://stackoverflow.com/users/75245/perspx