Skip to content

Commit ccf3460

Browse files
committed
update for Swift 1.2, Xcode 6.3
1 parent 45b8c72 commit ccf3460

File tree

6 files changed

+11
-11
lines changed

6 files changed

+11
-11
lines changed

bk2ch24p834simpleHTTP/ch37p1088simpleHTTP/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ class ViewController: UIViewController {
1818
println(error)
1919
return
2020
}
21-
let status = (response as NSHTTPURLResponse).statusCode
21+
let status = (response as! NSHTTPURLResponse).statusCode
2222
println("response status: \(status)")
2323
if status != 200 {
2424
println("oh well")

bk2ch24p837lessSimpleHTTP/ch37p1089lessSimpleHTTP/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class ViewController: UIViewController, NSURLSessionDownloadDelegate {
5858
}
5959
}
6060
self.task = nil
61-
let response = downloadTask.response as NSHTTPURLResponse
61+
let response = downloadTask.response as! NSHTTPURLResponse
6262
let stat = response.statusCode
6363
println("status \(stat)")
6464
if stat != 200 {

bk2ch24p842downloader/ch37p1099downloader/MyDownloader.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,15 @@ class MyDownloader: NSObject, NSURLSessionDownloadDelegate {
4545
func URLSession(session: NSURLSession, downloadTask: NSURLSessionDownloadTask, didFinishDownloadingToURL location: NSURL) {
4646
let req = downloadTask.originalRequest
4747
let ch : AnyObject = NSURLProtocol.propertyForKey("ch", inRequest:req)!
48-
let response = downloadTask.response as NSHTTPURLResponse
48+
let response = downloadTask.response as! NSHTTPURLResponse
4949
let stat = response.statusCode
5050
println("status \(stat)")
5151
var url : NSURL! = nil
5252
if stat == 200 {
5353
url = location
54-
println("download \(req.URL.lastPathComponent)")
54+
println("download \(req.URL!.lastPathComponent)")
5555
}
56-
let ch2 = (ch as Wrapper).p as MyDownloaderCompletion
56+
let ch2 = (ch as! Wrapper).p as MyDownloaderCompletion
5757
if self.main {
5858
ch2(url)
5959
} else {

bk2ch24p842downloader/ch37p1099downloader/MyTableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class MyTableViewController: UITableViewController {
5050
}
5151

5252
override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
53-
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath:indexPath) as UITableViewCell
53+
let cell = tableView.dequeueReusableCellWithIdentifier("Cell", forIndexPath:indexPath) as! UITableViewCell
5454
let m = self.model[indexPath.row]
5555
cell.textLabel!.text = m.text
5656
// have we got a picture?

bk2ch24p846backgroundDownload/ch37p1100backgroundDownload/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ class ViewController: UIViewController {
1616
@IBAction func doStart (sender:AnyObject!) {
1717
self.prog.progress = 0
1818
self.iv.image = nil
19-
let del = UIApplication.sharedApplication().delegate as AppDelegate
19+
let del = UIApplication.sharedApplication().delegate as! AppDelegate
2020
del.startDownload(self)
2121
}
2222

2323
func grabPicture () {
24-
let del = UIApplication.sharedApplication().delegate as AppDelegate
24+
let del = UIApplication.sharedApplication().delegate as! AppDelegate
2525
self.iv.image = del.image
2626
del.image = nil
2727
if self.iv.image != nil {
@@ -51,7 +51,7 @@ class ViewController: UIViewController {
5151
}
5252

5353
func crash (sender:AnyObject?) {
54-
let s = sender as String
54+
let s = sender as! String
5555
}
5656

5757

bk2ch24p853bonjour/ch37p1101bonjour/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,15 @@ class ViewController: UIViewController, NSNetServiceBrowserDelegate, NSNetServic
3535
self.updateInterface()
3636
}
3737

38-
func netServiceBrowser(aNetServiceBrowser: NSNetServiceBrowser, didFindService aNetService: NSNetService!, moreComing: Bool) {
38+
func netServiceBrowser(aNetServiceBrowser: NSNetServiceBrowser, didFindService aNetService: NSNetService, moreComing: Bool) {
3939
println("adding a service")
4040
self.services.append(aNetService)
4141
if !moreComing {
4242
self.updateInterface()
4343
}
4444
}
4545

46-
func netServiceBrowser(aNetServiceBrowser: NSNetServiceBrowser, didRemoveService aNetService: NSNetService!, moreComing: Bool) {
46+
func netServiceBrowser(aNetServiceBrowser: NSNetServiceBrowser, didRemoveService aNetService: NSNetService, moreComing: Bool) {
4747
if let ix = find(self.services, aNetService) {
4848
self.services.removeAtIndex(ix)
4949
println("removing a service")

0 commit comments

Comments
 (0)