Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cozzin/celebrator
🎉 Celebrate event based on count
https://github.com/cozzin/celebrator
Last synced: 2 days ago
JSON representation
🎉 Celebrate event based on count
- Host: GitHub
- URL: https://github.com/cozzin/celebrator
- Owner: cozzin
- License: mit
- Created: 2019-04-02T07:04:41.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2019-08-03T15:24:49.000Z (over 5 years ago)
- Last Synced: 2024-10-17T21:14:54.884Z (21 days ago)
- Language: Ruby
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Moment
🎉 Celebrate event based on count.## At a Glance
```swift
import Celebratorlazy var celebrator = Celebrator()
.register(AppEvent.event) { [weak self] in
self?.somthingForEvent()
}
```## Installation
### Cocoapods
```
pod 'Celebrator'
```### Carthage
```
github "cozzin/Celebrator"
```## Usage
### Make event
```swift
enum AppEvent: String, Event {
case event1
case event2var id: String {
return self.rawValue
}var conditionCount: Int {
switch self {
case .event1:
return 1
case .event2:
return 2
}
}
}
```### Register event
```swift
lazy var celebrator = Celebrator()
.register(AppEvent.event1) { [weak self] in
self?.somthingForEvent1()
}
.register(AppEvent.event2) { [weak self] in
self?.somthingForEvent2()
}
```