From 35cbeb4d4e4e2c9bf2dd072d69f50b6ee27182eb Mon Sep 17 00:00:00 2001 From: Yongjun Lee Date: Sun, 7 Jan 2024 14:01:55 +0900 Subject: [PATCH] Make the state of `Store` be private setter (#64) --- Sources/OneWay/Store.swift | 2 +- Sources/OneWay/ViewStore.swift | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Sources/OneWay/Store.swift b/Sources/OneWay/Store.swift index e8c3452..6a29433 100644 --- a/Sources/OneWay/Store.swift +++ b/Sources/OneWay/Store.swift @@ -26,7 +26,7 @@ where R.Action: Sendable, R.State: Sendable & Equatable { public let initialState: State /// The current state of a store. - public var state: State { + public private(set) var state: State { didSet { if oldValue != state { continuation.yield(state) diff --git a/Sources/OneWay/ViewStore.swift b/Sources/OneWay/ViewStore.swift index b5d7c09..c820333 100644 --- a/Sources/OneWay/ViewStore.swift +++ b/Sources/OneWay/ViewStore.swift @@ -26,7 +26,7 @@ where R.Action: Sendable, R.State: Sendable & Equatable { public let initialState: State /// The current state of a store. - public var state: State { + public private(set) var state: State { didSet { continuation.yield(state) states.send(state)