Last active
September 17, 2019 16:57
-
-
Save soapyigu/11b1c85051b1c43b32c44d814d34f6f3 to your computer and use it in GitHub Desktop.
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
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { | |
NotificationCenter.default.addObserver(self, selector: Selector(("volumeDidChange:")), name: NSNotification.Name(rawValue: "AVSystemController_SystemVolumeDidChangeNotification"), object: nil) | |
return true | |
} | |
func volumeDidChange(notification: NSNotification) { | |
let volume = notification.userInfo!["AVSystemController_AudioVolumeNotificationParameter"] as! Float | |
// Volume at your service | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment