Popularity
2.3
Stable
Activity
0.0
Stable
6
36
2

Programming language: Swift
License: MIT License
Latest version: v2.0.1

CoreEvents alternatives and similar libraries

Based on the "React-Like" category.
Alternatively, view CoreEvents alternatives based on common mentions on social networks and blogs.

  • Tokamak

    SwiftUI-compatible framework for building browser apps with WebAssembly and native apps for other platforms [Moved to: https://github.com/TokamakUI/Tokamak]

Do you think we are missing an alternative of CoreEvents or a related project?

Add another 'React-Like' Library

README

Build Status codebeat badge codecov

CoreEvents

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

FutureEvent

Simple event. Provides classic behaviour.

Description

This is classic event (like C# event) that can contain many listeners and multicast each new message for this listeners. This event emits only new messages. It means if you add a new listener to existed event then last will not emit previous messages to the new listener.

Types

  • FutureEvent: Event

Example

var event = FutureEvent<Int>()

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

event.invoke(with: 42)

will print Awesome int: 42

PresentEvent

Description

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

Types

  • PresentEvent: Event

Example

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

PastEvent

Description

This event is like the Present, but emits all previous messages for a new listener

Types

  • PastEvent: Event

Example

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', '~> 2.0.0'

Warning

In one file you can not use just add, you should specify a key - add(key: String, _ listener: Closure)

Versioning

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.

Author

Kravchenkov Alexander

MIT License


*Note that all licence references and agreements mentioned in the CoreEvents README section above are relevant to that project's source code only.