Latest 1.3.0
License MIT
Platforms ios 9.0

Build Status
codebeat badge

Small Swift events kit that provides some base types of events:

Each this type may implement some Event protocols:

  • Event it’s a object that contains any listners (swift closures) with one template parameter – emited value type.
  • EmptyEvent it’s syntactic sugar for Event with Void template parameter.
  • ValueEvent it’s event, that can contain only one listner and this listner should get and return value. This protocol contains contains two template parameters.



This is classic event (like C# event) that can contains many listners and multicast each new message for this listners.
This event emit only new messages. It means that if you add new listner to existed event this event doesn’t emit previous messages to new listner.


  • FutureEvent: Event
  • FutureEmptyEvent: EmptyEvent
  • FutureValueEvent: ValueEvent


var event = FutureEvent<Int>()

event += { value in
  print("Awesome int: (value)")

event.invoke(with: 42)

will print Awesome int: 42



This event provide all Future logic, but additionally provide emits last emited value for new listner.
It means if your event already emits value and you add new listener then yout listener handles previous emited value in the same time.


  • PresentEvent: Event
  • PresentEmptyEvent: EmptyEvent


var event = PresentEvent<Int>()

event += { value in
  print("Awesome int: (value)")

event.invoke(with: 42)

event += {
    print("Old awesome int: (value)")

will print:

Awesome int: 42

Old awesome int: 42



This event like Present, but emits all previous messages for new listner


  • PastEvent: Event


var event = PastEvent<Int>()

event.invoke(with: 0)
event.invoke(with: 1)

event += { value in
  print("Awesome int: (value)")

event.invoke(with: 2)

Will print:

Awesome int: 0

Awesome int: 1

Awesome int: 2

How to install

pod 'CoreEvents', '~> 1.2.0'


Version format is x.y.z where

  • x is major version number. Bumped only in major updates (implementaion changes, adding new functionality)
  • y is minor version number. Bumped only in minor updates (interface changes)
  • z is minor version number. Bumped in case of bug fixes and e.t.c.


Kravchenkov Alexander

MIT License

Latest podspec

    "name": "CoreEvents",
    "version": "1.3.0",
    "summary": "Small library contains rx-like events.",
    "description": "This library contains object represents Events (like C# event).nThis may simplify things like: pub/sub, delegation, notification and other.",
    "homepage": "",
    "license": {
        "type": "MIT"
    "authors": {
        "Alexander Kravchenkov": "[email protected]"
    "platforms": {
        "ios": "9.0"
    "source": {
        "git": "",
        "tag": "1.3.0"
    "source_files": "CoreEvents/CoreEvents/Sources/**/*.swift"

Pin It on Pinterest

Share This