2

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.

1

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.