Skip to content

Commit 4409c55

Browse files
committed
still more selector syntax changes for Swift 2.2
1 parent 88fbb81 commit 4409c55

File tree

8 files changed

+14
-12
lines changed

8 files changed

+14
-12
lines changed

bk2ch06p281navigationInterface/ch19p615navigationInterface/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class ViewController : UIViewController, UINavigationControllerDelegate {
88
super.awakeFromNib()
99

1010
self.title = "First"
11-
let b = UIBarButtonItem(image:UIImage(named:"key.png"), style:.Plain, target:self, action:"navigate")
11+
let b = UIBarButtonItem(image:UIImage(named:"key.png"), style:.Plain, target:self, action:#selector(navigate))
1212
let b2 = UIBarButtonItem(image:UIImage(named:"files.png"),
1313
style:.Plain, target:nil, action:nil)
1414
self.navigationItem.rightBarButtonItems = [b, b2]

bk2ch06p296customAnimation2/ch19p620customAnimation1/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ class AppDelegate : UIResponder, UIApplicationDelegate, UITabBarControllerDelega
2727
// keep ref to g.r.s, because can't learn which one it is by asking for "edges" later
2828
// (always comes back as None)
2929

30-
let sep = UIScreenEdgePanGestureRecognizer(target:self, action:"pan:")
30+
let sep = UIScreenEdgePanGestureRecognizer(target:self, action:#selector(pan))
3131
sep.edges = UIRectEdge.Right
3232
tbc.view.addGestureRecognizer(sep)
3333
sep.delegate = self
3434
self.rightEdger = sep
3535

36-
let sep2 = UIScreenEdgePanGestureRecognizer(target:self, action:"pan:")
36+
let sep2 = UIScreenEdgePanGestureRecognizer(target:self, action:#selector(pan))
3737
sep2.edges = UIRectEdge.Left
3838
tbc.view.addGestureRecognizer(sep2)
3939
sep2.delegate = self

bk2ch06p300customAnimation3/ch19p620customAnimation1/AppDelegate.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@ class AppDelegate : UIResponder, UIApplicationDelegate, UITabBarControllerDelega
2020
// keep ref to g.r.s, because can't learn which one it is by asking for "edges" later
2121
// (always comes back as None)
2222

23-
let sep = UIScreenEdgePanGestureRecognizer(target:self, action:"pan:")
23+
let sep = UIScreenEdgePanGestureRecognizer(target:self, action:#selector(pan))
2424
sep.edges = UIRectEdge.Right
2525
tbc.view.addGestureRecognizer(sep)
2626
sep.delegate = self
2727
self.rightEdger = sep
2828

29-
let sep2 = UIScreenEdgePanGestureRecognizer(target:self, action:"pan:")
29+
let sep2 = UIScreenEdgePanGestureRecognizer(target:self, action:#selector(pan))
3030
sep2.edges = UIRectEdge.Left
3131
tbc.view.addGestureRecognizer(sep2)
3232
sep2.delegate = self

bk2ch06p301customAnimation4/NavCustomPushTest/MasterViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ class MasterViewController : UITableViewController {
55

66
override func viewDidLoad() {
77
super.viewDidLoad()
8-
let b = UIBarButtonItem(title: "Push", style: .Plain, target: self, action: "doPush:")
8+
let b = UIBarButtonItem(title: "Push", style: .Plain, target: self, action: #selector(doPush))
99
self.navigationItem.rightBarButtonItem = b
1010
}
1111

bk2ch06p336memoryWarning/ch19p647memoryWarning/ViewController.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,17 @@ class ViewController : UIViewController {
101101

102102
// on device
103103

104+
// ignore compiler warning, it's private API (you'd have to remove it from shipping code)
105+
104106
@IBAction func doButton2(sender: AnyObject) {
105-
UIApplication.sharedApplication().performSelector("_performMemoryWarning")
107+
UIApplication.sharedApplication().performSelector(Selector("_performMemoryWarning"))
106108
}
107109

108110
// backgrounding
109111

110112
override func viewDidLoad() {
111113
super.viewDidLoad()
112-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "backgrounding:", name: UIApplicationDidEnterBackgroundNotification, object: nil)
114+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(backgrounding), name: UIApplicationDidEnterBackgroundNotification, object: nil)
113115
}
114116

115117
func backgrounding(n:NSNotification) {

bk2ch06p347SimplestRestorationExample2/ch19p652SimplestRestorationExample2/PresentedViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class PresentedViewController : UIViewController {
3232
let button = UIButton(type:.System)
3333
button.setTitle("Dismiss", forState:.Normal)
3434
button.addTarget(self,
35-
action:"doDismiss:",
35+
action:#selector(doDismiss),
3636
forControlEvents:.TouchUpInside)
3737
button.sizeToFit()
3838
button.center = self.view.center

bk2ch06p347SimplestRestorationExample2/ch19p652SimplestRestorationExample2/RootViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ class RootViewController : UIViewController {
3131
print("view did load \(self.dynamicType)")
3232
self.view.backgroundColor = UIColor.greenColor()
3333
let b = UIBarButtonItem(title:"Push",
34-
style:.Plain, target:self, action:"doPush:")
34+
style:.Plain, target:self, action:#selector(doPush))
3535
self.navigationItem.rightBarButtonItem = b
3636
let button = UIButton(type:.System)
3737
button.setTitle("Present", forState:.Normal)
3838
button.addTarget(self,
39-
action:"doPresent:",
39+
action:#selector(doPresent),
4040
forControlEvents:.TouchUpInside)
4141
button.sizeToFit()
4242
button.center = self.view.center

bk2ch06p347SimplestRestorationExample2/ch19p652SimplestRestorationExample2/SecondViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class SecondViewController : UIViewController {
3333
let button = UIButton(type:.System)
3434
button.setTitle("Present", forState:.Normal)
3535
button.addTarget(self,
36-
action:"doPresent:",
36+
action:#selector(doPresent),
3737
forControlEvents:.TouchUpInside)
3838
button.sizeToFit()
3939
button.center = self.view.center

0 commit comments

Comments
 (0)