Swiftpack.co - BlueEventHorizon/BwPublisher as Swift Package

Swiftpack.co is a collection of thousands of indexed Swift packages. Search packages.
See all packages published by BlueEventHorizon.
BlueEventHorizon/BwPublisher 2.0.5
PPublisher is the light weight publish/subscribe library
⭐️ 2
🕓 52 weeks ago
iOS
.package(url: "https://github.com/BlueEventHorizon/BwPublisher.git", from: "2.0.5")

BwPublisher

BwPublisher is the light weight publish/subscribe library.

This library can be used for the purpose of operating loosely coupled between software layers like RxSwift and Combine Framework. It's very lightweight and consumes little memory, as only the minimum amount of observing functionality is implemented. It is suitable for use in apps with limited memory, such as App Clips introduced from iOS14.

Usage

it is very easy to use BwPublisher

Publisher


class Hoge {
    var publisher = Publisher<String>()
    
    func action() {
        publisher.publish("Hoge Updated")
    }
}

Subscriber


class Fuga {

    let hoge = Hoge()
    var bag = SubscriptionBag()
    
    ... invoke configure() at somwhere ...
    
    func configure() {
        hoge.publisher.subscribe.subscribe(self) { [weak self] message in
            print(message)
        }
        .unsubscribed(by: bag)
    }
}

GitHub

link
Stars: 2
Last commit: Yesterday
jonrohan Something's broken? Yell at me @ptrpavlik. Praise and feedback (and money) is also welcome.

Release Notes

Update README
1 year ago

Swiftpack is being maintained by Petr Pavlik | @ptrpavlik | @swiftpackco | API | Analytics