Open Source Swift Library Simplifying Use Of NSURLSession

A couple of weeks ago I mentioned a library providing a a nice clean syntax for working with JSON in Swift.

Here’s a Swift library that wraps NSURLSession providing a simplifed syntax called SwiftHTTP from Dalton Cherry.

SwiftHTTP provides a nice clean syntax for GET, POST, PUT, DELETE and HEAD requests with base URL parameter for easier RESTful API interaction.   There is also support for request nad repsonse serialization.

Here’s an example from the readme showing a basic GET request:

var request = HTTPTask()
request.HEAD("http://domain.com/image.png", parameters: nil, success: {(response: AnyObject?) -> Void in
        println("The file does exist!")
    },failure: {(error: NSError) -> Void in
        println("File not found: (error)")
    })

You can find SwiftHTTP on Github here.

A nice library for cleaner HTTP interaction in Swift.

FacebookTwitterDiggStumbleUponGoogle Plus

Original article: Open Source Swift Library Simplifying Use Of NSURLSession

©2014 iOS App Dev Libraries, Controls, Tutorials, Examples and Tools. All Rights Reserved.

Leave a Reply

Your email address will not be published. Required fields are marked *