Darwin Notifications in Swift

I am trying to observe for the Darwin notification () in swift. So far I have:

 

  let cfstr: CFString = “com.apple.springboard.hasBlankedScreen” as NSString

  let notificationCenter = CFNotificationCenterGetDarwinNotifyCenter()

  let function = CFNotificationCallback(backgroundBrightnessFunction)

 

  CFNotificationCenterAddObserver(notificationCenter,

  nil,

  function,

  cfstr,

  nil,

  CFNotificationSuspensionBehavior.deliverImmediately);

 

 

But the call back function field isn’t allowing me to out in a normal function. How do I write a function in swift that has the CFnotificationCallback type?

 

Thanks,

 

Feras A.

Powered by WPeMatico

About

You may also like...

Comments are closed.