I am writing a swift project mixing with others' project writing in Objective-C. I have already used a bridging header file. And it works.
我正在编写一个与Objective-C中其他人的项目编写混合的快速项目。我已经使用了桥接头文件。它有效。
I am now using some function from others' project. Before I add the functions, which have been declared in .h file. It works:
我现在正在使用其他人的项目中的一些功能。在我添加已在.h文件中声明的函数之前。有用:
However, when I add the function:
但是,当我添加功能时:
func SACalendar(calendar: SACalendar!, didSelectDate day: Int32, month: Int32, year: Int32) {
}
Errors occur:
Use of undeclared type 'SACalendar'!
使用未声明的类型'SACalendar'!
1 个解决方案
#1
The problem is that you define a method with the same name SACalendar
as an existing class. This instance method "hides" the class definition within class Calendar
.
问题是您使用与现有类相同的名称SACalendar定义方法。此实例方法“隐藏”类Calendar中的类定义。
Renaming func SACalendar(...)
should solve the problem.
重命名func SACalendar(...)应该可以解决问题。
#1
The problem is that you define a method with the same name SACalendar
as an existing class. This instance method "hides" the class definition within class Calendar
.
问题是您使用与现有类相同的名称SACalendar定义方法。此实例方法“隐藏”类Calendar中的类定义。
Renaming func SACalendar(...)
should solve the problem.
重命名func SACalendar(...)应该可以解决问题。