On macOS CoreAudio plugin development, I try to call Swift func from Objective-C code. But I get error:
Use of undeclared identifier 'MySwiftClass'
I checked these.
- Add "@objc" on Swift class and public func.
- #import "[MyTarget]-Swift.h" on Objective-C code
- On Xcode "Target Membership" of MySwiftClass.swift, MyTarget is checked.
- Set Swift version to Swift5.
- Set macOS min support to 12.3.
- Run xcodebuild on command line and fixed all error
But "[MyTarget]-Swift.h" under ~/Library/Developer/Xcode/DerivedData/[MyProject]-[hash] has no declaration of MySwiftClass
I like to know command to generate [MyTarget]-Swift.h, and find out why MySwiftClass is ignored.
If target is macOS app, I can call Swift func from Objective-C code.
I found Xcode [Target]-Swift.h gen tool does not care about "Target Membership". It only see swift files under MyTarget directory.
Failed case files location
Success case files location