Skip to content
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

Add option to create only Swift or Objc docs out of Objc headers #828

Closed
ulukaya opened this issue May 23, 2017 · 16 comments
Closed

Add option to create only Swift or Objc docs out of Objc headers #828

ulukaya opened this issue May 23, 2017 · 16 comments

Comments

@ulukaya
Copy link
Contributor

ulukaya commented May 23, 2017

For Objc headers,
Create the a switch/nav to go between swift/objc version or just
add an argument to create only objc or only swift docs, so the switch/nav could be added manually afterwards.

mxrina4onpv

@colincornaby
Copy link

Would also be nice if this account for things like Swift class names being different than Obj-C class names. I'm finding this annoying when reviewing our documentation. It defaults to the Obj-C ones, but the Swift ones are not present.

@jpsim
Copy link
Collaborator

jpsim commented Jul 18, 2017

Objective-C docs have Swift declarations that include the SWIFT_NAME, just as imported by ClangImporter.

@ulukaya
Copy link
Contributor Author

ulukaya commented Nov 27, 2017

Hey @jpsim , do you mind giving me some pointers on where I can address this? To create only objc, or only swift docs out of objc headers. I can work on it and contribute back.

@ulukaya
Copy link
Contributor Author

ulukaya commented Nov 27, 2017

The only gotcha is we need to make sure we use swift names for left nav. So not the objc but the NS_Swift_Name names are default everywhere.

@jpsim
Copy link
Collaborator

jpsim commented Nov 29, 2017

This should be pretty easy to do. Add a configuration flag here (e.g. hide_objc_declarations/hide_swift_declarations): https://github.com/realm/jazzy/blob/master/lib/jazzy/config.rb

Then depending on whether or not the flag is set, set or don't set declaration/other_language_declaration here:

declaration: item.declaration,
other_language_declaration: item.other_language_declaration,

@ulukaya
Copy link
Contributor Author

ulukaya commented Nov 30, 2017

when you don't see declaration, you don't get other_language_declaration either for some reason.
Anyways I can always trick that but setting declaration: item.other_language_declaration

But the real issue is I want to get Swift type names for types, instead of objective-c ones. Is there an easy way to do it? Am I even getting them from sourcekitten?

@ulukaya
Copy link
Contributor Author

ulukaya commented Nov 30, 2017

So I want to use SWIFT_NAME instead of name as type names.

@jpsim
Copy link
Collaborator

jpsim commented Nov 30, 2017

The SWIFT_NAME is never specifically returned, however I think it's included in the cursorInfo dictionary here: https://github.com/jpsim/SourceKitten/blob/d841db12a0911239ba4071ea729b79c946f2bdd8/Source/SourceKittenFramework/Clang%2BSourceKitten.swift#L220

So you could extend SourceKitten to also include that.

@ulukaya
Copy link
Contributor Author

ulukaya commented Nov 30, 2017

@ulukaya
Copy link
Contributor Author

ulukaya commented Nov 30, 2017

or is it docName?

@jpsim
Copy link
Collaborator

jpsim commented Dec 6, 2017

You'll need to look at the contents of the dictionary in cursorInfo to determine what it is that you want.

@ulukaya
Copy link
Contributor Author

ulukaya commented Dec 6, 2017

actually "name" was what I needed. So it was all good. I just couldn't test it earlier due to not knowing how to deal with "@rpath". All good now.

@ulukaya
Copy link
Contributor Author

ulukaya commented Dec 7, 2017

jpsim/SourceKitten#456 should do the work. Tested and works fine.

@ulukaya
Copy link
Contributor Author

ulukaya commented Dec 8, 2017

#923

@ulukaya
Copy link
Contributor Author

ulukaya commented Dec 8, 2017

@jpsim #923 should solve this.

@jpsim
Copy link
Collaborator

jpsim commented Dec 19, 2017

Merged in b139d92.

@jpsim jpsim closed this as completed Dec 19, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants