停止 Xcode 自动为 Objective-C 头文件生成 Swift 接口 [英] Stop Xcode automatically generating Swift interfaces for Objective-C headers

查看:30
本文介绍了停止 Xcode 自动为 Objective-C 头文件生成 Swift 接口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以阻止 Xcode (8) 在显示 Objective-C 标头时自动生成 Swift 界面?例如通过设置用户默认值.

Is it possible to stop Xcode (8) from automatically generating a Swift interface when showing an Objective-C header? For example by setting a user defaults value.

理论上,这是 Xcode 的一个非常好的功能.不幸的是,它不能可靠地工作.对我来说,它甚至在大多数情况下似乎都失败了.由于我无法确定它为什么会发生,我想选择退出它,直到 Xcode/SourceKit 的错误得到解决.

In theory it’s a really nice feature of Xcode. Unfortunately it doesn’t work reliably. For me it even seem to fail most of the time. As I haven’t been able to discern why it happens, I’d like to opt out of it, until the bugs Xcode/SourceKit have been resolved.

推荐答案

默认行为应取决于您的项目设置.如果您在 Swift 项目中,它会想向您展示 Swift 接口.此外,如果有一个 Xcode 生成 Swift 的 Objective-C 接口,然后使用 Cmd+Alt+Enter 您应该能够查看那里的 Swift 代码的 Objective-C 标头Counterpart"以进行比较.

The default behaviour should be dependent on your project settings. If you're in a Swift project it will want to show you Swift interfaces. Also if there is an Objective-C interface that Xcode generate Swift from then using Cmd+Alt+Enter you should be able to look at the Objective-C header "Counterpart" of the Swift code there for comparison.

这篇关于停止 Xcode 自动为 Objective-C 头文件生成 Swift 接口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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