首页 > 代码库 > 将mvvmlight 移植到 ios step1

将mvvmlight 移植到 ios step1

https://github.com/wangrenzhu/SimpleIoc-For-Objective-c


simple ios for objective-c 版 基本实现 所有功能  完美实现工厂 以及依赖注入。


//
//  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 init];
    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



将mvvmlight 移植到 ios step1