Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Ioc-Containers in Objective-C is not a popular approach?

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 ?

like image 739
n0_quarter Avatar asked Oct 31 '22 11:10

n0_quarter


1 Answers

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.

like image 105
chakming Avatar answered Nov 10 '22 19:11

chakming