Common shortcut keys of Xcode code

Move code shortcuts

Move up and down

Up: Command + option + [Down: Command + option +] Left: Command + [right: Command +]Copy the code

Replace variable names in variable scope

The cursor needs to hover over the variable name

command + control + e
Copy the code

Reformat code

Control + I for all of them

control + i
Copy the code

Common Mac commands

Mac is based on Unix system, so there is no CD disk concept (iOS also), so support Unix instructions

PWD: view the directory where the current file resides ls: View the list of files in the folder CD + XXX: enter the 'XXX' file mkdir + XXX: create a specified folder rmdir + XXX: delete the specified folder CD.. Cat + File name: view the file rm + xx.xx: Delete the fileCopy the code

– Fixed an issue where MacOs could not open XXX because the developer could not be verified

Sudo SPCTL --master-disableCopy the code

How Xcode works

Command + b compiles to execute the CLang instructionCopy the code

Xcode is implemented through the LLVM compiler (the virtual machine Clang front end is specifically used to compile code (translate code)).

** compile: **

Cc-c file name translation our own code

** Links: **

The CC file name combines its own code with the system and other dependent code groups to produce an executable file

The preceding command can also run multiple files separated by ‘Spaces’ eg:’ cc -c main.c jk.

The following is an example:

– Create a main.c file

#include<stdio.h>int main() {printf("say hello\n"); return 0; }Copy the code

– Enter a command on the terminal

cat main.c
Copy the code

– Output is as follows:

#include<stdio.h>int main() {printf("say hello\n"); return 0; }Copy the code

– Next simulate Xcode to compile and execute instructions

Cc -c main.c ---- main. I // Replace all preprocessing commands (such as macros) in the file ---- main.s // compile ---- main.o // binary filesCopy the code

– generates a binary file **main.o**

– Execute commands

cc main.o
Copy the code

Link your own binary file main.o with the binary of the dependent file to generate an exec icon! [image. PNG] (cdn.nlark.com/yuque/0/202…). Executable file ‘a.out’

– Execute commands

./a.out The following output is displayed: 'say hello'Copy the code

## show and hide files

# # # # command

` ` `

Show hidden files:

defaults write com.apple.Finder AppleShowAllFiles YES; KillAll Finder

Do not show hidden files:

defaults write com.apple.Finder AppleShowAllFiles NO; KillAll Finder

` ` `

# # # # shortcuts

` ` `

command+shift+.

` ` `