CombineExt

1.0.3

Swift library that provides additional features for Combine framework
NikSativa/CombineExt

What's New

1.0.3

2024-04-17T22:49:24Z

Full Changelog: 1.0.2...1.0.3

CombineExt

Swift library that provides additional features for Combine framework.

ValueSubject

Reference type that wraps a value and allows to publish changes to it.

struct State: Equatable {
    var counter: Int
    var toggle: Bool
}

@ValueSubject
var subject: State = .init(counter: 0, toggle: false)

@ValueSubject
var newCounterSubject: Int
_newCounterSubject = _subject.observe(keyPath: \.counter)

var newCounterStates: [Int] = []
$newCounterSubject.sink { state in
    newCounterStates.append(state)
}.store(in: &observers)

newCounterSubject += 1 // will trigger subject update

Description

  • Swift Tools 5.9.0
View More Packages from this Author

Dependencies

  • None
Last updated: Sat Oct 19 2024 11:54:20 GMT-0900 (Hawaii-Aleutian Daylight Time)