-
Notifications
You must be signed in to change notification settings - Fork 412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Generate Objective-C interfaces for Swift declarations #136
Comments
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 #56 will of course be a pre-requisite to generating the Swift version of Objective-C declarations. |
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: jpsim/SourceKitten#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:
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.The text was updated successfully, but these errors were encountered: