Xcode
-
Ctrl
+6
You can view the properties and methods of the current class, and you can also enter filters to quickly jump to the properties or methods you want -
Select menu
Window
->Tile Window to Left/Right of Screen
this allows Xcode and the simulator to fill the left and right sides of the full screen, which can be adjusted for your own use, or you can let Xcode match other windows -
Cmd
+Ctrl
+Alt
+F
Fix all the following errors, instead of one by one -
Cmd
+Shift
+O
Search for the class or method you want, pressreturn
to jump quickly, you can also add:
and specify after the class name to行数字
jump to the specific line of the class -
Cmd
+Ctrl
+←
orCmd
+Ctrl
+→
can switch classes/files accessed before and after -
Press and hold
Cmd
, move the mouse to{
will highlight the matching}
convenient check matchPress and hold
Cmd
, click on the class name or method name, and the operation menu will pop up (jump to definition/help document/add comment/add parameter, etc.) -
ctrl
+I
code typesetting, you cancmd
+A
select all and thenctrl
+I
typesetting -
Cmd
+[0~9]
1 ~ 9 toggle left navigation panel 0 show/hide panel -
Cmd
+Alt
+[0~3]
1~3 toggle right navigation panel 0 show/hide panel -
Cmd
+Alt
+/
Select method name or variable to quickly add documentation comments -
Cmd
++Ctrl
QuicklyE
rename variables
Alt
+Click
HoldAlt
and click a class in the left panel, another class panel will openCmd
+Alt
+J
Locate to the filter input box at the bottom of the left, you can search for classes, click the alarm clock icon on the right to display the recently opened class files, and click the icon on the far right to display the class files that you have changed but have not yet submitted.Alt
+←
orAlt
+→
can move word by word in a line, plusShift
it is selectedCmd
+←
orCmd
+→
can move to the head or tail in a line, andShift
it is selected when combined withCmd
+L
Call up the input box, enter the number of lines, press Enter, and jump directly to the specified lineCmd
+Shift
+J
Show the project location where the class is locatedAlt
Press and holdAlt
to select different lines, you can edit multiple lines at the same time
-
Cmd
+T
Open a new Tab, you can separate different classes for easy switching -
Cmd
+Shift
+[
orCmd
+Shift
+]
Switch the class of the same Tab left and right -
Ctrl
+2
Show recently visited classes as a list
StoryBoard XIB
-
Alt
Select a view, hold downAlt
and move the mouse to view the margins around the view and other views -
Shift
You can hold downShift
, select multiple views, and add constraint layouts at the same time -
Alt
+Shift
+Click
可以查看选中视图所在层级 -
Cmd
+Shift
+L
打开视图库面板 -
Alt
按住Alt
拖到视图时 视图库面板保持打开 -
可以通过如图设置
All Properties
,锁定不能更改 -
Shift
添加约束的时候,如图按住Shift
可以选择多个约束一起添加 -
Cmd
当你想拖动一个视图A叠加到另一个视图的B上面,可以按住Cmd
拖动,这样就会A在B上面而不是里面
调试
Cmd
+Shift
+Y
显示/隐藏 控制台Cmd
+Shift
+C
光标切换到控制台Cmd
+K
清空控制台Cmd
+\
增加/删除断点Cmd
+Y
断点生效/失效Fn
+6
step over 跳过Fn
+7
step in 跳进Fn
+8
step out 跳出
View Debugging
Shift
+Cmd
+D
选中一个View,按下Shift
+Cmd
+D
,可以快速定位在左侧栏中
Swift Notes
- 使用
//MARK: -
区分开一个类的代码
-
// FIXME: -
// TODO: -
可以标记该方便待修复,或者是待实现,这个Xcode没有任何标记,只能通过搜索相关字符找到对应的待修复或者待实现方法 -
#warning("Not actually yet.")
Xcode会有相应的警告提示
#error("Not actually yet")
Xcode会有相应错误的提示,这时会编译错误
@available(swift, deprecated: 5.3, message: "Hopefully it's fixed now?")
You can mark the class or method has been deprecated in Swift 5.3, Xcode just warns, this can be used according to the actual
@available(swift, obsoleted: 5.3, message: "Hopefully it's fixed now?")
The same is deprecated, but Xcode prompts an error
emulator
Cmd
+K
pop-up keyboardCmd
+Shift
+A
Can switchlight
dark
modesCmd
+H
hideCmd
+L
lock screenCmd
+Shift
+H
Unlock or go back to the home page, double-clickH
to pop up the task listCmd
+1
//2
resize3
screenCmd
+←
/→
clockwise / counterclockwise rotationCmd
+↑
/↓
Adjust the volumeCmd
+S
screenshotCmd
+Ctrl
+C
Screenshot and copyAlt
+Shift
Drag gesture with mouseAlt
Zoom with the mouseCmd
+M
Minimize to desktop menu bar
tool
It can easily perform Pod operations, clear derived data, customize commands, etc., see more here
Mac
Cmd
+Shift
+.
Show hidden files