expert-app/uikit/documents/架构解析.md
2025-11-18 15:25:59 +08:00

27 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# NIMKit 架构解析
## 总体结构
```
com.netease.nim.uikit
├── api #UIKit 数据接口、定制化接口
├── business #业务相关P2P,Team,ChatRoom
├── common #通用 ui 组件、utils
├── impl #数据接口、定制化接口的默认实现
└── support #第三方库封装
```
以层次划分的形式,看一下各个模块之间如何交互,各自的角色和定位
![image](https://github.com/netease-im/NIM_Resources/blob/master/Android/Images/uikit_struct.png)
- api 模块定义了 `UIkit` 的功能扩展接口、业务数据接口,提供了 `UIkit` 能力输出类 NimUIKit。APP 与 `UIkit` 交互只需要关注这个模块的接口。
- impl 是 `UIkit` 一些抽象接口的默认实现,如会话定制接口、用户信息接口,当 APP 不设置任何定制化时,也能保证 `UIKit` 组件正常运转。
- business 模块实现了 IM 相关的功能,例如联系人、单聊、群聊、聊天室等,能力以 `Activity` 或者 `Fragment` 形式展现。开发者可以通过 `NimUIKit` 提供的接口来启动 `Activity`,以 xml 或者 java 代码的方式集成 `Fragment`
- common 模块是一些通用 ui 组件、工具类等等,与业务无关。
- support 是基于第三方库对业务的封装等等。