Merge pull request #6 from hironytic/swift-5.1 Update to Swift 5.1
Merge pull request #6 from hironytic/swift-5.1
Update to Swift 5.1
Library for dispatching and listening events.
Events are dispatched by EventSource.
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.
ListenerStore
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()
Eventitic is available through CocoaPods. To install it, simply add the following lines to your Podfile:
use_frameworks! pod "Eventitic", '~> 5.0'
Eventitic is available through Carthage. To install it, simply add the following line to your Cartfile:
github "hironytic/Eventitic" ~> 5.0
Eventitic is available through Swift Package Manager. To install it, add dependency to your Package.swift file like following:
Package.swift
import PackageDescription let package = Package( name: "Hello", dependencies: [ .package(url: "https://github.com/hironytic/Eventitic.git", from: "5.0.0"), ], ... )
Hironori Ichimiya, hiron@hironytic.com
Eventitic is available under the MIT license. See the LICENSE file for more info.
©Copyright 2023 CCF 开源发展委员会 Powered by Trustie& IntelliDE 京ICP备13000930号
Eventitic
Library for dispatching and listening events.
Usage
Events are dispatched by
EventSource
.There is a utility class
ListenerStore
which holds listeners and makes it possible to unlisten them all later.Requirements
Installation
CocoaPods
Eventitic is available through CocoaPods. To install it, simply add the following lines to your Podfile:
Carthage
Eventitic is available through Carthage. To install it, simply add the following line to your Cartfile:
Swift Package Manager
Eventitic is available through Swift Package Manager. To install it, add dependency to your
Package.swift
file like following:Author
Hironori Ichimiya, hiron@hironytic.com
License
Eventitic is available under the MIT license. See the LICENSE file for more info.