Latest 1.1.0
Homepage https://github.com/neoneye/SSEventFlow
License MIT
Platforms ios 9.0, osx 10.10, watchos 3.0
Authors

Version
License
Platform

SSEventFlow is a type safe alternative to NSNotification, inspired by Flux.

The Flux Application Architecture was recently invented by Facebook.
See video to how it works

Usage

Open the SSEventFlow.xcodeproj file and run the Example project.

Requirements

  • iOS 10.0+ / macOS 10.12+
  • Xcode 8.3+
  • Swift 3.1+

Installation

SSEventFlow is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "SSEventFlow"

Example of how to send out notifications

class ParentViewController: UIViewController {
    @IBAction func redButtonAction(_ sender: Any) {
        PickedColorEvent(color: UIColor.red, name: "RED").fire()
    }
    @IBAction func greenButtonAction(_ sender: Any) {
        PickedColorEvent(color: UIColor.green, name: "GREEN").fire()
    }
    @IBAction func blueButtonAction(_ sender: Any) {
        PickedColorEvent(color: UIColor.blue, name: "BLUE").fire()
    }
    @IBAction func resetButtonAction(_ sender: Any) {
        ResetEvent().fire()
    }
}

Example of how to listen for notifications

class ChildViewController: UIViewController {
    @IBOutlet weak var colorName: UILabel!

    override func viewWillAppear(_ animated: Bool) {
        super.viewWillAppear(animated)
        flow_start()
    }

    override func viewDidDisappear(_ animated: Bool) {
        flow_stop()
        super.viewDidDisappear(animated)
    }
}

extension ChildViewController: FlowDispatcher {
    func flow_dispatch(_ event: FlowEvent) {
        if let e = event as? PickedColorEvent {
            view.backgroundColor = e.color
            colorName.text = e.name
        }
        if event is ResetEvent {
            view.backgroundColor = nil
            colorName.text = ""
        }
    }
}

Support

You are welcome to use SSEventFlow free of charge.

If you are using and enjoying my work, maybe you could donate me a beer (or if you don’t drink –
a coffee and bagel will do just fine, a good kind of bagel though, you know… with wonderful stuff inside to make it glorious).

Please donate via PayPal and just like they say on TV – give generously! It motivates me to keep working on this.

License

MIT

Latest podspec

{
    "name": "SSEventFlow",
    "version": "1.1.0",
    "summary": "SSEventFlow is a type safe alternative to NSNotification, inspired by Flux",
    "description": "This is a tiny variant of the Flux Application Architecture, invented by Facebook.nSee video to how Flux works: https://facebook.github.io/flux/docs/in-depth-overview.html#content",
    "homepage": "https://github.com/neoneye/SSEventFlow",
    "license": "MIT",
    "authors": {
        "Simon Strandgaard": "[email protected]"
    },
    "source": {
        "git": "https://github.com/neoneye/SSEventFlow.git",
        "tag": "1.1.0"
    },
    "social_media_url": "https://twitter.com/neoneye",
    "platforms": {
        "ios": "9.0",
        "osx": "10.10",
        "watchos": "3.0"
    },
    "source_files": "SSEventFlow_Framework/Classes/*",
    "pushed_with_swift_version": "3.1.0"
}

Pin It on Pinterest

Share This