feat:add DoricLibrary
This commit is contained in:
@@ -25,4 +25,6 @@
|
||||
#import "DoricNavigatorDelegate.h"
|
||||
#import "DoricNavBarDelegate.h"
|
||||
#import "DoricViewController.h"
|
||||
#import "DoricPromise.h"
|
||||
#import "DoricPromise.h"
|
||||
#import "DoricLibrary.h"
|
||||
#import "DoricNativePlugin.h"
|
25
Pod/Classes/DoricLibrary.h
Normal file
25
Pod/Classes/DoricLibrary.h
Normal file
@@ -0,0 +1,25 @@
|
||||
/*
|
||||
* Copyright [2019] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/12/11.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "DoricRegistry.h"
|
||||
|
||||
@interface DoricLibrary : NSObject
|
||||
- (void)load:(DoricRegistry *)registry;
|
||||
@end
|
26
Pod/Classes/DoricLibrary.m
Normal file
26
Pod/Classes/DoricLibrary.m
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright [2019] [Doric.Pub]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
//
|
||||
// Created by pengfei.zhou on 2019/12/11.
|
||||
//
|
||||
|
||||
#import "DoricLibrary.h"
|
||||
|
||||
|
||||
@implementation DoricLibrary
|
||||
- (void)load:(DoricRegistry *)registry {
|
||||
}
|
||||
@end
|
@@ -23,6 +23,7 @@
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
@class DoricLibrary;
|
||||
|
||||
@interface DoricRegistry : NSObject
|
||||
|
||||
@@ -38,6 +39,8 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
- (void)registerViewNode:(Class)nodeClass withName:(NSString *)name;
|
||||
|
||||
- (Class)acquireViewNode:(NSString *)name;
|
||||
|
||||
+ (void)register:(DoricLibrary *)library;
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
@@ -43,6 +43,33 @@
|
||||
#import "DoricPopoverPlugin.h"
|
||||
#import "DoricAnimatePlugin.h"
|
||||
#import "DoricNestedSliderNode.h"
|
||||
#import "DoricLibrary.h"
|
||||
|
||||
|
||||
@interface DoricLibraries : NSObject
|
||||
@property(nonatomic, strong) NSMutableSet <DoricLibrary *> *libraries;
|
||||
|
||||
+ (instancetype)instance;
|
||||
@end
|
||||
|
||||
@implementation DoricLibraries
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_libraries = [NSMutableSet new];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
+ (instancetype)instance {
|
||||
static DoricLibraries *_instance;
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^{
|
||||
_instance = [[DoricLibraries alloc] init];
|
||||
});
|
||||
return _instance;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
@interface DoricRegistry ()
|
||||
|
||||
@@ -54,12 +81,19 @@ @interface DoricRegistry ()
|
||||
|
||||
@implementation DoricRegistry
|
||||
|
||||
+ (void)register:(DoricLibrary *)library {
|
||||
[DoricLibraries.instance.libraries addObject:library];
|
||||
}
|
||||
|
||||
- (instancetype)init {
|
||||
if (self = [super init]) {
|
||||
_bundles = [[NSMutableDictionary alloc] init];
|
||||
_plugins = [[NSMutableDictionary alloc] init];
|
||||
_nodes = [[NSMutableDictionary alloc] init];
|
||||
[self innerRegister];
|
||||
[DoricLibraries.instance.libraries enumerateObjectsUsingBlock:^(DoricLibrary *obj, BOOL *stop) {
|
||||
[obj load:self];
|
||||
}];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
Reference in New Issue
Block a user