I am trying to observe for the Darwin notification () in swift. So far I have:
// CoreFoundation compatible types
let cfstr: CFString = "com.apple.springboard.hasBlankedScreen" as NSString
let notificationCenter = CFNotificationCenterGetDarwinNotifyCenter()
let function = CFNotificationCallback(backgroundBrightnessFunction)
//CFNotificationCenterAddObserver(notificationCenter, self, backgroundBrightnessFunction, cfstr, nil, CFNotificationSuspensionBehavior.deliverImmediately)
CFNotificationCenterAddObserver(notificationCenter, //center
nil, // observer
function, // callback
cfstr, //CFSTR("com.apple.springboard.lockcomplete"), // event name
nil, // object
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.