markohlebar / Import

Xcode extension for adding imports from anywhere in the code ☝️
MIT License
846 stars 40 forks source link

[Feature Request] The ability to have `@class` work too #17

Closed clementpadovani closed 7 years ago

clementpadovani commented 7 years ago

The ability of having Objective-C class/protocol forward declarations in ObjC headers would be great.

markohlebar commented 7 years ago

@ClementPadovani I was thinking about this for Peckham... I think we can't do anything that is automagic because you have no awareness if you are currently in the .h or .m file...

Creating another action would probably work better, so that you can leave the decision of wether to do #import or @class to the user?

clementpadovani commented 7 years ago

Actually with XcodeKit we can, per XCSourceTextBuffer’s contentUTI property I get an UTI of public.c-header for the headers and public.objective-c-source for Objective-C implementation files.

markohlebar commented 7 years ago

@ClementPadovani you are perfectly right :) but still sometimes a dev wants to explicitly add a header, so I think just forcing it to @class wouldn't really work, or do you have a better idea?

clementpadovani commented 7 years ago

Oh yeah, but my idea wasn't to replace #imports by forward declarations. It was just the possibility to add @class to the top like for importa

Thanks, Clément Sent from my iPhone

On Nov 20, 2016, at 12:51 PM, Marko Hlebar notifications@github.com wrote:

@ClementPadovani you are perfectly right :) but still sometimes a dev wants to explicitly add a header, so I think just forcing it to @class wouldn't really work, or do you have a better idea?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

markohlebar commented 7 years ago

Yeah, I didn't mean replacing them. When you add a new one, you should have a choice whether you want to add @class or #import right?

clementpadovani commented 7 years ago

Closed with #23