README.md 4.7 KB
Newer Older
Y
yixiang 已提交
1 2
<div  align="center">    
 <img src="https://javer.oss-cn-shanghai.aliyuncs.com/doraemon/github/DoraemonKit_github.png" width = "150" height = "150" alt="图片名称" align=left />
Y
yixiang 已提交
3 4 5 6 7 8 9
</div>

<br/>
<br/>
<br/>
<br/>
<br/>
Y
yixiang 已提交
10 11
<br/>
<br/>
Y
yixiang 已提交
12

Y
readme  
yixiang 已提交
13
A full-featured iOS development assistant. You deserve it.
Y
yixiang 已提交
14

Y
readme  
yixiang 已提交
15 16
[Chinese Readme](https://github.com/didi/DoraemonKit/blob/master/Doc/ChineseReadme.md)

Y
readme  
yixiang 已提交
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
## Communication

<div  align="center">    
 <img src="https://javer.oss-cn-shanghai.aliyuncs.com/doraemon/github/DoraemonKitQQ.jpeg" width = "160" height = "200" alt="图片名称" align=left />
</div>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>
<br/>


Y
readme  
yixiang 已提交
33
## Feature List
Y
yixiang 已提交
34

Y
yixiang 已提交
35 36 37 38 39 40 41 42 43
1. Including an entrance to examine information of device, app and app's permissions.
2. Including a file browser, with a convenient way to transfer file through airDrop.
3. Including a tool for mocking GPS location.
4. Including a built-in web browser.
5. Including a log printer, with every log printed in app
6. Including profilers for App's FPS, CPU usage, memory usage and network traffic. All of them are shown in charts and can be saved for further analysis.
7. Including a color picker, obtaining color values of every pixel in an easy manner.
8. Including a UI viewer, obtaining properties, such as name, position, background color and font size, of every view.
9. Including a coordinate ruler, a useful tool to acquire screen coordinates and to check the alignment of views.
Y
yixiang 已提交
44

Y
readme  
yixiang 已提交
45
## Feature Demonstration
Y
yixiang 已提交
46
<div  align="center">    
Y
readme  
yixiang 已提交
47
 <img src="https://javer.oss-cn-shanghai.aliyuncs.com/doraemon/DoraemonKit2/DoraemonKit2.png" width = "300" height = "565" alt="图片名称" align=center />
Y
yixiang 已提交
48
</div>
Y
yixiang 已提交
49
tips: Tools in the top two lines are user-defined. Others are built-in.
Y
yixiang 已提交
50 51 52 53 54 55 56 57

## How To Use
### 1: Use Cocoapods to Get latest version of DoraemonKit

DoraemonKit contains two subspecs.
One is the "WithLogger" subspec that contains the log display  function based on ‘CocoaLumberjack’.

```
Y
readme  
yixiang 已提交
58
pod 'DoraemonKit/WithLogger', :configurations => ['Debug']
Y
yixiang 已提交
59 60 61 62 63
```

The other one is the "Core" subspec that does not contain the log display function.

```
Y
readme  
yixiang 已提交
64
pod 'DoraemonKit/Core', :configurations => ['Debug']
Y
yixiang 已提交
65 66 67 68
```

The "Core" subspec is introduced by default.

Y
readme  
yixiang 已提交
69
Tip 1: Why do you want to partition the subspec?
Y
yixiang 已提交
70

Y
yixiang 已提交
71
Because the log display module is based on the third-party library "CocoaLumberjack", if you don't need it, use "Core" subspec.
Y
yixiang 已提交
72

Y
readme  
yixiang 已提交
73 74
Tip 2: Use DoraemonKit in debug model.

Y
yixiang 已提交
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89
### 2: Access method using DoraemonKit's built-in toolset
Add code when the app starts.

```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    #ifdef DEBUG
        [[DoraemonManager shareInstance] addH5DoorBlock:^(NSString *h5Url) {
              //Open this link with your H5 container
        }];

        [[DoraemonManager shareInstance] install];
    #endif
}
```

Y
yixiang 已提交
90
  Through the above steps you can use all of the built-in tools of DorameonKit. If you want to add some of your customized tools, see chapter 3.
Y
yixiang 已提交
91
  
Y
yixiang 已提交
92 93
### 3: Add a custom test module to the Doraemon panel (non-essential)
For example, we want to add an environment switch module to the Doraemon panel.
Y
yixiang 已提交
94

Y
yixiang 已提交
95
Step 1: create a new class, implement the pluginDidLoad method in the KDDoraemonPluginProtocol protocol, this method is to be called when the "Environment Switch" button is clicked.
Y
yixiang 已提交
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114

Taking our app as an example, after clicking the button, it will enter the environment switching page.

```
@implementation KDDoraemonEnvPlugin
- (void)pluginDidLoad{
    [APP_INTERACOTR.rootNav openURL:@"KDSJ://KDDoraemonSFViewController"];
    [[DoraemonManager shareInstance] hiddenHomeWindow];
}
 @end
```
 
Step 2: Add the "Environment Switching" plugin added in the first step where Doraemon is initialized.


```
[[DoraemonManager shareInstance] addPluginWithTitle:@"环境切换" icon:@"qiehuang" desc:@"用于app内部环境切换功能" pluginName:@"KDDoraemonEnvPlugin" atModule:@"业务专区"];
```

Y
yixiang 已提交
115 116
It in turn shows the title, icon, description, plugin name, and the module it belongs to.

Y
yixiang 已提交
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136
Take our App as an example:

```
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    #ifdef DEBUG
       [self configDoraemonKit];
    #endif
}
//Initialize the Doraemon toolset
- (void)configDoraemonKit{
    [[DoraemonManager shareInstance] addPluginWithTitle:@"环境切换" icon:@"qiehuang" desc:@"用于app内部环境切换功能" pluginName:@"KDDoraemonEnvPlugin" atModule:@"业务专区"];
    [[DoraemonManager shareInstance] addH5DoorBlock:^(NSString *h5Url) {
        [APP_INTERACOTR.rootNav openURL:@"KDSJ://KDWebViewController" withQuery:@{@"urlString":h5Url}];
    }];
    [[DoraemonManager shareInstance] install];
}
```

## Related documents

Y
readme  
yixiang 已提交
137
[Chinese Readme](https://github.com/didi/DoraemonKit/blob/master/Doc/ChineseReadme.md)
Y
yixiang 已提交
138 139 140 141