除了重构和重命名类或属性名称之外,还有什么其他选项可以在 swift 中使用? [英] What is other option available in swift instead of refactoring and renaming class or attribute name?

查看:30
本文介绍了除了重构和重命名类或属性名称之外,还有什么其他选项可以在 swift 中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我想在 swift 中重命名我的类时,它会显示如下错误.

When I was truing to rename my class in swift it will show error like below.

我只是想知道,在 Objective C 中,它允许我们重命名类名,那么为什么它在 Swift 中不可用,或者其他任何方式都不能这样做.

I just want to know that, in Objective C it allow us to rename class name, then why it not available in Swift, or any other way to do the same.

如果有什么好的方法请推荐我.

If there is any good way then please suggest me.

谢谢.

推荐答案

目前Xcode不支持跨文件重构

它可以重命名方法、函数、变量...但只能在相同文件中.

去做

  1. 将光标放在要重命名的成员上
  2. ctrl + cmd + e
  3. 更改成员
  4. 同一文件中的所有引用都会实时更新

但它不会更新来自其他文件的引用.为此,我们需要等待 Xcode 的未来版本.

But it doesn't updated references from other files. For this we need to wait for a future version of Xcode.

这篇关于除了重构和重命名类或属性名称之外,还有什么其他选项可以在 swift 中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