Https://github.com/wangrenzhu/SimpleIoc-For-Objective-c
Simple iOS for OBJECTIVE-C version basically implements all the functions perfectly to achieve factory and dependency injection.
viewmodellocator.m//simpleioc////Created by Qvod on 14-9-25.//Copyright (c) 2014 YF. All rights reserved.//#import ' ViewModelLocator.h ' @implementation viewmodellocator-(instancetype) init{self = [Super I NIT]; if (self) {[[Simpleioc defaultinstance] Registerinstance:[sampleuiviewcontrol class]]; [[Simpleioc Defaultinstance] Registerinstance:[mainviewmodel class]; [[Simpleioc Defaultinstance] Registerinstance:[mainviewmodel class] Createinstanceimmediately:no key:@ " Othermainview "]; [[Simpleioc defaultinstance] registerinstance: @protocol (ITESTSERVICEA) Tclassname:[testservicea class]]; [[Simpleioc defaultinstance] registerinstance: @protocol (ITESTSERVICEB) Tclassname:[testserviceb class]]; [[Simpleioc defaultinstance] registerinstance: @protocol (ITESTSERVICEC) TCLASSNAME:[TESTSERVICEC class]]; } return self;} @end
Porting Mvvmlight to iOS Step1