Latest 0.0.1
Homepage https://github.com/muniere/Happa
License MIT
Platforms ios 8.0, requires ARC
Authors

CI Status
Version
License
Platform

Happa is a library to control when to execute function with closed scope context.

Requirements

  • iOS 8.0+
  • Xcode 7.2+

Installation

Happa is available through CocoaPods.

Add the followings to Podfile:

platform :ios, '8.0'
use_frameworks!

pod "Happa"

Then, run the command

$ pod install

Usage

This is a simple usage. See Examples for more complex examples.

import Happa

let context = Happa<Int>(
  state: 2,
  cond: { (current: Int) -> Bool in
    return current <= 0
  },
  fire: { (current: Int) -> Void in
    print("current value: (current)")
  }
)

asyncFunc1(completion: {
  // not fire
  context.update { (current: Int) -> Int in
    return current - 1
  }
})

asyncFunc2(completion: {
  // fire
  context.update { (current: Int) -> Int in
    return current - 1
  }
})

asyncFunc3(completion: {
  // more fire
  context.update { (current: Int) -> Int in
    return current - 1
  }
})

License

Happa is available under the MIT license. See the LICENSE file for more info.

Latest podspec

{
    "name": "Happa",
    "version": "0.0.1",
    "summary": "Happa is a library to control when to execute function with closed scope context.",
    "description": "Happa is a library to control when to execute function with closed scope context.nnIt reduces complexy to manage many flags or counters to control flow.",
    "homepage": "https://github.com/muniere/Happa",
    "license": "MIT",
    "authors": {
        "Hiromune Ito": "[email protected]"
    },
    "source": {
        "git": "https://github.com/muniere/Happa.git",
        "tag": "0.0.1"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Source/**/*"
}

Pin It on Pinterest

Share This