Skip to content

Commit

Permalink
updated addTarget selectors to the new Swift2.2 #selector syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Wade Sellers committed Mar 22, 2016
1 parent d32ff79 commit 69e3674
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion SwiftRadio/Libraries/Spring/KeyboardLayoutConstraint.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class KeyboardLayoutConstraint: NSLayoutConstraint {

offset = constant

NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillShowNotification:", name: UIKeyboardWillShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(KeyboardLayoutConstraint.keyboardWillShowNotification(_:)), name: UIKeyboardWillShowNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: "keyboardWillHideNotification:", name: UIKeyboardWillHideNotification, object: nil)
}

Expand Down
2 changes: 1 addition & 1 deletion SwiftRadio/Libraries/Spring/Spring.swift
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public class Spring : NSObject {
}

func commonInit() {
NSNotificationCenter.defaultCenter().addObserver(self, selector: "didBecomeActiveNotification:", name: UIApplicationDidBecomeActiveNotification, object: nil)
NSNotificationCenter.defaultCenter().addObserver(self, selector: #selector(Spring.didBecomeActiveNotification(_:)), name: UIApplicationDidBecomeActiveNotification, object: nil)
}

func didBecomeActiveNotification(notification: NSNotification) {
Expand Down
4 changes: 2 additions & 2 deletions SwiftRadio/NowPlayingViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ class NowPlayingViewController: UIViewController {

// Notification for when app becomes active
NSNotificationCenter.defaultCenter().addObserver(self,
selector: "didBecomeActiveNotificationReceived",
selector: #selector(NowPlayingViewController.didBecomeActiveNotificationReceived),
name:"UIApplicationDidBecomeActiveNotification",
object: nil)

// Notification for MediaPlayer metadata updated
NSNotificationCenter.defaultCenter().addObserver(self,
selector: Selector("metadataUpdated:"),
selector: #selector(NowPlayingViewController.metadataUpdated(_:)),
name:MPMoviePlayerTimedMetadataUpdatedNotification,
object: nil);

Expand Down
2 changes: 1 addition & 1 deletion SwiftRadio/PopUpMenuViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class PopUpMenuViewController: UIViewController {
view.backgroundColor = UIColor.clearColor()

// Add gesture recognizer to dismiss view when touched
let gestureRecognizer = UITapGestureRecognizer(target: self, action: Selector("closeButtonPressed"))
let gestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(PopUpMenuViewController.closeButtonPressed))
backgroundView.userInteractionEnabled = true
backgroundView.addGestureRecognizer(gestureRecognizer)
}
Expand Down
4 changes: 2 additions & 2 deletions SwiftRadio/StationsViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ class StationsViewController: UIViewController {
self.refreshControl.attributedTitle = NSAttributedString(string: "Pull to refresh", attributes: [NSForegroundColorAttributeName:UIColor.whiteColor()])
self.refreshControl.backgroundColor = UIColor.blackColor()
self.refreshControl.tintColor = UIColor.whiteColor()
self.refreshControl.addTarget(self, action: "refresh:", forControlEvents: UIControlEvents.ValueChanged)
self.refreshControl.addTarget(self, action: #selector(StationsViewController.refresh(_:)), forControlEvents: UIControlEvents.ValueChanged)
self.tableView.addSubview(refreshControl)
}

Expand All @@ -135,7 +135,7 @@ class StationsViewController: UIViewController {

func createNowPlayingBarButton() {
if self.navigationItem.rightBarButtonItem == nil {
let btn = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: self, action:"nowPlayingBarButtonPressed")
let btn = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: self, action:#selector(StationsViewController.nowPlayingBarButtonPressed))
btn.image = UIImage(named: "btn-nowPlaying")
self.navigationItem.rightBarButtonItem = btn
}
Expand Down

0 comments on commit 69e3674

Please sign in to comment.