我在Swift中写了SearcherProtocol
,需要实现一个Objective-C类FileSearcher
,它必须使用这个协议.
所以我try 了这个:
#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.
Edit
以下是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!)
}