Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

# Moment
🎉 Celebrate event based on count.

## At a Glance
```swift
import Celebrator

lazy 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 event2

var 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()
}
```