Represents a value that changes over time.
import PackageDescription
let package = Package(
dependencies: [
.Package(url: "https://github.com/nfam/variable.swift.git", majorVersion: 0, minor: 1)
]
)
let variable = Variable<String>(value: "Initial value")
// `variable` does have `subscribe` method,
// however wrapping it with `Subscribable` will stop subscribers from setting the variable value.
let subscribable = Variable<String>.Subscribable(variable)
variable.next(value: "Not printed!")
variable.next(value: "Not printed!")
variable.next(value: "Printed!")
subscribable.subscribe { value in
print(value)
}
subject.onNext("Printed!")