There’re a lot of Dependency Injection framework that might work with Mono (and Unity):
- Microsoft Unity (tested - we use it on Android). The name is tricky, but it works fine.
- Ninject
- Autofac
Most of them depend on emit feature of Mono, that is not available on Unity for iOS. That’s because on iOS everything should be ahead-of-time-compiled (AOT).
Trying to use Microsoft’s DI framework, we experience errors of sort “Attempting to JIT compile method in System.Reflection.Emit.DynamicMethod.CreateDelegate”. The error itself is normal, because using Emit is not possible on iOS.
The question is are there any DI frameworks around that will work with AOT on iOS? Maybe some framework that doesn’t rely on emit?
Thanks.