From 1811559a956c768609acaa9d9dc72964dc858be0 Mon Sep 17 00:00:00 2001 From: Yessen Date: Mon, 21 Aug 2023 14:17:30 +0900 Subject: [PATCH 1/7] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20TCA=20to=201.?= =?UTF-8?q?1.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Package.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Package.swift b/Package.swift index cd93444..aa75fcc 100644 --- a/Package.swift +++ b/Package.swift @@ -13,7 +13,7 @@ let package = Package( targets: ["TCALogsSheetKit"]), ], dependencies: [ - .package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "0.45.0"), + .package(url: "https://github.com/pointfreeco/swift-composable-architecture", from: "1.1.0"), .package(url: "https://github.com/riiid/LogsSheetKit", from: "1.0.0") ], targets: [ From 64f2a629a0b558359c725fae32c515507557a382 Mon Sep 17 00:00:00 2001 From: Yessen Date: Mon, 21 Aug 2023 14:17:46 +0900 Subject: [PATCH 2/7] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20Update=20Package.resol?= =?UTF-8?q?ved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Package.resolved | 55 ++++++++++++++----- .../xcshareddata/swiftpm/Package.resolved | 45 +++++++++------ 2 files changed, 68 insertions(+), 32 deletions(-) diff --git a/Package.resolved b/Package.resolved index 730f67e..4cf3365 100644 --- a/Package.resolved +++ b/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/combine-schedulers", "state" : { - "revision" : "aa3e575929f2bcc5bad012bd2575eae716cbcdf7", - "version" : "0.8.0" + "revision" : "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb", + "version" : "1.0.0" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-case-paths", "state" : { - "revision" : "bb436421f57269fbcfe7360735985321585a86e5", - "version" : "0.10.1" + "revision" : "5da6989aae464f324eef5c5b52bdb7974725ab81", + "version" : "1.0.0" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-clocks", "state" : { - "revision" : "692ec4f5429a667bdd968c7260dfa2b23adfeffc", - "version" : "0.1.4" + "revision" : "d1fd837326aa719bee979bdde1f53cd5797443eb", + "version" : "1.0.0" } }, { @@ -59,8 +59,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-composable-architecture", "state" : { - "revision" : "1fcd53fc875bade47d850749ea53c324f74fd64d", - "version" : "0.45.0" + "revision" : "f62ba37cc0c51acb89f6dd1f552f6a1f9c58027c", + "version" : "1.1.0" + } + }, + { + "identity" : "swift-concurrency-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-concurrency-extras", + "state" : { + "revision" : "ea631ce892687f5432a833312292b80db238186a", + "version" : "1.0.0" } }, { @@ -68,8 +77,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-custom-dump", "state" : { - "revision" : "819d9d370cd721c9d87671e29d947279292e4541", - "version" : "0.6.0" + "revision" : "edd66cace818e1b1c6f1b3349bb1d8e00d6f8b01", + "version" : "1.0.0" + } + }, + { + "identity" : "swift-dependencies", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-dependencies", + "state" : { + "revision" : "4e1eb6e28afe723286d8cc60611237ffbddba7c5", + "version" : "1.0.0" } }, { @@ -77,8 +95,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-identified-collections", "state" : { - "revision" : "bfb0d43e75a15b6dfac770bf33479e8393884a36", - "version" : "0.4.1" + "revision" : "d1e45f3e1eee2c9193f5369fa9d70a6ddad635e8", + "version" : "1.0.0" + } + }, + { + "identity" : "swiftui-navigation", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swiftui-navigation", + "state" : { + "revision" : "f5bcdac5b6bb3f826916b14705f37a3937c2fd34", + "version" : "1.0.0" } }, { @@ -86,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", "state" : { - "revision" : "16e6409ee82e1b81390bdffbf217b9c08ab32784", - "version" : "0.5.0" + "revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631", + "version" : "1.0.2" } } ], diff --git a/TCALogsSheetExample.xcworkspace/xcshareddata/swiftpm/Package.resolved b/TCALogsSheetExample.xcworkspace/xcshareddata/swiftpm/Package.resolved index 08ad1b6..d602ae2 100644 --- a/TCALogsSheetExample.xcworkspace/xcshareddata/swiftpm/Package.resolved +++ b/TCALogsSheetExample.xcworkspace/xcshareddata/swiftpm/Package.resolved @@ -5,8 +5,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/combine-schedulers", "state" : { - "revision" : "882ac01eb7ef9e36d4467eb4b1151e74fcef85ab", - "version" : "0.9.1" + "revision" : "9dc9cbe4bc45c65164fa653a563d8d8db61b09bb", + "version" : "1.0.0" } }, { @@ -32,8 +32,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-case-paths", "state" : { - "revision" : "c3a42e8d1a76ff557cf565ed6d8b0aee0e6e75af", - "version" : "0.11.0" + "revision" : "5da6989aae464f324eef5c5b52bdb7974725ab81", + "version" : "1.0.0" } }, { @@ -41,8 +41,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-clocks", "state" : { - "revision" : "20b25ca0dd88ebfb9111ec937814ddc5a8880172", - "version" : "0.2.0" + "revision" : "d1fd837326aa719bee979bdde1f53cd5797443eb", + "version" : "1.0.0" } }, { @@ -59,8 +59,17 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-composable-architecture", "state" : { - "revision" : "6cf778a7da64de9508596a435aa0a5647885d71a", - "version" : "0.49.2" + "revision" : "f62ba37cc0c51acb89f6dd1f552f6a1f9c58027c", + "version" : "1.1.0" + } + }, + { + "identity" : "swift-concurrency-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-concurrency-extras", + "state" : { + "revision" : "ea631ce892687f5432a833312292b80db238186a", + "version" : "1.0.0" } }, { @@ -68,8 +77,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-custom-dump", "state" : { - "revision" : "ead7d30cc224c3642c150b546f4f1080d1c411a8", - "version" : "0.6.1" + "revision" : "edd66cace818e1b1c6f1b3349bb1d8e00d6f8b01", + "version" : "1.0.0" } }, { @@ -77,8 +86,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-dependencies", "state" : { - "revision" : "7a094fcc6a4fcb34fbe625ecd3acd81b881a6dfb", - "version" : "0.1.3" + "revision" : "4e1eb6e28afe723286d8cc60611237ffbddba7c5", + "version" : "1.0.0" } }, { @@ -86,8 +95,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swift-identified-collections", "state" : { - "revision" : "fd34c544ad27f3ba6b19142b348005bfa85b6005", - "version" : "0.6.0" + "revision" : "d1e45f3e1eee2c9193f5369fa9d70a6ddad635e8", + "version" : "1.0.0" } }, { @@ -95,8 +104,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/swiftui-navigation", "state" : { - "revision" : "ddc01cdcddfd30ef7a966049b2e1d251e224ad93", - "version" : "0.5.0" + "revision" : "f5bcdac5b6bb3f826916b14705f37a3937c2fd34", + "version" : "1.0.0" } }, { @@ -104,8 +113,8 @@ "kind" : "remoteSourceControl", "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", "state" : { - "revision" : "16b23a295fa322eb957af98037f86791449de60f", - "version" : "0.8.1" + "revision" : "23cbf2294e350076ea4dbd7d5d047c1e76b03631", + "version" : "1.0.2" } } ], From fa50327ea6dac69099fbed6ed9bcc470e2b1ac4e Mon Sep 17 00:00:00 2001 From: Yessen Date: Mon, 21 Aug 2023 14:20:02 +0900 Subject: [PATCH 3/7] =?UTF-8?q?=F0=9F=94=A5=20Remove=20ANyReducer=20loger?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/TCALogsSheetKit/TCALogger.swift | 26 ------------------------- 1 file changed, 26 deletions(-) diff --git a/Sources/TCALogsSheetKit/TCALogger.swift b/Sources/TCALogsSheetKit/TCALogger.swift index 682dfe8..188fd2a 100644 --- a/Sources/TCALogsSheetKit/TCALogger.swift +++ b/Sources/TCALogsSheetKit/TCALogger.swift @@ -10,35 +10,9 @@ import Foundation import ComposableArchitecture import LogsSheetKit -extension AnyReducer { /// Saves each action run through the reducer as the log message if debug build configuration is on /// - Parameters: /// - isDebug: is debug configuration on - public func log(isDebug: Bool) -> Self { - AnyReducer.init { state, action, environment in - if isDebug { - LogsSheetManager.shared.log(message: "\(action)") - } - return self.run(&state, action, environment) - } - } - - /// Saves the custom log message if debug build configuration is on - /// - Parameters: - /// - isDebug: is debug configuration on - /// - message: custom log message - public func log( - isDebug: Bool, - with message: @escaping ((Action) -> String) - ) -> Self { - AnyReducer.init { state, action, environment in - if isDebug { - LogsSheetManager.shared.log(message: message(action)) - } - return self.run(&state, action, environment) - } - } -} extension ReducerProtocol { /// Saves each action run through the reducer as the log message if debug build configuration is on From 47f11a58483b9409442bf13a6995c80b871b1eef Mon Sep 17 00:00:00 2001 From: Yessen Date: Mon, 21 Aug 2023 14:20:42 +0900 Subject: [PATCH 4/7] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Change=20ReducerProtoc?= =?UTF-8?q?ol=20to=20Reducer?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/TCALogsSheetKit/Examples/CounterReducer.swift | 4 ++-- Sources/TCALogsSheetKit/TCALogger.swift | 10 +++------- TCALoggerSample/TCALoggerSample/Counter/Counter.swift | 4 ++-- .../TCALoggerSample/Emoji/EmojiPicker.swift | 4 ++-- 4 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Sources/TCALogsSheetKit/Examples/CounterReducer.swift b/Sources/TCALogsSheetKit/Examples/CounterReducer.swift index 9ecdfbb..ba1d90c 100644 --- a/Sources/TCALogsSheetKit/Examples/CounterReducer.swift +++ b/Sources/TCALogsSheetKit/Examples/CounterReducer.swift @@ -9,7 +9,7 @@ import ComposableArchitecture import Foundation import LogsSheetKit -struct Counter: ReducerProtocol { +struct Counter: Reducer { struct State: Equatable { var logs: [ActionLog] = [] var count = 0 @@ -21,7 +21,7 @@ struct Counter: ReducerProtocol { } - var body: some ReducerProtocol { + var body: some Reducer { Reduce { (state, action) in switch action { case .increase: diff --git a/Sources/TCALogsSheetKit/TCALogger.swift b/Sources/TCALogsSheetKit/TCALogger.swift index 188fd2a..d095f92 100644 --- a/Sources/TCALogsSheetKit/TCALogger.swift +++ b/Sources/TCALogsSheetKit/TCALogger.swift @@ -10,15 +10,11 @@ import Foundation import ComposableArchitecture import LogsSheetKit +extension Reducer { /// Saves each action run through the reducer as the log message if debug build configuration is on /// - Parameters: /// - isDebug: is debug configuration on - -extension ReducerProtocol { - /// Saves each action run through the reducer as the log message if debug build configuration is on - /// - Parameters: - /// - isDebug: is debug configuration on - public func log(isDebug: Bool) -> some ReducerProtocol { + public func log(isDebug: Bool) -> some Reducer { Reduce { state, action in if isDebug { LogsSheetManager.shared.log(message: "\(action)") @@ -34,7 +30,7 @@ extension ReducerProtocol { public func log( isDebug: Bool, with message: @escaping ((Action) -> String) - ) -> some ReducerProtocol { + ) -> some Reducer { Reduce { state, action in if isDebug { LogsSheetManager.shared.log(message: message(action)) diff --git a/TCALoggerSample/TCALoggerSample/Counter/Counter.swift b/TCALoggerSample/TCALoggerSample/Counter/Counter.swift index a11c140..6c3343c 100644 --- a/TCALoggerSample/TCALoggerSample/Counter/Counter.swift +++ b/TCALoggerSample/TCALoggerSample/Counter/Counter.swift @@ -9,12 +9,12 @@ import ComposableArchitecture import Dependencies import TCALogsSheetKit -public struct Counter: ReducerProtocol { +public struct Counter: Reducer { @Dependency(\.serviceCounter) private var serviceCounter public init() {} - public var body: some ReducerProtocol { + public var body: some Reducer { Reduce { state, action in switch action { case .increase: diff --git a/TCALoggerSample/TCALoggerSample/Emoji/EmojiPicker.swift b/TCALoggerSample/TCALoggerSample/Emoji/EmojiPicker.swift index e1ca239..74d48de 100644 --- a/TCALoggerSample/TCALoggerSample/Emoji/EmojiPicker.swift +++ b/TCALoggerSample/TCALoggerSample/Emoji/EmojiPicker.swift @@ -8,12 +8,12 @@ import ComposableArchitecture import Dependencies -public struct EmojiPicker: ReducerProtocol { +public struct EmojiPicker: Reducer { @Dependency(\.serviceBackgroundChanger) private var serviceBackgroundChanger public init() {} - public var body: some ReducerProtocol { + public var body: some Reducer { Reduce { state, action in switch action { case .changeEmoji: From 890707bef792bcb54d60b4e5a47313a3c771f98b Mon Sep 17 00:00:00 2001 From: Yessen Date: Mon, 21 Aug 2023 14:21:14 +0900 Subject: [PATCH 5/7] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Change=20store=20init?= =?UTF-8?q?=20in=20previews?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/TCALogsSheetKit/Examples/CounterView.swift | 11 +++++++---- .../TCALoggerSample/Counter/CounterView.swift | 7 ++++--- .../TCALoggerSample/Emoji/EmojiPickerView.swift | 7 ++++--- .../TCALoggerSample/TCALoggerSampleApp.swift | 8 +++++++- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Sources/TCALogsSheetKit/Examples/CounterView.swift b/Sources/TCALogsSheetKit/Examples/CounterView.swift index 4c25e8a..e22b890 100644 --- a/Sources/TCALogsSheetKit/Examples/CounterView.swift +++ b/Sources/TCALogsSheetKit/Examples/CounterView.swift @@ -49,9 +49,12 @@ struct CounterView: View { struct CounterView_Previews: PreviewProvider { static var previews: some View { - CounterView(store: Store( - initialState: Counter.State(), - reducer: Counter() - )) + CounterView( + store: .init( + initialState: Counter.State(), + reducer: { + Counter() + }) + ) } } diff --git a/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift b/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift index 111dd8f..cf71393 100644 --- a/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift +++ b/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift @@ -80,8 +80,9 @@ public struct CounterView: View { struct CounterView_Previews: PreviewProvider { static var previews: some View { CounterView(store: Store( - initialState: Counter.State(), - reducer: Counter() - )) + initialState: Counter.State() + ) { + Counter() + }) } } diff --git a/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift b/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift index 22e2874..d0663ca 100644 --- a/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift +++ b/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift @@ -42,7 +42,8 @@ struct EmojiPicker_Previews: PreviewProvider { } static let store: StoreOf = .init( - initialState: .init(), - reducer: EmojiPicker() - ) + initialState: .init() + ) { + EmojiPicker() + } } diff --git a/TCALoggerSample/TCALoggerSample/TCALoggerSampleApp.swift b/TCALoggerSample/TCALoggerSample/TCALoggerSampleApp.swift index 786eeb9..338cdab 100644 --- a/TCALoggerSample/TCALoggerSample/TCALoggerSampleApp.swift +++ b/TCALoggerSample/TCALoggerSample/TCALoggerSampleApp.swift @@ -13,7 +13,13 @@ import ComposableArchitecture struct TCALoggerSampleApp: App { var body: some Scene { WindowGroup { - CounterView(store: Store(initialState: Counter.State(), reducer: Counter())) + CounterView( + store: Store( + initialState: Counter.State() + ) { + Counter() + } + ) } } } From b4c98b91ac7efb18c06282e8be88999d8c90e79e Mon Sep 17 00:00:00 2001 From: Yessen Date: Mon, 21 Aug 2023 14:21:39 +0900 Subject: [PATCH 6/7] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Change=20to=20WithView?= =?UTF-8?q?Store=20in=20EmojiPicker?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Emoji/EmojiPickerView.swift | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift b/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift index d0663ca..fd1a61a 100644 --- a/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift +++ b/TCALoggerSample/TCALoggerSample/Emoji/EmojiPickerView.swift @@ -12,22 +12,24 @@ import ComposableArchitecture // MARK: - View public struct EmojiPickerView: View { - @ObservedObject - private var viewStore: ViewStoreOf private let store: StoreOf public init(store: StoreOf) { - self.viewStore = .init(store) self.store = store } public var body: some View { - VStack(spacing: 20) { - if let currentEmojie = viewStore.currentEmoji { - Text("\(currentEmojie.rawValue)") - } - Button("change emoji") { - viewStore.send(.changeEmoji) + WithViewStore( + store, + observe: \.currentEmoji + ) { viewStore in + VStack(spacing: 20) { + if let currentEmojie = viewStore.state { + Text("\(currentEmojie.rawValue)") + } + Button("change emoji") { + viewStore.send(.changeEmoji) + } } } } From 817d99c01e2d9fd7fad8e7458a36972a4dcffc6f Mon Sep 17 00:00:00 2001 From: Yessen Date: Mon, 21 Aug 2023 14:21:59 +0900 Subject: [PATCH 7/7] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Add=20observer=20to=20?= =?UTF-8?q?WithViewStore=20in=20Views?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sources/TCALogsSheetKit/Examples/CounterView.swift | 5 ++++- TCALoggerSample/TCALoggerSample/Counter/CounterView.swift | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/Sources/TCALogsSheetKit/Examples/CounterView.swift b/Sources/TCALogsSheetKit/Examples/CounterView.swift index e22b890..40cf703 100644 --- a/Sources/TCALogsSheetKit/Examples/CounterView.swift +++ b/Sources/TCALogsSheetKit/Examples/CounterView.swift @@ -15,7 +15,10 @@ struct CounterView: View { @State private var isPresented: Bool = false var body: some View { - WithViewStore(self.store) { store in + WithViewStore( + self.store, + observe: { $0 } + ) { store in NavigationView { VStack { Spacer() diff --git a/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift b/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift index cf71393..af1422b 100644 --- a/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift +++ b/TCALoggerSample/TCALoggerSample/Counter/CounterView.swift @@ -19,7 +19,10 @@ public struct CounterView: View { @State private var isPresented: Bool = false public var body: some View { - WithViewStore(self.store) { store in + WithViewStore( + self.store, + observe: { $0 } + ) { store in NavigationView { VStack(spacing: 20) { Spacer()