Skip to content

Commit

Permalink
Updated for swift changes
Browse files Browse the repository at this point in the history
  • Loading branch information
subdigital committed Aug 9, 2014
1 parent 6e8fb3f commit f6c3114
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 128-swift-networking/Guardfile
Expand Up @@ -10,6 +10,6 @@ guard :shell do
puts
puts
puts "Running #{m[0]}"
puts `swift -i #{m[0]} -sdk $(xcrun --show-sdk-path --sdk macosx)`
puts `swift #{m[0]} -sdk $(xcrun --show-sdk-path --sdk macosx)`
end
end
8 changes: 4 additions & 4 deletions 128-swift-networking/networking.swift
Expand Up @@ -2,8 +2,8 @@ import Foundation

class Downloader {
let url: NSURL
@lazy var config = NSURLSessionConfiguration.defaultSessionConfiguration()
@lazy var session: NSURLSession = NSURLSession(configuration: self.config)
lazy var config = NSURLSessionConfiguration.defaultSessionConfiguration()
lazy var session: NSURLSession = NSURLSession(configuration: self.config)
var running = false

typealias JSONArrayCompletion = (Array<AnyObject>?) -> ()
Expand All @@ -17,13 +17,13 @@ class Downloader {
(let data, let response, let error) in
if let httpResponse = response as? NSHTTPURLResponse {
println("got some data")
switch(httpResponse.statusCode()) {
switch(httpResponse.statusCode) {
case 200:
println("got a 200")
self.parseJson(data, completion: completion)

default:
println("Got an HTTP \(httpResponse.statusCode())")
println("Got an HTTP \(httpResponse.statusCode)")
}
} else {
println("I don't know how to handle non-http responses")
Expand Down

0 comments on commit f6c3114

Please sign in to comment.