9

I have two frameworks

First - Restofire. It has a protocol ResponseSerializer with Extension.

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()
    }

}

Second - Restofire-Gloss. It has an extension to a protocol for Models conforming to Decodable that is in the Restofire framework.

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()
    }

}

When i import the source files of Restofire-Gloss directly into the project everything works as expected but when i import the framework, then the control doesn't reach the function in the Restofire-Gloss framework.

Rahul Katariya
  • 3,528
  • 3
  • 19
  • 24
  • I think the problem could be the `where clause`. Are you sure you are not adding the conformance to the protocols using some private extension? For example, if there is a private extension that makes `Model` to conform to `Decodable`, then the `where` clause won't work. Try to make all your extensions public. – Sulthan May 06 '16 at 13:34
  • Everything is public – Rahul Katariya May 06 '16 at 15:32
  • do you use pods to add the framework, or drop the framework into your project directly? – wj2061 May 08 '16 at 11:29
  • i am using Pods for now. – Rahul Katariya May 08 '16 at 23:32

1 Answers1

3

Maybe you should mark extension as public?

  • Access modifiers such as public or private are not allowed for protocol extensions. These extensions use the access level of the protocol they extend. – gabriel_101 May 13 '16 at 11:02