0

I try to build my legacy code on xcode 9, swift version 3.2 with the Cleanse dependency injector, but the static func configure<B: Binder>(binder: Binder) function got the following error:

Reference to generic type 'Binder' requires arguments in <...>

I tried all the branches and commits. What do you recommend?

2 Answers2

0

The syntax seems to have changed

func configure<B : Binder>(binder binder: B) {
       // Will fill out contents later
   }

https://github.com/square/Cleanse

  • The Binder type come from the Cleanse: https://github.com/square/Cleanse/blob/master/Cleanse/BindToable.swift – Akos Komuves Oct 26 '17 at 13:38
  • In the doc of Cleanse, I found this function referred to as "func configure(binder binder: B)" Is it what you are trying to implement ? –  Oct 26 '17 at 14:04
  • Yes it is. And it worked perfectly with earlier xcodes – Akos Komuves Oct 26 '17 at 14:17
  • It's a tiny difference, but it may change it all –  Oct 26 '17 at 15:06
  • thank you, it is changed more I think, in this file you can check it. it is working with this syntax: [https://github.com/square/Cleanse/blob/master/CleansePlayground.playground/Pages/CoffeeMakerExample.xcplaygroundpage/Contents.swift] the documentation may outdated i'll send a PR to them. If you edit your answer i will mark it as the correct answer, thank you your help – Akos Komuves Oct 30 '17 at 09:12
0

The correct syntax is the following:

struct Singleton : Scope {
}

static func configure(binder: Binder<Singleton>) {
     // Will fill out contents later
}

You can check an example here: https://github.com/square/Cleanse/blob/master/CleansePlayground.playground/Pages/CoffeeMakerExample.xcplaygroundpage/Contents.swift