Is there a refactoring to move methods from implementation to interface?

This sounds like such a basic thing that I'm sure I'm missing something but I can't see it.

I have a method in an implementation (it got there because for the first time in my life I used an Extract Superclass refactoring to pull out a bunch of methods and properties)

 
@implementation SuperTranslationCell
{

}
- (UIButton*) buttonFor:(SEL)btnAction normal:(NSString*)imgNormal selected:(NSString*)imgSelected highlighted:(NSString*)imgHighlighted disabled:(NSString*)imgDisabled
{
 

I want that method in the interface because it's now used by two subclasses.

The Pull Up refactoring lets you pull a method up to a parent class or interface but not from implementation to interface.

The Move method won't let me select it - warning that the destination must be a different class.

I realise it's a one line copy and paste but it feels like a natural complement to having refactored a lot of code, to be able to go through and just click on declarations to move them between the implementation and interface.

2 comments
Comment actions Permalink

Andy, the answer is usual - "use opt+enter". There are quick fixes "Declare method in interface", "Declare method in private category", etc. If you need to do this for several methods at once, use "Generate | Declare Members". Does this work for you?

0
Comment actions Permalink

Thanks, Alexander, that was exactly what I needed.

It's a bit obscure, unless I'm still missing something there is nothing else in the UI to trigger that popup?

I had thought of Intentions as being associated with the lightbulb prompt.

0

Please sign in to leave a comment.