Skip to content

Commit 42f90f2

Browse files
committed
finished making selector changes for Swift 2.2
1 parent 64c3f9d commit 42f90f2

File tree

40 files changed

+92
-95
lines changed

40 files changed

+92
-95
lines changed

bk2ch11p551webview/ch24p825webview/WebViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class WebViewController: UIViewController, UIWebViewDelegate, UIViewControllerRe
1616
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
1717
self.restorationIdentifier = "wvc"
1818
self.restorationClass = self.dynamicType
19-
let b = UIBarButtonItem(title:"Back", style:.Plain, target:self, action:"goBack:")
19+
let b = UIBarButtonItem(title:"Back", style:.Plain, target:self, action:#selector(goBack))
2020
self.navigationItem.rightBarButtonItem = b
2121
self.edgesForExtendedLayout = .None // get accurate offset restoration
2222
}
@@ -78,7 +78,7 @@ class WebViewController: UIViewController, UIWebViewDelegate, UIViewControllerRe
7878
// wv.scrollView.pagingEnabled = true
7979

8080
// prove that we can attach gesture recognizer to web view's scroll view
81-
let swipe = UISwipeGestureRecognizer(target:self, action:"swipe:")
81+
let swipe = UISwipeGestureRecognizer(target:self, action:#selector(swiped))
8282
swipe.direction = .Left
8383
wv.scrollView.addGestureRecognizer(swipe)
8484

@@ -96,8 +96,8 @@ class WebViewController: UIViewController, UIWebViewDelegate, UIViewControllerRe
9696
)
9797
}
9898

99-
func swipe(g:UIGestureRecognizer) {
100-
print("swipe") // okay, you proved it
99+
func swiped(g:UIGestureRecognizer) {
100+
print("swiped") // okay, you proved it
101101
}
102102

103103
let LOADREQ = 1 // 0, or try 1 for a different application...

bk2ch11p552webkit/ch24p825webview/WebViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ class WebViewController: UIViewController, WKNavigationDelegate, WKScriptMessage
159159
// wv.scrollView.pagingEnabled = true
160160

161161
// prove we can attach gesture recognizer to web view's scroll view
162-
let swipe = UISwipeGestureRecognizer(target:self, action:"swipe:")
162+
let swipe = UISwipeGestureRecognizer(target:self, action:#selector(swiped))
163163
swipe.direction = .Left
164164
wv.scrollView.addGestureRecognizer(swipe)
165165
wv.allowsBackForwardNavigationGestures = false
@@ -213,8 +213,8 @@ class WebViewController: UIViewController, WKNavigationDelegate, WKScriptMessage
213213
}
214214
}
215215

