DispatchQueue extension

I have an extension on DispatchQueue and I have Objective-C code which uses my swift code, so the DispatchQueue extension is exported to the Swift objective-c header as

@interface OS_dispatch_queue

However, Xcode 8.0 and 8.2b2 both error ‘Cannot find interface declaration for ‘OS_dispatch_queue’’. I’ve reported this as a bug, but is there any way I can stop the code being exported to objective-c in the interim?

Thanks

Nick

I tried replicating this myself and couldn’t. Specifically, in Xcode 8.0:

1. I created a command line tool project

2. added `test.swift`, which looks like this:

import Foundation

extension DispatchQueue {
    func foo() {
    }
}

extension NSCoder {
    func bar() {
    }
}

3. added an Objective-C class which imported <xxx-Swift.h>, where `xxx` is the target name

It built just fine. Looking at <xxx-Swift.h>, I see `bar` generates code like this:

@interface NSCoder (SWIFT_EXTENSION(xxst))
- (void)bar;
@end

but I see no reference to `foo` or `OS_dispatch_queue`. What am I missing here?

Other than your bug number (-: Please post that.

Share and Enjoy

···

On 6 Oct 2016, at 20:20, Nick Brook via swift-users <swift-users@swift.org> wrote:

I have an extension on DispatchQueue and I have Objective-C code which uses my swift code, so the DispatchQueue extension is exported to the Swift objective-c header as

@interface OS_dispatch_queue

However, Xcode 8.0 and 8.2b2 both error ‘Cannot find interface declaration for ‘OS_dispatch_queue’’. I’ve reported this as a bug, but is there any way I can stop the code being exported to objective-c in the interim?

--
Quinn "The Eskimo!" <http://www.apple.com/developer/&gt;
Apple Developer Relations, Developer Technical Support, Core OS/Hardware