https://github.com/victor-mesquita/Emity
Simple event emitter for Swift
https://github.com/victor-mesquita/Emity
event eventemitter simple swift swift4
Last synced: about 2 months ago
JSON representation
Simple event emitter for Swift
- Host: GitHub
- URL: https://github.com/victor-mesquita/Emity
- Owner: victor-mesquita
- License: mit
- Created: 2019-01-12T19:43:00.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2019-01-15T00:26:05.000Z (almost 7 years ago)
- Last Synced: 2025-07-21T12:35:37.721Z (3 months ago)
- Topics: event, eventemitter, simple, swift, swift4
- Language: Swift
- Size: 96.7 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## Table of Contents
- [Installation](#installation)
- [Example](#example)
- [Contributing](#contributing)## Installation
### Cocoapods
Add Emity to Podfile
```ruby
$ pod 'Emity', '~> 0.0'
```Enter in project folder and Install dependencies
```sh
$ pod install
```### Carthage
#### Soon## Example
### Basic usage
```swift
import Emityclass MyClass {
let eventEmitter = Emity()override func viewDidLoad(){
super.viewDidLoad()eventEmitter.on('complete', callback: {
debugPrint("Hey!! I completed my work!")
})
}func completeMyWork(){
eventEmitter.emit('complete')
}func someClickAction(){
completeMyWork()
}
}
```### Passing data to listener
```swift
import Emityclass MyClass {
let eventEmitter = Emity()override func viewDidLoad(){
super.viewDidLoad()eventEmitter.on('complete', callback: { data in
debugPrint("Hey!! I completed my work!")
debugPrint("\(data) World!!!")
})
}func completeMyWork(){
eventEmitter.emit('complete', data: "Hello")
}func someClickAction(){
completeMyWork()
}
}
```## Contributing
### Soon