This repository has been archived on 2024-07-22. You can view files and clone it, but cannot push or open issues or pull requests.
Doric/iOS/Pod/Classes/DoricRegistry.m
2019-07-29 20:23:00 +08:00

51 lines
1.1 KiB
Objective-C

//
// DoricRegistry.m
// Doric
//
// Created by pengfei.zhou on 2019/7/27.
//
#import "DoricRegistry.h"
#import "DoricModalPlugin.h"
#import <objc/runtime.h>
@interface DoricRegistry ()
@property (nonatomic,strong) NSMutableDictionary *bundles;
@property (nonatomic,strong) NSMutableDictionary *plugins;
@end
@implementation DoricRegistry
- (instancetype)init {
if(self = [super init]){
_bundles = [[NSMutableDictionary alloc] init];
_plugins = [[NSMutableDictionary alloc] init];
[self innerRegister];
}
return self;
}
- (void)innerRegister {
[self registerNativePlugin:DoricModalPlugin.class withName:@"modal"];
}
- (void)registerJSBundle:(NSString *)bundle withName:(NSString *)name {
[self.bundles setObject:bundle forKey:name];
}
- (NSString *)acquireJSBundle:(NSString *)name {
return [self.bundles objectForKey:name];
}
- (void)registerNativePlugin:(Class)pluginClass withName:(NSString *)name {
[self.plugins setObject:pluginClass forKey:name];
}
- (Class)acquireNativePlugin:(NSString *)name {
return [self.plugins objectForKey:name];
}
@end