From 6a52e274e051797e77225e3208b2d1d309794c1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=92=D0=B8=D1=82=D0=B0=D0=BB=D0=B8=D0=B8=CC=86=20=D0=91?= =?UTF-8?q?=D0=B0=D0=BD=D0=B8=D0=BA?= Date: Wed, 17 Aug 2022 22:21:29 +0700 Subject: [PATCH] Allow editing the value property of the CurrentValueRelay --- Sources/Relays/CurrentValueRelay.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/Relays/CurrentValueRelay.swift b/Sources/Relays/CurrentValueRelay.swift index 234a263..5c31f43 100644 --- a/Sources/Relays/CurrentValueRelay.swift +++ b/Sources/Relays/CurrentValueRelay.swift @@ -17,7 +17,11 @@ import Combine /// - note: Unlike PassthroughRelay, CurrentValueRelay maintains a buffer of the most recently published value. @available(OSX 10.15, iOS 13.0, tvOS 13.0, watchOS 6.0, *) public class CurrentValueRelay: Relay { - public var value: Output { storage.value } + public var value: Output { + get { storage.value } + set { storage.value = newValue } + } + private let storage: CurrentValueSubject private var subscriptions = [Subscription, AnySubscriber>]()