216-
func swipe(g:UIGestureRecognizer) {
217-
print("swipe") // okay, you proved it!
216+
func swiped(g:UIGestureRecognizer) {
217+
print("swiped") // okay, you proved it!
218218
}
219219

220220
override func viewDidAppear(animated: Bool) {
@@ -228,7 +228,7 @@ class WebViewController: UIViewController, WKNavigationDelegate, WKScriptMessage
228228
var which : Int { return 1 }
229229
switch which {
230230
case 1:
231-
let b = UIBarButtonItem(title: "Size", style: .Plain, target: self, action: "doDecreaseSize:")
231+
let b = UIBarButtonItem(title: "Size", style: .Plain, target: self, action: #selector(doDecreaseSize))
232232
self.navigationItem.rightBarButtonItems = [b]
233233

234234
if let oldHTMLString = self.oldHTMLString, let oldBase = self.oldBase {

bk2ch11p553webkit2/ch24p825webview/WebViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class WebViewController: UIViewController, UIViewControllerRestoration {
111111
super.viewDidAppear(animated)
112112
print("view did appear, req: \(self.wv.URL)") // no evidence that restoration is being done for us
113113

114-
let b = UIBarButtonItem(title:"Back", style:.Plain, target:self, action:"goBack:")
114+
let b = UIBarButtonItem(title:"Back", style:.Plain, target:self, action:#selector(goBack))
115115
self.navigationItem.rightBarButtonItems = [b]
116116

117117
if self.decoded {

bk2ch12p566customThermometer/ch25p840customThermometer/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ class ViewController: UIViewController {
1414
self.prog3.value = 0
1515
self.prog3.setNeedsDisplay()
1616
self.prog4.progress = 0
17-
NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: "inc:", userInfo: nil, repeats: true)
17+
NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: #selector(inc), userInfo: nil, repeats: true)
1818
}
1919

2020
override func viewDidLayoutSubviews() {

bk2ch12p567observingNSProgress/ch25p840customThermometer/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class ProgressingOperation {
77
self.progress = NSProgress(totalUnitCount: Int64(units))
88
}
99
func start() {
10-
NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: "inc:", userInfo: nil, repeats: true)
10+
NSTimer.scheduledTimerWithTimeInterval(0.4, target: self, selector: #selector(inc), userInfo: nil, repeats: true)
1111
}
1212
@objc func inc(t:NSTimer) {
1313
self.progress.completedUnitCount += 1

bk2ch12p582datePicker/bk2ch12p582datePicker/ViewController.swift

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
//
2-
// ViewController.swift
3-
// bk2ch12p582datePicker
4-
//
5-
// Created by Matt Neuburg on 4/17/15.
6-
// Copyright (c) 2015 Matt Neuburg. All rights reserved.
7-
//
81

92
import UIKit
103

bk2ch12p585slider/ch25p860slider/MySlider.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class MySlider: UISlider {
2222
required init?(coder: NSCoder) {
2323
super.init(coder:coder)
2424

25-
let t = UITapGestureRecognizer(target: self, action: "tapped:")
25+
let t = UITapGestureRecognizer(target: self, action: #selector(tapped))
2626
self.addGestureRecognizer(t)
2727

2828
// self.superview.tintColor = UIColor.redColor()

bk2ch12p606navigationBar/ch25p877navigationBar/ViewController.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ViewController: UIViewController {
5555
// set up initial state of nav item
5656

5757
let ni = UINavigationItem(title: "Tinker")
58-
let b = UIBarButtonItem(title: "Evers", style: .Plain, target: self, action: "pushNext:")
58+
let b = UIBarButtonItem(title: "Evers", style: .Plain, target: self, action: #selector(pushNext))
5959
ni.rightBarButtonItem = b
6060
self.navbar.items = [ni]
6161
}
@@ -66,7 +66,7 @@ class ViewController: UIViewController {
6666
let ni = UINavigationItem(title:s)
6767
if s == "Evers" {
6868
let b = UIBarButtonItem(
69-
title:"Chance", style: .Plain, target:self, action:"pushNext:")
69+
title:"Chance", style: .Plain, target:self, action:#selector(pushNext))
7070
ni.rightBarButtonItem = b
7171
}
7272
self.navbar.pushNavigationItem(ni, animated:true)

bk2ch13p620dialogsOniPhone/ch26p888dialogsOniPhone/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ class ViewController: UIViewController {
3838
alert.addTextFieldWithConfigurationHandler {
3939
(tf:UITextField) in
4040
tf.keyboardType = .NumberPad
41-
tf.addTarget(self, action: "textChanged:", forControlEvents: .EditingChanged)
41+
tf.addTarget(self, action: #selector(self.textChanged), forControlEvents: .EditingChanged)
4242
}
4343
func handler(act:UIAlertAction) {
4444
// it's a closure so we have a reference to the alert

bk2ch14p643ducking2/ch27p912ducking/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,9 +67,9 @@ class ViewController: UIViewController, PlayerDelegate {
6767
let scc = MPRemoteCommandCenter.sharedCommandCenter()
6868
switch which {
6969
case 0:
70-
scc.togglePlayPauseCommand.addTarget(self, action: "doPlayPause:")
71-
scc.playCommand.addTarget(self, action:"doPlay:")
72-
scc.pauseCommand.addTarget(self, action:"doPause:")
70+
scc.togglePlayPauseCommand.addTarget(self, action: #selector(doPlayPause))
71+
scc.playCommand.addTarget(self, action:#selector(doPlay))
72+
scc.pauseCommand.addTarget(self, action:#selector(doPause))
7373
case 1:
7474
opaques["playPause"] = scc.togglePlayPauseCommand.addTargetWithHandler {
7575
[unowned self] _ in

bk2ch15p660EmbeddedAVKit/EmbeddedAVKit/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ extension ViewController : UIVideoEditorControllerDelegate, UINavigationControll
148148
print("saved to \(editedVideoPath)")
149149
if UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(editedVideoPath) {
150150
print("saving to photos album")
151-
UISaveVideoAtPathToSavedPhotosAlbum(editedVideoPath, self, "video:savedWithError:ci:", nil)
151+
UISaveVideoAtPathToSavedPhotosAlbum(editedVideoPath, self, #selector(video(_:savedWithError:ci:)), nil)
152152
} else {
153153
print("can't save to photos album, need to think of something else")
154154
}

bk2ch16p678mediaQuery/ch29p946mediaQuery/ViewController.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ class ViewController: UIViewController {
6969
self.vv.setVolumeThumbImage(thumb, forState:.Normal)
7070

7171

72-
NSNotificationCenter.defaultCenter().addObserver(self, selector:"wirelessChanged:",
72+
NSNotificationCenter.defaultCenter().addObserver(self, selector:#selector(wirelessChanged),
7373
name:MPVolumeViewWirelessRoutesAvailableDidChangeNotification,
7474
object:nil)
7575
NSNotificationCenter.defaultCenter().addObserver(self,
76-
selector:"wirelessChanged2:",
76+
selector:#selector(wirelessChanged2),
7777
name:MPVolumeViewWirelessRouteActiveDidChangeNotification,
7878
object:nil)
7979

@@ -166,11 +166,11 @@ class ViewController: UIViewController {
166166
player.setQueueWithItemCollection(queue)
167167
player.shuffleMode = .Songs
168168
player.beginGeneratingPlaybackNotifications()
169-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "changed:", name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification, object: player)
169+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(changed), name: MPMusicPlayerControllerNowPlayingItemDidChangeNotification, object: player)
170170
self.q = queue // retain a pointer to the queue
171171
player.play()
172172

173-
self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: "timerFired:", userInfo: nil, repeats: true)
173+
self.timer = NSTimer.scheduledTimerWithTimeInterval(1, target: self, selector: #selector(timerFired), userInfo: nil, repeats: true)
174174
self.timer.tolerance = 0.1
175175
}
176176

bk2ch17p697pickaMovieOrPhoto/ch30p960pickaMovie/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class ViewController: UIViewController {
6161
override func viewDidAppear(animated: Bool) {
6262
super.viewDidAppear(animated)
6363
self.determineStatus()
64-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "determineStatus", name: UIApplicationWillEnterForegroundNotification, object: nil)
64+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(determineStatus), name: UIApplicationWillEnterForegroundNotification, object: nil)
6565
}
6666

6767
override func viewDidDisappear(animated: Bool) {

bk2ch17p699photoKitData/PhotoKitData/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class ViewController: UIViewController {
4646
override func viewDidAppear(animated: Bool) {
4747
super.viewDidAppear(animated)
4848
self.determineStatus()
49-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "determineStatus", name: UIApplicationWillEnterForegroundNotification, object: nil)
49+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(determineStatus), name: UIApplicationWillEnterForegroundNotification, object: nil)
5050
PHPhotoLibrary.sharedPhotoLibrary().registerChangeObserver(self) // *
5151
}
5252

bk2ch17p700PhotoKitImages/PhotoKitImages/EditingViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class EditingViewController: UIViewController, GLKViewDelegate {
4242

4343
self.edgesForExtendedLayout = UIRectEdge.None
4444

45-
let cancel = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: "doCancel:")
45+
let cancel = UIBarButtonItem(barButtonSystemItem: .Cancel, target: self, action: #selector(doCancel))
4646
self.navigationItem.leftBarButtonItem = cancel
47-
let done = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: "doDone:")
47+
let done = UIBarButtonItem(barButtonSystemItem: .Done, target: self, action: #selector(doDone))
4848
self.navigationItem.rightBarButtonItem = done
4949

5050
if self.canUndo {
51-
let undo = UIBarButtonItem(title: "Remove", style: .Plain, target: self, action: "doUndo:")
51+
let undo = UIBarButtonItem(title: "Remove", style: .Plain, target: self, action: #selector(doUndo))
5252
self.navigationItem.rightBarButtonItems = [done, undo]
5353
}
5454

bk2ch17p700PhotoKitImages/PhotoKitImages/RootViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ class RootViewController: UIViewController {
5858
override func viewDidAppear(animated: Bool) {
5959
super.viewDidAppear(animated)
6060
self.determineStatus()
61-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "determineStatus", name: UIApplicationWillEnterForegroundNotification, object: nil)
61+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(determineStatus), name: UIApplicationWillEnterForegroundNotification, object: nil)
6262
}
6363

6464
override func viewDidDisappear(animated: Bool) {

bk2ch17p702takeAPicture/ch30p962takeAPicture/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ UINavigationControllerDelegate, UIImagePickerControllerDelegate {
4545
super.viewDidAppear(animated)
4646
self.determineStatus()
4747
NSNotificationCenter.defaultCenter().addObserver(self,
48-
selector: "determineStatus",
48+
selector: #selector(determineStatus),
4949
name: UIApplicationWillEnterForegroundNotification,
5050
object: nil)
5151
}

bk2ch17p704takeAPicture2/ch30p962takeAPicture2/SecondViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class SecondViewController: UIViewController {
1111
self.image = im
1212
super.init(nibName: "SecondViewController", bundle: nil)
1313
self.title = "Decide"
14-
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Use", style: .Plain, target: self, action: "doUse:")
14+
self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "Use", style: .Plain, target: self, action: #selector(doUse))
1515
}
1616

1717
required init(coder: NSCoder) {

bk2ch17p704takeAPicture2/ch30p962takeAPicture2/ViewController.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ UINavigationControllerDelegate, UIImagePickerControllerDelegate {
5252
super.viewDidAppear(animated)
5353
self.determineStatus()
5454
NSNotificationCenter.defaultCenter().addObserver(self,
55-
selector: "determineStatus",
55+
selector: #selector(determineStatus),
5656
name: UIApplicationWillEnterForegroundNotification,
5757
object: nil)
5858
}
@@ -81,7 +81,7 @@ UINavigationControllerDelegate, UIImagePickerControllerDelegate {
8181
picker.showsCameraControls = false
8282
let f = self.view.window!.bounds
8383
let v = UIView(frame:f)
84-
let t = UITapGestureRecognizer(target:self, action:"tap:")
84+
let t = UITapGestureRecognizer(target:self, action:#selector(tap))
8585
t.numberOfTapsRequired = 2
8686
v.addGestureRecognizer(t)
8787

@@ -124,7 +124,7 @@ UINavigationControllerDelegate, UIImagePickerControllerDelegate {
124124
}
125125
nc.toolbar.setBackgroundImage(im, forToolbarPosition: .Any, barMetrics: .Default)
126126
nc.toolbar.translucent = true
127-
let b = UIBarButtonItem(title: "Cancel", style: .Plain, target: self, action: "doCancel:")
127+
let b = UIBarButtonItem(title: "Cancel", style: .Plain, target: self, action: #selector(doCancel))
128128
let lab = UILabel()
129129
lab.text = "Double tap to take a picture"
130130
lab.textColor = UIColor.whiteColor()

bk2ch18p713addressBook/ch31p973addressBook/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class ViewController: UIViewController, ABPeoplePickerNavigationControllerDelega
7878
override func viewDidAppear(animated: Bool) {
7979
super.viewDidAppear(animated)
8080
self.determineStatus()
81-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "determineStatus", name: UIApplicationWillEnterForegroundNotification, object: nil)
81+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(determineStatus), name: UIApplicationWillEnterForegroundNotification, object: nil)
8282
}
8383

8484
@IBAction func doFindMoi (sender:AnyObject!) {

bk2ch18p713addressBookNew/ch31p973addressBook/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ class ViewController : UIViewController, CNContactPickerDelegate, CNContactViewC
4343
override func viewDidAppear(animated: Bool) {
4444
super.viewDidAppear(animated)
4545
self.determineStatus()
46-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "determineStatus", name: UIApplicationWillEnterForegroundNotification, object: nil)
46+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(determineStatus), name: UIApplicationWillEnterForegroundNotification, object: nil)
4747
}
4848

4949
override func viewDidDisappear(animated: Bool) {

bk2ch19p725calendar/ch32p986calendar/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class ViewController: UIViewController, EKEventViewDelegate, EKEventEditViewDele
5555
override func viewDidAppear(animated: Bool) {
5656
super.viewDidAppear(animated)
5757
self.determineStatus()
58-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "determineStatus", name: UIApplicationWillEnterForegroundNotification, object: nil)
58+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(determineStatus), name: UIApplicationWillEnterForegroundNotification, object: nil)
5959
}
6060

6161
override func viewDidDisappear(animated: Bool) {

bk2ch19p731reminders/ch32p994reminders/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ViewController: UIViewController {
4747
override func viewDidAppear(animated: Bool) {
4848
super.viewDidAppear(animated)
4949
self.determineStatus()
50-
NSNotificationCenter.defaultCenter().addObserver(self, selector: "determineStatus", name: UIApplicationWillEnterForegroundNotification, object: nil)
50+
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(determineStatus), name: UIApplicationWillEnterForegroundNotification, object: nil)
5151
}
5252

5353
@IBAction func doNewReminder (sender:AnyObject!) {

bk2ch22p782lyingDown/ch25p1039lyingDown/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class ViewController: UIViewController {
4242
switch which {
4343
case 1:
4444
self.motman.startAccelerometerUpdates()
45-
self.timer = NSTimer.scheduledTimerWithTimeInterval(self.motman.accelerometerUpdateInterval, target: self, selector: "pollAccel:", userInfo: nil, repeats: true)
45+
self.timer = NSTimer.scheduledTimerWithTimeInterval(self.motman.accelerometerUpdateInterval, target: self, selector: #selector(pollAccel), userInfo: nil, repeats: true)
4646
case 2:
4747
self.motman.startAccelerometerUpdatesToQueue(NSOperationQueue.mainQueue(), withHandler: {
4848
(accelerometerData:CMAccelerometerData?, error:NSError?) in

bk2ch22p784smackMe/ch35p1041smackMe/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class ViewController: UIViewController {
2828
print("starting")
2929
self.motman.accelerometerUpdateInterval = 1.0 / 30.0
3030
self.motman.startAccelerometerUpdates()
31-
self.polltimer = NSTimer.scheduledTimerWithTimeInterval(self.motman.accelerometerUpdateInterval, target: self, selector: "pollAccel:", userInfo: nil, repeats: true)
31+
self.polltimer = NSTimer.scheduledTimerWithTimeInterval(self.motman.accelerometerUpdateInterval, target: self, selector: #selector(pollAccel), userInfo: nil, repeats: true)
3232
}
3333

3434
func addAcceleration(accel:CMAcceleration) {

bk2ch22p787gyro/ch25p1044gyro/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ class ViewController: UIViewController {
2424
self.motman.deviceMotionUpdateInterval = 1.0 / 30.0
2525
self.motman.startDeviceMotionUpdatesUsingReferenceFrame(ref)
2626
let t = self.motman.deviceMotionUpdateInterval * 10
27-
self.timer = NSTimer.scheduledTimerWithTimeInterval(t, target:self, selector:"pollAttitude:",userInfo:nil, repeats:true)
27+
self.timer = NSTimer.scheduledTimerWithTimeInterval(t, target:self, selector:#selector(pollAttitude),userInfo:nil, repeats:true)
2828

2929
print("starting")
3030
}

bk2ch22p789attitudeRotation/ch25p1046attitudeRotation/ViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class ViewController: UIViewController {
2525
self.motman.deviceMotionUpdateInterval = 1.0 / 20.0
2626
self.motman.startDeviceMotionUpdatesUsingReferenceFrame(ref)
2727
let t = 1.0 / 10.0
28-
self.timer = NSTimer.scheduledTimerWithTimeInterval(t, target:self, selector:"pollAttitude:",userInfo:nil, repeats:true)
28+
self.timer = NSTimer.scheduledTimerWithTimeInterval(t, target:self, selector:#selector(pollAttitude),userInfo:nil, repeats:true)
2929
}
3030

3131
func pollAttitude(_:AnyObject!) {

bk2ch22p790motionActivity/MotionActivityTest/MyTableViewController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class MyTableViewController: UITableViewController {
1313
override func viewDidLoad() {
1414
super.viewDidLoad()
1515

16-
let b = UIBarButtonItem(title: "Start", style: .Plain, target: self, action: "doStart:")
16+
let b = UIBarButtonItem(title: "Start", style: .Plain, target: self, action: #selector(doStart))
1717
self.navigationItem.rightBarButtonItem = b
1818

1919
// let ok = CMStepCounter.isStepCountingAvailable()

0 commit comments

Comments
 (0)