1 Reply
      Latest reply on Jan 13, 2020 12:02 PM by john daniel
      LunarBase Level 1 Level 1 (0 points)

        iOS has this notification that is triggered if the user or the system changes the brightness.

         

        let noteCenter = NotificationCenter.default  
        noteCenter.addObserver(self,  
            selector: #selector(brightnessDidChange),  
            name: UIScreen.brightnessDidChangeNotification,  
            object: nil)  
        @objc func brightnessDidChange() { print(UIScreen.main.brightness) } 

         

        is there something like that for macOS?

         

        Someone told me that this would be possible using CoreFoundation Callbacks, using "CFNotificationCenterAddObserver" but as expected, zero documentation on that can be found.

         

        any ideas?