Swinject: Does Swinject support objective-c?

Created on 14 Dec 2016  路  3Comments  路  Source: Swinject/Swinject

If i write my container in swift, can it also support objective-c classes?

question

Most helpful comment

Yes, it can - you cannot use Swinject from Obj-c code, but Swift code has full access to Obj-c classes, and Swinject doesn't care whether class was written in Obj-c or Swift.

All 3 comments

Yes, it can - you cannot use Swinject from Obj-c code, but Swift code has full access to Obj-c classes, and Swinject doesn't care whether class was written in Obj-c or Swift.

I'm closing this issue because the answer looks clear. @oronbz, please feel free to reopen this issue if the question was not actually answered.

@yoichitgy, sorry, I am new to Swift锛宑an you show me how can I use Swinject in my obj-c project锛宖or example, what is the first param for register of Container.I always failed with compile error [Cannot convert value of type 'Protocol' to expected argument type 'AnyObject.Protocol']

this is my code fragment
public class func registerService(anyProtocol: Protocol, anyClass: AnyClass) {
DIContainer.container.register(anyProtocol.self) { _ in anyClass.init() }
},
any help, thk you

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iamszabo picture iamszabo  路  6Comments

thalmicMark picture thalmicMark  路  6Comments

Mijail picture Mijail  路  6Comments

igorkotkovets picture igorkotkovets  路  7Comments

irace picture irace  路  5Comments