MCChatModule
一个用于集成到您应用程序中的简单聊天模块。
特性
- 可定制
- 支持横屏和竖屏
要求
- iOS 11.0+
- Xcode 9.3
安装
CocoaPods
您可以使用 CocoaPods 通过将其添加到您的 Podfile
来安装 MCChatModule
platform :ios, '11.0'
use_frameworks!
pod 'MCChatModule'
为了获得完整的好处,在导入 UIKit 的任何地方都导入 MCChatModule
import UIKit
import MCChatModule
手动
- 在您的项目中下载并拖入
源代码
。 - 恭喜!
使用
创建聊天界面就像这样
class ExampleChatViewController: MessagesCollectionViewController, MessagesCollectionViewControllerDataSource {
///The messages to display
var messages = [MessageType]() {
didSet {
collectionView?.reloadData()
}
}
override func viewDidLoad() {
datasource = self
}
func message(for indexPath: IndexPath) -> MessageType {
return messages[indexPath.item]
}
func numberOfMessages() -> Int {
return messages.count
}
}
并将控制器 delegate
属性设置为自定义样式。
贡献
欢迎提出拉取请求和问题。
说明
此项目旨在作为聊天模块和托盘创建(处理 podspec 比编码更困难)的练习(😂),但如果你愿意,仍然可以在你的项目中使用它。如果你想有更多功能和支持型社区,我建议使用 MessageKit
请不要期待持续的支持。
创建者: Marco Capano – @YourTwitter – [email protected]
感谢 @SD10 帮助处理 podspec。
在 MIT 许可下发布。有关更多信息,请参阅 LICENSE
文件。