Search code examples
swiftxcodeswinject

Type 'SwinjectStoryboardOption' does not conform to protocol 'ServiceKeyOption'


After I did a clean install of my project Cocoapods which worked just before the clean install, now when I compile there is that error:

Type 'SwinjectStoryboardOption' does not conform to protocol 'ServiceKeyOption'

How do I fix it?


Solution

  • TL;DR

    Pretty clean fix is to go to Podfile.lock and look for Swinject, set it's version to 2.6.0 instead of 2.7.x. It will look like this:

      - Swinject (2.6.0)
    

    As soon as SwinjectStoryboard releases a fix, you can just update the SwinjectStoryboard and it will automatically update Swinject to a proper version.

    The issue

    It looks like SwinjectStoryboard had a wrong dependency description in their podspec file:

    s.dependency 'Swinject', '~> 2.6'
    

    Which resulted in cocoapods picking any 2.x version which is higher than 2.6. So it mistakenly picks 2.7.x which is not compatible with current SwinjectStoryboard version.

    Btw looks like the fix is on the way, it is on the master branch but not yet version tagged.