Created
January 6, 2016 08:47
-
-
Save keitaoouchi/7fa4a5a8d9010541f655 to your computer and use it in GitHub Desktop.
Observing notifications from iTunes on OSX
This file contains 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
import Cocoa | |
let nc = NSDistributedNotificationCenter.defaultCenter() | |
nc.addObserverForName(nil, object: nil, queue: nil) { notification in | |
if let info = notification.userInfo where notification.name == "com.apple.iTunes.playerInfo" { | |
print(info) | |
} | |
} | |
NSRunLoop.mainRunLoop().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment