我用Swift编写了SearcherProtocol
并需要实现一个Objective-C类FileSearcher
来使用该协议。
所以我尝试了这个:
#import <Foundation/Foundation.h>
@interface FileSearcher : NSObject <SearcherProtocol>
// ... class content
@end
编译器告诉我:
无法找到“SearcherProtocol”的协议声明
对应的桥接头文件(modulename-Swift.h
)正在被导入到FileSearcher.m
中。
将SearcherProtocol
导入到FileSearcher.h
中会引发另一个编译器错误:module name-swift.h file not found
有人知道我做错了什么吗?
我正在使用Xcode 6 Beta 5。
编辑
以下是Swift中的协议声明:
@objc protocol SearcherProtocol
{
var searchNotificationTarget: SearchCompletedProtocol? { get }
var lastSearchResults: [AnyObject] { get set }
func search(searchParam: String, error: NSErrorPointer) -> Bool
}
搜索完成协议(SearchCompletedProtocol):
@objc protocol SearchCompletedProtocol
{
func searchCompletedNotification(sender: AnyObject!)
}
@objc
标志声明? - Sulthan