Xcode 编译器或自动完成无法识别 Swift 类/协议 [英] Swift Class/Protocol is not recognised by Xcode compiler or Auto Complete

查看:37
本文介绍了Xcode 编译器或自动完成无法识别 Swift 类/协议的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当您在 Swift Xcode 项目中创建新文件时,例如:一个新类.它已成功创建,但似乎无法在自动完成中使用或找到.例如:我创建了一个 FooBase 类,然后尝试创建一个继承自 FooBase 的第二个类 -

When you create a new file in your Swift Xcode project, e.g.: a new class. It gets created successfully however it seems unable to be used or found in the auto complete. Eg: I create a class FooBase and then try and create a second class that inherits from FooBase -

Class Foo:FooBase  

FooBase 没有出现在自动完成中,编译器抛出一个未知类型错误.

FooBase does not appear in the auto complete and the compiler throws an unknown type error.

重现步骤:1) 文件 -> 新建文件 -> 创建一个 FooBase.swift2) File -> New File -> Create a Foo.swift3) 尝试在 Foo 中继承 FooBase.例如:类 Foo:FooBase

Steps to Reproduce: 1) File -> New File -> Create a FooBase.swift 2) File -> New File -> Create a Foo.swift 3) Try and inherit FooBase in Foo. Eg: Class Foo:FooBase

我创建的其他类在自动完成列表中,可以选择,如基本字符串/整数等.

Other classes I have created are in the autocomplete list, and can be picked, as are the base strings/ints etc.

它让我发疯.它似乎相当随机地发生,并且大约有 80% 的时间发生.我在做蠢事吗?

Its driving me mad. It seems to happen fairly randomly and about 80% of the time. Am I doing something stupid?

推荐答案

这似乎是 OS X Yosemite Beta 的问题.我随后在 OS X Mavericks 中尝试了它,但没有发现问题.

This seems to be an issue with OS X Yosemite Beta. I've subsquently tried it in OS X Mavericks and I don't get the issue.

这篇关于Xcode 编译器或自动完成无法识别 Swift 类/协议的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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