NMPlug 0.8.3

NMPlug 0.8.3

TestsTested
LangLanguage SwiftSwift
License MIT
ReleasedLast Release May 2016
SPMSupports SPM

Maintained by Francesco Colleoni - nearit.com.



NMPlug 0.8.3

  • By
  • Francesco Colleoni

NMPlug

A plugin management module

NMPlug enables existing objects to implement “plugin-oriented” architectures, thanks to the definition of some protocols:

  • Pluggable: defines the structure of a generic plugin:
    • all plugins are identified by a name, which must be unique (at least when it is plugged into a plugin hub)
    • any plugin plugged into a hub can receive messages, either received directly or broadcasted by another plugin
    • any plugin may be run one or more time, regardless of its status, by invoking run(_:sender:) (if implemented)

  • PluginHubDelegate: defines the structure of a plugin hub, which can:
    • manage plugins (plug, unplug, start, stop and run once)
    • send direct messages (plugin-to-plugin communication)
    • send broadcast messages (plugin-to-all-plugin communication)
    • dispatch events (plugin-to-extended object communication)

  • Extensible: defines the structure of the object which should be extended with plugins

This module provides basic implementations of a plugin hub and generic plugins. All plugins written with this module should Plugin class, while the PluginHub should be used as the plugin hub used by classes which implement Extensible protocol.

Plugin messaging relies on instances of NMJSON.JSON objects (see NMJSON).

Messages sent directly to a specific plugin requires knowledge about how plugins can respond to certain messages.