Open beltex opened 9 years ago
Thanks for filing this issue.
We could do this for Swift source right now, but we'd first have to identify how Xcode generates the -Swift.h
file.
Same here. It would be very nice to have both declarations (obj-c and swift) in jazzy doc.
There's a proof of concept PR towards SourceKitten that builds towards this: https://github.com/jpsim/SourceKitten/pull/95
Don't mean to hijack the thread, but maybe you can help: I want to generate the Swift Interface for our ObjC Bridging Header via commandline, is that somehow possible (without generating the full-fledged documentation from jazzy)?
As of #530, Objective-C declarations also include their Swift equivalent when appropriate.
I haven't found a good way to do it the other way around though, so I'd appreciate any help from contributors here 😄
Seems that this issue has been resolved so I'm going to close the issue. Lmk if I'm wrong or if we need to reopen the issue.
Are you sure? Last I checked, jazzy generated Swift signatures for Objective-C symbols, but not the other way around.
I'll look into it. Re-opening for now.
I still haven't figured out how to perform the swift->objc translation.
Just wondering if there is any progress on this since it has been two years.
If you (or anyone!) would like to work on this, the best way I've come up with to do this is:
As PoC, drive from jazzy layer:
@objc
.)
Use swiftc -emit-objc-header-path
and build module, or dig out of initial sourcekitten build, experimentation needed for most efficient ways .... sourcekitten doc --objc
on the bridging header.Fully integrated version would do 1-3 in sourcekitten and could optimise the 2/3 steps by just pointing libclang at the header and iterating over it for USRs without generating the intermediate json.
I'm certain this is already known, but thought it be handy to have as a placeholder for reference nonetheless. Feel free to close if not, and of course #56 is a pre-req for this.
Independent of the source of the API (C/Obj-C, Swift), generate the interface (declarations) for both Objectivce-C & Swift (as an option) as seen in Apple's docs already (with the
Language
option). Of course, not everything translates both ways (complex macros --> Swift, tuples --> Obj-C).As a side note, for those interested in this from the Swift side, the
@objc
annotation in Swift would help. Tells the compiler to check if the method in question is compatible with Objective-C. See Using Swift with Cocoa and Objective-C book from Apple for more.