Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ishkawa committed Feb 18, 2015
1 parent e50ff78 commit 8760a5a
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,26 @@ APIKit

protocol set for building type safe web API client in Swift.

## Example

```swift
let request = GitHub.Request.SearchRepositories(query: "APIKit")

GitHub.sendRequest(request) { response in
switch response {
case .Success(let box):
self.repositories = box.unbox // type of response object is inferred by request

case .Failure(let box):
let alertController = UIAlertController(title: "Error", message: box.unbox.localizedDescription, preferredStyle: .Alert)
let action = UIAlertAction(title: "OK", style: .Default, handler: nil)
alertController.addAction(action)
self.presentViewController(alertController, animated: true, completion: nil)
}
}
```

See [GitHub](https://github.com/ishkawa/APIKit/blob/master/DemoApp/GitHub.swift) and [GitHubRequests](https://github.com/ishkawa/APIKit/blob/master/DemoApp/GitHubRequests.swift) for more details.

## License

Expand Down

0 comments on commit 8760a5a

Please sign in to comment.