Get Updates By E-mail 

Article Written By:
Johann Dowa

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 and 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.


  •  
  •  
  •  
  •  
  •  

Submit A Resource

Have you created a useful tutorial, library or tool for iOS development that you would like to get in front of our 300,000+ monthly page views from iOS developers?

You can submit the url here.

The resources we feel will appeal to our readers the most will be posted on the front page.

Comments