Latest 0.0.6
Homepage https://github.com/SKOx0/Emity
License MIT
Platforms ios 9.0, tvos 9.0
Authors

Emity

Table of Contents

Installation

Cocoapods

Add Emity to Podfile

$  pod 'Emity', '~> 0.0'

Enter in project folder and Install dependencies

$ pod install

Carthage

Soon

Example

Basic usage

import Emity

class 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

import Emity

class 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

Latest podspec

{
    "name": "Emity",
    "version": "0.0.6",
    "summary": "Simple event emitter for Swift",
    "description": "Emity is a simple way to work with events in swift",
    "homepage": "https://github.com/SKOx0/Emity",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Victor Mesquita": "[email protected]"
    },
    "platforms": {
        "ios": "9.0",
        "tvos": "9.0"
    },
    "source": {
        "git": "https://github.com/SKOx0/Emity.git",
        "tag": "v0.0.6"
    },
    "source_files": "Sources/**/*",
    "swift_version": "4.2"
}

Pin It on Pinterest

Share This