xxf-bus

Provide a type-safe event bus for iOS cross-module decoupling.

6|1|Updated May 22, 2025
One-click install
npx skills add https://github.com/NBXXF/xxf_ios --skill xxf-bus
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: xxf-bus
Source: https://github.com/NBXXF/xxf_ios/tree/main/skills/xxf-bus
Command: npx skills add https://github.com/NBXXF/xxf_ios --skill xxf-bus

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

这项技能提供一个类型安全的事件总线,用于跨模块解耦通信,替代 NotificationCenter。

Core Features & Use Cases

  • 结构化事件类型,避免使用 Any;跨模块广播与订阅
  • 发布者与订阅者解耦,生命周期绑定(如 DisposeBag)
  • 适用于跨 VC/跨模块通知、主题广播、解耦通信等场景

Quick Start

Create and subscribe to a type-safe event using XXFBus to broadcast across modules.

Frequently Asked Questions about xxf-bus

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I decouple iOS modules for cross-VC notifications without relying on NotificationCenter?

To decouple iOS modules without NotificationCenter, use a type-safe event bus to establish publish-subscribe communication. This enforces structured event definitions and binds subscriptions to lifecycles, preventing untracked observers across cross-VC notifications.

How does a type-safe event bus work for iOS module decoupling?

A type-safe event bus works by enforcing structured event definitions instead of using Any, allowing publishers and subscribers to communicate without direct references. It broadcasts events across modules while binding subscriptions to specific lifecycles for safe memory management.

What is the best way to handle type-safe event broadcasting in iOS architectures?

The best way to handle type-safe event broadcasting is implementing an event-driven bus that requires structured event types. This approach decouples publishers from subscribers and binds subscriptions to lifecycles, ensuring lightweight broadcasting across iOS modules.

Can I use lifecycle binding with a type-safe event bus for publish-subscribe communication?

Yes, you can use lifecycle binding with a type-safe event bus for publish-subscribe communication. Binding subscriptions to lifecycles ensures that observers are automatically managed, preventing memory leaks when modules or VCs are deallocated during event broadcasting.

Why does cross-module coupling cause issues in iOS architectures?

Cross-module coupling causes issues in iOS architectures because direct dependencies between VCs and modules make code rigid and hard to maintain. Using NotificationCenter often leads to untyped events and unmanaged observers, which a type-safe event bus solves by enforcing structured definitions.

Does lightweight broadcasting require type-safe event definitions in iOS?

Yes, lightweight broadcasting requires type-safe event definitions to ensure that modules communicate efficiently without runtime errors. Enforcing structured event types avoids the ambiguity of passing Any objects, allowing secure and decoupled publish-subscribe interactions.