Created
February 25, 2019 14:01
-
-
Save ramiresnas/758a46a6f58f65349872ce62090f90e7 to your computer and use it in GitHub Desktop.
Comunicação com GameController
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
override func viewDidLoad() { | |
super.viewDidLoad() | |
let center = NotificationCenter.default | |
let notification: NSNotification.Name = Notification.Name.GCControllerDidConnect | |
let selector = #selector(didConnection) | |
center.addObserver(self, selector: selector, name: notification, object: nil) | |
} | |
@objc func didConnection(){ | |
guard let controller = GCController.controllers().first else { | |
print("algo deu errado") | |
return | |
} | |
print(controller.vendorName ?? "sem nome de fornecedor") | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment