I made this simple extension in Swift:
extension DispatchQueue { func asyncAfter(delay: TimeInterval, block: @escaping ()->()) { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + Double(Int64(delay * Double(NSEC_PER_SEC))) / Double(NSEC_PER_SEC), execute: block) } }
In the Project-Swift.h header, it reports an error on this line:
@interface OS_dispatch_queue (SWIFT_EXTENSION(...)) - (void)asyncAfterDelay:(NSTimeInterval)delay block:(void (^ _Nonnull)(void))block; @end
Error: Cannot find interface declaration for "OS_dispatch_queue"
Is there a way to prevent the extension from being exported for Objective-C? Or is there a way to fix the error?
source share