Xcode calculates the number of project code lines and common shortcut keys

Source: Internet
Author: User

1. count the number of lines of xcode project code

1. Open the terminal.

2. Use LS and CD to enter the path of your project.

3. Enter the following command: grep-R "\ n" classes | WC-l

(Classes, the folder where the project file is located) (or use grep-d
Recurse "\ n" classes | WC-l)

Here, we use the Unix Command to complete the number of rows statistics. First, we use grep to find the source file in the specified path that contains a line break, and then use the WC command to complete the statistics. We can also use the-W command to count the number of words.

2. xcode shortcut

1. Configure the highlighted scheme: fonts & colors

2. keyboard shortcut: key bindings

3. Code indent: Re-indent selection. (Shortcut: Ctrl + I)

4. Automatic Code Completion: Table (Code screen), ESC (turn on the automatic Completion list)

5. Command + [(shift code left), flower +] (shift code right)

6. Double-click a separator (for example, {} () []) that matches a bracket. xcode selects it and all the code between the brackets that match it.

7. Quickly rename the local variable name (right-click-edit all in scope) command + Control + E

8. refactor (right-click reflector ...)

9. common cursor control buttons: (also applicable to text fields such as textedit and Safari URL address bar) Control-A: Move to the beginning of a line (same as command + left arrow) control-E: move to the end of a row (end, same as command + right arrow) control-K: delete (kill) the code behind the cursor in the row where the cursor is located, so that you can easily rewrite the code at the end of the line.

10. Switch to the header file or source code file: Command + Option + up arrow, you can quickly switch between the header file and the source code file. The menu is view-switch head/source file. Or click the last control of the Code navigation bar.

11. bookmarks: Add bookmarks (command-D, same as the shortcut key for adding bookmarks in the browser). You can see the added bookmarks under project groups & files.

12. Command + Shift + E: Display/hide the browser pane on the Code Screen

13. Code folding: Click the gray vertical line on the left. (View-code folding)

14. Code function comments:

// MARK: *** (TAG, with the same function # pragma mark ***),

// Todo :***

// Fixme :***

//!!! :***

//??? :***

15. Control-2: view the member list of the current file quickly

16. Help: Quick help (option + Click) and document search (option + double-click)

17. Modify the left curly braces (the next line of the IF statement) automatically completed by xcode ):

Run terminal, enter

Defaults write com. Apple. xcode xccodesenseformattingoptions-dict blockseparator "N"

And then restart xcode.

18 command + \ fast comment or cancel comment

3. Solution to non-dyeing xcode keywords
Set the precompile prefix header to no in build settings, delete the derived data directory (which can be found in organizer), and wait for the index to finish.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.