我有两个框架
首先 - Restofire 。它有一个协议ResponseSerializer与扩展。
public protocol ResponseSerializable {
/// The type of object returned in response.
associatedtype Model
/// The `Alamofire.ResponseSerializer`.
var responseSerializer: ResponseSerializer<Model, NSError> { get }
}
extension ResponseSerializable {
/// `CustomJSONResponseSerializer`
public var responseSerializer: ResponseSerializer<Model, NSError> {
return AlamofireUtils.JSONResponseSerializer()
}
}
第二 - Restofire-Gloss 。它具有对Restofire框架中符合Decodable的模型协议的扩展。
public extension ResponseSerializable where Model: Decodable {
/// `GLOSSResponseSerializer`
public var responseSerializer: ResponseSerializer<Model, NSError> {
return GlossUtils.GLOSSResponseSerializer()
}
}
public extension ResponseSerializable where Model: CollectionType, Model.Generator.Element: Decodable {
/// `GLOSSResponseSerializer`
public var responseSerializer: ResponseSerializer<Model, NSError> {
return GlossUtils.GLOSSResponseSerializer()
}
}
当我将Restofire-Gloss的源文件直接导入项目时,一切都按预期工作,但是当我导入框架时,控件无法到达Restofire-Gloss框架中的功能。
答案 0 :(得分:3)
也许您应该将扩展标记为公开?