如何快速重命名类名? [英] How to rename the class name in swift?
本文介绍了如何快速重命名类名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图迅速重命名类名,但它给我错误Can't refector swift code
.我想知道重命名将反映在整个项目中的文件的最佳方法
I am trying to rename the class name in swift but it gives me error Can't refector swift code
. I want to know the best way to rename a file that will reflect in the whole project
推荐答案
编辑:
从Xcode 9开始,您现在可以轻松地做到这一点.
突出显示要重命名的代码,右键单击并选择refactor
-> rename
.
或者,您也可以使用Xcode顶部的Editor
菜单,然后选择refactor
-> rename
.
EDIT:
Starting Xcode 9 you're now to easily do it.
Highlight the code that you want to rename, right click and choose refactor
-> rename
.
Or you can also use the Editor
menu on top of the Xcode and choose refactor
-> rename
.
XCode 9以下的解决方案:
- 单击
Find
->Find and Replace in Workspace
- click
Find
->Find and Replace in Workspace
- 重命名它,例如,我将
ChatViewController
重命名为ChatVC
,然后按Enter
.通常也可以在情节提要中重命名该名称,因此确实很方便,但是请仔细检查您是否真的要确保更改了名称.
- Rename it, for example I am renaming
ChatViewController
withChatVC
then hitEnter
. This usually rename the naming in storyboard too, So it's really convinient, but just double check if you want to really make sure it's changed.
- 最后,不要忘记在项目导航器中重命名文件本身
这篇关于如何快速重命名类名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文