[英]# Imported Obj-C class through automatically created Bridging header, Bridging header seems to find it but Swift class won't
I try to instantiate Class var into swift class - " use of undeclared type " error shows up.我尝试将 Class var 实例化为 swift 类 - “使用未声明的类型”错误出现。
You need to have your bridging filename set to the "Objective-C Bridging Header" field under the Swift Compiler section in Build Settings for it to be included by the Compiler.您需要将桥接文件名设置为 Build Settings 中 Swift Compiler 部分下的“Objective-C Bridging Header”字段,以便编译器包含它。
"Symbol Not Found" is just an Xcode bug, I get that but I have no issues using bridged files. “找不到符号”只是一个 Xcode 错误,我明白了,但使用桥接文件没有问题。
Turns out that file ( A.swift ) that was trying to reference the "other file" ( B.swift ) had " test target membership " selected!事实证明文件(A.swift),这是尝试引用“其他文件”(B.swift)已经选择“测试目标会员”! So I either had to add the "other file"( B.swift ) to the test target membership or remove file ( A.swift ) from the test target membership.
所以我要么不得不将“其他文件”( B.swift )添加到测试目标成员资格中,要么从测试目标成员资格中删除文件( A.swift )。 I hope that makes sense and that it is of help to someone.
我希望这是有道理的,并且对某人有所帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.