How to copy objective-c method name more efficiently in Xcode?

I have a method:

- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section { return items.count; } 

Now I have to copy the entire first line, and then delete the words about the official parameters. Is there a better way to copy the method name so that I can quickly get tableView:numberOfRowsInSection: :?

+5
source share
3 answers

This doesn't seem very nice, but you can right-click on the method name, then Refactor -> Rename and Cmd+C to copy the method name.

For even better access, you can set a shortcut for this in Xcode -> Preferences -> Key Bindings -> Rename . To do this, one click on the method name and two shortcuts to obtain a signature

+1
source

In Xcode 7.3 and above, you can simply do the following:

For the ReportsListViewController class and the -tableView:numberOfRowsInSection: method:

Copy Certified Symbol Name

Place the cursor anywhere in the method name. Press Shift-Cmd-Ctrl-Option-c (All Modifiers). The following will be added to your clipboard:

 -[ReportsListViewController tableView:numberOfRowsInSection:] 

Copy Symbol Name

Place the cursor anywhere in the method name. Press Shift-Cmd-Ctrl-c - This will put the following on the clipboard:

 -tableView:numberOfRowsInSection: 
+14
source

you can use the Xcode snippet library. In Xcode, View-> Show Code Snippet Library Select a code, Long press on it, then you can drag and drop it, put it in the code snippet library, name another name, for example "tns"

0
source

Source: https://habr.com/ru/post/1236579/


All Articles