Browse Source

Updated download code sample in the README to compile against Swift 2.0.

Screon 10 years ago
parent
commit
401e76a9c4
1 changed files with 3 additions and 5 deletions
  1. 3 5
      README.md

+ 3 - 5
README.md

@@ -412,12 +412,10 @@ Alamofire.upload(
 ```swift
 Alamofire.download(.GET, "http://httpbin.org/stream/100") { temporaryURL, response in
     let fileManager = NSFileManager.defaultManager()
-    if let directoryURL = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0] as? NSURL {
-        let pathComponent = response.suggestedFilename
-        return directoryURL.URLByAppendingPathComponent(pathComponent!)
-    }
+    let directoryURL = fileManager.URLsForDirectory(.DocumentDirectory, inDomains: .UserDomainMask)[0]
+    let pathComponent = response.suggestedFilename
 
-    return temporaryURL
+    return directoryURL.URLByAppendingPathComponent(pathComponent!)
 }
 ```