All Projects → LeoMobileDeveloper → Qteventbus

LeoMobileDeveloper / Qteventbus

Licence: mit
iOS事件总线,支持AppDelegate解耦,支持基于响应链的局部总线

Projects that are alternatives of or similar to Qteventbus

Multiplatform-Bus
Kotlin event-bus compatible with Android & native iOS
Stars: ✭ 43 (-88.22%)
Mutual labels:  eventbus, notification
Blog Core
Modular blog using Blazor with clean domain-driven design patterns
Stars: ✭ 345 (-5.48%)
Mutual labels:  module
Nest.land
🦕 The nest.land website
Stars: ✭ 294 (-19.45%)
Mutual labels:  module
Rxbus
🚌 The RxBus as steady as an old dog.
Stars: ✭ 334 (-8.49%)
Mutual labels:  eventbus
Eventline
Micro-framework for routing and handling events for bots and applications 🤖. IFTTT for developers 👩‍💻👨‍💻
Stars: ✭ 305 (-16.44%)
Mutual labels:  eventbus
Vue Event Proxy
Let Vue.js support global events
Stars: ✭ 337 (-7.67%)
Mutual labels:  eventbus
Ngx php
ngx_php - Embedded php scripting language for nginx module. All released versions of the code repository.
Stars: ✭ 290 (-20.55%)
Mutual labels:  module
Wxpusher Client
微信消息实时推送服务[WxPusher],可以通过API实时给个人微信推送消息。wechat pusher.
Stars: ✭ 352 (-3.56%)
Mutual labels:  notification
Fileboy
fileboy,文件变更监听通知工具,使用 Go 编写。Fileboy, File Change Monitoring Notification Tool, written with Go.
Stars: ✭ 345 (-5.48%)
Mutual labels:  notification
Apollo
🚀 Awesome EventBus by RxJava.
Stars: ✭ 329 (-9.86%)
Mutual labels:  eventbus
Notifications
NotifyMe enables you to create web notifications pretty easily - "Just Call me and Launch!!"
Stars: ✭ 327 (-10.41%)
Mutual labels:  notification
Modulation
Modulation - explicit dependency management for Ruby
Stars: ✭ 306 (-16.16%)
Mutual labels:  module
Ngx php7
ngx_php7 - Embedded php7 scripting language for nginx module. Mainline development version of the ngx_php.
Stars: ✭ 337 (-7.67%)
Mutual labels:  module
Retry
♻️ The most advanced interruptible mechanism to perform actions repetitively until successful.
Stars: ✭ 294 (-19.45%)
Mutual labels:  module
Modules
Environment Modules: provides dynamic modification of a user's environment
Stars: ✭ 344 (-5.75%)
Mutual labels:  module
Alarm Ios Swift
clone of the official IOS clock alarm app written in swift
Stars: ✭ 295 (-19.18%)
Mutual labels:  notification
Vertx Zero
Zero Framework:http://www.vertxup.cn
Stars: ✭ 320 (-12.33%)
Mutual labels:  eventbus
Rspirv
Rust implementation of SPIR-V module processing functionalities
Stars: ✭ 332 (-9.04%)
Mutual labels:  module
Notifications
🛎 Notifications Center engine like GitHub or other application for any Rails applications.
Stars: ✭ 359 (-1.64%)
Mutual labels:  notification
Notifier
Sends notifications via one or more channels (email, SMS, ...).
Stars: ✭ 346 (-5.21%)
Mutual labels:  notification

QTEventBus

Build Status Version Platform License

QTEventBus是一个优雅的iOS事件总线,用来实现“发布-订阅”的消息通信模式。

  • 支持强类型/弱类型
  • 自动取消订阅
  • 快速
  • 兼容NSNotification
  • 单元测试覆盖
  • 支持AppDelegate解耦
  • 支持基于响应链的局部总线

文章:

安装

消息总线:

pod QTEventBus

AppDelegate解耦:

pod QTEventBus/AppModule

基于响应链的事件传递:

pod QTEventBus/UIKit

系统要求

  • XCode 9 +
  • iOS 8+

使用

新建一个类作为事件,实现协议QTEvent

@interface QTLoginEvent : NSObject<QTEvent>
@property (copy, nonatomic) NSString * userId; //可以携带任意数据
@property (copy, nonatomic) NSString * userName; //可以携带任意数据
@end

订阅这个事件

QTSub(object,className)宏的作用是在object的生命周期内,订阅className事件,当object释放的时候自动取消订阅。

//注意eventBus会持有这个block,需要弱引用object
[QTSub(self,QTLoginEvent) next:^(QTLoginEvent * event) {
    NSLog(@"%ld",event.userId);
}];

如果需要在主线程订阅,使用宏QTSubMain

发布事件

QTLoginEvent * event;
[QTEventBus.shared dispatch:event];

详细文档

许可证

QTEventBus使用 MIT 许可证,详情见 LICENSE 文件。

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].