MorniMessaging 0.2.3

MorniMessaging 0.2.3

Passant_Khaled 维护。



 
依赖关系
Windless>= 0
Moya>= 0
ReachabilitySwift>= 0
ObjectMapper>= 0
UIScrollView-InfiniteScroll>= 0
PullToRefreshKit>= 0
SwiftMessages~> 5.0
NVActivityIndicatorView>= 0
LocalizableLib>= 0
 

  • 作者
  • PassantKhaled

MorniMessaging

使用 MorniMessaging 简单方便地在您的应用中使用消息中心。

目录

基本信息

MorniMessaging 是一个可用来获取所有收到的消息列表并显示其内容的库。

截图

Screen Shot 2019-09-18 at 2 25 05 PM Screen Shot 2019-09-18 at 2 25 19 PM

安装

CocoaPods

要安装MorniMessaging,请将以下行添加到您的Podfile中

pod 'MorniMessaging', '~>0.2.2'

示例

要运行示例项目,请克隆仓库并运行项目。

使用方法

1- 首先创建一个控制器MessagingViewController并传递你的值

baseUrl -> 你将要调用以获取消息列表的基础URL messagingUrl -> 你的消息API的路径 token -> 用户的访问令牌 language -> 你当前的语言 primaryColor & secondaryColor -> 消息列表的主要颜色

2- 然后将MessagingViewController推送到页面显示你的列表

3- 你可以通过遵守ResponseErrorDelegate来处理响应错误

if let controller = self.createMessagingVC(baseUrl: "your_baseURL", messagingUrl:"your_messaging_path", token: "your_token",language: "current_language",primaryColor: .gray,seconadryColor: .red) as? MessagingViewController {
      controller.responseErrorDelegate =  self
      self.navigationController?.pushViewController(controller, animated: true)
}
extension ExampleViewController : ResponseErrorDelegate {
     func getResponseError(errorCode: Int) {
        print("your error code \(errorCode)")
    }
}

4- 你可以通过遵守CustomCellDataSource在消息列表中添加自定义单元格

if let controller = self.createMessagingVC(baseUrl: "your_baseURL", messagingUrl:"your_messaging_path", token: "your_token",language: "current_language",primaryColor: .gray,seconadryColor: .red) as? MessagingViewController {
       controller.responseErrorDelegate =  self
       controller.customCellDelegate = self
       self.navigationController?.pushViewController(controller, animated: true)
}
extension ExampleViewController: CustomCellDataSource {


 func getNibName() -> String {
    return CustomMessageTableViewCell.getCellIdentifier()
 }

func configureCustomCell(tableView: UITableView, dataType: MessageData) -> UITableViewCell {
   let cell = tableView.dequeueReusableCell(withIdentifier: self.getNibName()) as! CustomMessageTableViewCell
   cell.configure(data: dataType)
  return cell

 }
}

5- 如果你使用自定义单元格,你必须返回单元格的主要颜色,这样消息详情将根据自定义单元格使用的颜色更新其颜色

func getCellColors(tableView: UITableView) -> (mainContainerColor : UIColor?,
                                               titleTextColor: UIColor?,
                                               dateTextColor: UIColor?,
                                               bodyTextColor: UIColor?) {
  let cell = tableView.dequeueReusableCell(withIdentifier: self.getNibName()) as! CustomMessageTableViewCell
   return (cell.mainContainerColor,
           cell.titleLabelColor,
           cell.dateLabelColor,
           cell.bodyLabelColor)
}

6- 你必须注册你自己的自定义单元格

 func registerCell(tableView: UITableView) {
     tableView.register(UINib(nibName: self.getNibName(),bundle: nil),forCellReuseIdentifier: self.getNibName())
 }

功能

待添加功能和未来开发计划列表

  • 显示由应用接收到的已读和未读消息的列表
  • 显示每条消息的全部内容

待办事项列表

  • 允许用户将自己的自定义单元格传递到库中

要求

  • iOS11 或更高版本
  • Swift 4 或更高版本

状态

项目状态:进行中 我正在制作具有动态设计的单元,用户可以将这些单元传递到库中

许可

MorniMessaging 许可证适用于 MIT 协议。有关更多信息,请参阅 LICENSE 文件。