Skip to content

swift-callbag/callbag-kit

Repository files navigation

CallbagKit 🧰

CallbagKit is an open-source, a lightweight Swift framework, an implementation of Callbag, and last but not least built with ❤️.

The framework is following the functional-programming style, that means it is just a pure functions that can be composed together to create a one composed-function. Plus the framework is compatible with all Apple platforms & Linux.

CallbagKit has rich starter functions to help you entering the reactive-programming world with ease. Check out How-To-DIY for brief-explanation how this framework actually works, and how to write your own utilities functions to fulfil your desire goal.

Special thanks to @André Staltz for introducing such as concept.


Introduction

Imagine a hybrid between an Observable and an (Async) Iterable, that's what callbags are all about. In addition, the internals are tiny because it's all done with a few simple callbacks, following the callbag spec. As a result, it's tiny and fast.

If you are new to reactive programming, read this article What is ReactiveProgramming? before jumping to How-To-DIY.

Highlights:

  • Supports reactive stream programming
  • Supports iterable programming (also!)
  • Same operator works for both of the above
  • Really Fast! Faster than (ReactiveSwift and RxSwift)
  • Extensible: no core library! Everything is a utility function

Terminology

  • source: a callbag that delivers data
  • sink: a callbag that receives data
  • puller sink: a sink that actively requests data from the source
  • pullable source: a source that delivers data only on demand (on receiving a request)
  • listener sink: a sink that passively receives data from the source
  • listenable source: source which sends data to the sink without waiting for requests
  • operator: a callbag based on another callbag which applies some operation

Documentation

A list of all the functionalities provided by this framework are in documentation, along with descriptions, visual representations and examples. However, this framework is divided into these four parts:

  1. Sources
  2. Sinkers
  3. Operators
  4. Pipes

Requirements

Swift 5.0+


Dependencies

No external dependencies imported, only using Swift's Foundation, and Dispatch


Installation

Swift Package Manager

  .package(url: "https://github.com/swift-callbag/callbag-kit.git", from: "0.0.1")

Contributing

The Callbag philosophy is: build it yourself 😁, But you may take a look at our contributing guidelines if you're interested in helping!

Pending features that ( must! / maybe? ) arrive in future.


License

This framework is under the MIT License