Latest 0.3
Homepage https://github.com/AcaiBowl/Closurable
License MIT
Platforms ios 8.0
Authors

Simple, easy and lightweight library for MVVM.

Language
Platform
License
Version
carthage compatible

Usage

Closurable

import Closurable

final class ViewController: UIViewController {
    @IBOutlet fileprivate weak var button: UIButton!
    @IBOutlet fileprivate weak var buttonLabel: UILabel!

    fileprivate let viewModel = ViewModel()
    fileprivate let bag = ReleaseBag()

    override func viewDidLoad() {
        super.viewDidLoad()

        // linking
        button.onTap { [unowned self] _ in
            self.viewModel.updateButtonTapCount()
        }.released(by: bag)

        // binding
        viewModel.subscribe(.buttonTapCount) { [unowned self] (viewModel, _) in
            self.buttonLabel.text = "(viewModel.buttonTapCount)"
        }.released(by: bag)
    }
}

final class ViewModel: NSObject {
    @objc dynamic private(set) var buttonTapCount: Int = 0

    func updateButtonTapCount() {
        buttonTapCount += 1
    }
}

and more…

Requirements

  • Xcode9.0+
  • Swift4+

Installation

CocoaPods

Add this to Podfile

pod "Closurable"
$ pod install

Carthage

Add this to Cartfile

github "AcaiBowl/Closurable"
$ carthage update

References

ReactiveX/RxSwift [Lisense]
ReactiveKit/ReactiveKit [License]

Thank you.

License

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

Latest podspec

{
    "name": "Closurable",
    "version": "0.3",
    "summary": "Simple, easy and lightweight library for MVVM.",
    "homepage": "https://github.com/AcaiBowl/Closurable",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Toru Asai": "[email protected]"
    },
    "social_media_url": "http://twitter.com/_acaibowl",
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/AcaiBowl/Closurable.git",
        "tag": "0.3"
    },
    "source_files": [
        "Closurable",
        "Closurable/**/*.swift"
    ],
    "public_header_files": "Closurable/**/*.h",
    "pushed_with_swift_version": "4.0"
}

Pin It on Pinterest

Share This