<commit_before># Eventitic

[![CI Status](http://img.shields.io/travis/hironytic/Eventitic.svg?style=flat)](https://travis-ci.org/hironytic/Eventitic)
[![Version](https://img.shields.io/cocoapods/v/Eventitic.svg?style=flat)](http://cocoapods.org/pods/Eventitic)
[![License](https://img.shields.io/cocoapods/l/Eventitic.svg?style=flat)](http://cocoapods.org/pods/Eventitic)
[![Platform](https://img.shields.io/cocoapods/p/Eventitic.svg?style=flat)](http://cocoapods.org/pods/Eventitic)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

Library for dispatching and listening events.

## Usage

Events are dispatched by `EventSource`.

```swift
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.

```swift
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+
- Swift 2.2+

## Installation

### CocoaPods

Eventitic is available through [CocoaPods](http://cocoapods.org).
To install it, simply add the following lines to your Podfile:

```ruby
use_frameworks!
pod "Eventitic", '~> 1.0'
```

### Carthage

Eventitic is available through [Carthage](https://github.com/Carthage/Carthage).
To install it, simply add the following line to your Cartfile:

```
github "hironytic/Eventitic" ~> 1.0
```

### Swift Package Manager
<commit_msg>Add requirements in README<commit_after># Eventitic

[![CI Status](http://img.shields.io/travis/hironytic/Eventitic.svg?style=flat)](https://travis-ci.org/hironytic/Eventitic)
[![Version](https://img.shields.io/cocoapods/v/Eventitic.svg?style=flat)](http://cocoapods.org/pods/Eventitic)
[![License](https://img.shields.io/cocoapods/l/Eventitic.svg?style=flat)](http://cocoapods.org/pods/Eventitic)
[![Platform](https://img.shields.io/cocoapods/p/Eventitic.svg?style=flat)](http://cocoapods.org/pods/Eventitic)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)

Library for dispatching and listening events.

## Usage

Events are dispatched by `EventSource`.

```swift
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.

```swift
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 2.2+

## Installation

### CocoaPods

Eventitic is available through [CocoaPods](http://cocoapods.org).
To install it, simply add the following lines to your Podfile:

```ruby
use_frameworks!
pod "Eventitic", '~> 1.0'
```

### Carthage

Eventitic is available through [Carthage](https://github.com/Carthage/Carthage).
To install it, simply add the following line to your Cartfile:

```
github "hironytic/Eventitic" ~> 1.0
```

### Swift Package Manager

{'fraction_non_alphanumeric': 0.16373544711419372, 'fraction_numerical': 0.013128560812484518, 'mean_word_length': 4.9208211143695015, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 14, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4833150', 'n_tokens_mistral': 1513, 'n_tokens_neox': 1392, 'n_words': 298}