5

I was wondering, why in Objective-C Ioc-Containers are so unpopular ? I found only few frameworks and just couple articles about it.

However, Ioc-Containers are extremely popular in other languages like C#, Java, etc.

What is the reason ? Am I suppose to use something else in Objective-C for Dependency Injections ?

n0_quarter
  • 538
  • 1
  • 10
  • 23

1 Answers1

2

I have the same feelings but all my iOS projects use Typhoon framework as DI framework. (There're a lot good reasons why Typhoon is a good one)

A blog in Objc.io mentioned about swizzling technique that dynamically replacing one method with another. However The author still like DI more as "it makes dependencies explicit" (that's why I like DI too).

As typhoon mentioned in its FAQ: categories, method swizzling, duck-typing, class clusters, associative references in categories, none of these are replacement of DI. (But some argues.)

There are lots of advantages of DI / IOC.

I guess the main reason not popular for objective-c community is: there's no auto wiring feature which requires to code custom component assemblies. Or somehow it's hard to sell.

Community
  • 1
  • 1
chakming
  • 390
  • 5
  • 18