Xcode 不会自动完成结构的成员初始化程序 [英] Xcode does not autocomplete memberwise initializer of a Struct

查看:32
本文介绍了Xcode 不会自动完成结构的成员初始化程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的 Xcode 项目文件中的 Point.swift 中定义了一个这样的结构:

I am defining a struct like this in the Point.swift inside of my Xcode Project file:

struct Point {
    var x: Int
    var y: Int
}

如果我试图从另一个文件初始化 Point 结构,Xcode 不会自动完成成员初始化程序.即使我已经按照一些朋友的建议重新启动了机器.

If i am trying to init the Point struct from another file, Xcode does not autocompleting the memberwise initializer. Even if I have been restarted the machine as some friends suggest.

但自动完成工作正常,如果我在同一个文件或操场中定义初始化一个新实例.

BUT autocompletion works fine, if i am defining initialising a new Instance in the same file or playground.

有什么想法可以解决这个自动完成问题吗?

Any ideas how to fix this autocompletion issue?

推荐答案

这似乎只是 Xcode 中的一个错误.第一次使用另一个文件中的实例时,Xcode 不提供自动完成功能.但是,您第二次使用它时,它确实如此.

This appears to just be a bug in Xcode. The first time you use an instance in another file, Xcode does not provide the autocompletion. But, the second time you use it it does.

这是我所看到的奇怪行为的演示.即使保存了 Point.swift 文件,我第一次在 ViewController.swift 中使用 Point 它不会自动完成,但第二次它确实:

Here is a demo of the strange behavior I am seeing. Even with the Point.swift file saved, the first time I use Point in ViewController.swift it doesn't autocomplete, but the second time it does:

这是 Xcode 7.2.

This is with Xcode 7.2.

这篇关于Xcode 不会自动完成结构的成员初始化程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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