Using CFNotificationCallback in Swift, or, @convention(c) blocks in Swift
问题 I am trying to listen to CoreTelephony notifications using the (now private) CTTelephonyCenterAddObserver C function and CFNotificationCallback callback blocks. My bridging header (to extern the private C functions): #include <CoreFoundation/CoreFoundation.h> #if __cplusplus extern "C" { #endif #pragma mark - API /* This API is a mimic of CFNotificationCenter. */ CFNotificationCenterRef CTTelephonyCenterGetDefault(); void CTTelephonyCenterAddObserver(CFNotificationCenterRef center, const void