Latest 2.0.0
Homepage https://github.com/hironytic/Eventitic
License MIT
Platforms ios 8.0, osx 10.9, watchos 2.0, tvos 9.0, requires ARC
Authors

CI Status
Version
License
Platform
Carthage compatible

Library for dispatching and listening events.

Usage

Events are dispatched by EventSource.

let source = EventSource<String>()

// listen
let listener = source.listen { message in
    print(message)
}

// dispatch
source.fire("Hello, World!")

// unlisten
listener.unlisten()

There is a utility class ListenerStore which holds listeners and makes it possible to unlisten them all later.

let store = ListenerStore()

let source1 = EventSource<String>()
let source2 = EventSource<Int>()

// listen
source1.listen { message in
    print("listener 1: (message)")
}.addToStore(store)

source1.listen { message in
    print("listener 2: (message)")
}.addToStore(store)

source2.listen { value in
    print("listener 3: (value)")
}.addToStore(store)

// dispatch
source1.fire("foo")
source2.fire(10)

// unlisten all
store.unlistenAll()

Requirements

  • iOS 8.0+
  • OS X 10.9+
  • watchOS 2.0+
  • tvOS 9.0+
  • Swift 3.0+

Installation

CocoaPods

Eventitic is available through CocoaPods.
To install it, simply add the following lines to your Podfile:

use_frameworks!
pod "Eventitic", '~> 2.0'

Carthage

Eventitic is available through Carthage.
To install it, simply add the following line to your Cartfile:

github "hironytic/Eventitic" ~> 2.0

Swift Package Manager

Eventitic is available through Swift Package Manager.
To install it, add dependency to your Package.swift file like following:

import PackageDescription

let package = Package(
    name: "Hello",
    dependencies: [
        .Package(url: "https://github.com/hironytic/Eventitic.git", majorVersion: 2),
    ]
)

Author

Hironori Ichimiya, [email protected]

License

Eventitic is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Eventitic",
    "version": "2.0.0",
    "summary": "Dispatching and listening events",
    "description": "This pod provides an event source object which dispatches events to listeners.",
    "homepage": "https://github.com/hironytic/Eventitic",
    "license": "MIT",
    "authors": {
        "Hironori Ichimiya": "[email protected]"
    },
    "source": {
        "git": "https://github.com/hironytic/Eventitic.git",
        "tag": "v2.0.0"
    },
    "platforms": {
        "ios": "8.0",
        "osx": "10.9",
        "watchos": "2.0",
        "tvos": "9.0"
    },
    "requires_arc": true,
    "source_files": "Sources/**/*",
    "pushed_with_swift_version": "3.0"
}

Pin It on Pinterest

Share This