From 3b07c1c6f734675d3d88c89bc88631c860ff8a19 Mon Sep 17 00:00:00 2001 From: tornikegomareli Date: Sat, 22 Jun 2024 00:15:27 +0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=99=8F=20Reducer,=20ObservableState=20mac?= =?UTF-8?q?ros.=20Removed=20ViewStore?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../TCA Feature.xctemplate/___FILEBASENAME___+State.swift | 1 + templates/TCA Feature.xctemplate/___FILEBASENAME___.swift | 3 ++- .../TCA Feature.xctemplate/___FILEBASENAME___View.swift | 6 ++---- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/TCA Feature.xctemplate/___FILEBASENAME___+State.swift b/templates/TCA Feature.xctemplate/___FILEBASENAME___+State.swift index 68546a9..c86a8fb 100644 --- a/templates/TCA Feature.xctemplate/___FILEBASENAME___+State.swift +++ b/templates/TCA Feature.xctemplate/___FILEBASENAME___+State.swift @@ -3,6 +3,7 @@ import ComposableArchitecture extension ___VARIABLE_productName:identifier___ { + @ObservableState public struct State: Equatable { public init() { } diff --git a/templates/TCA Feature.xctemplate/___FILEBASENAME___.swift b/templates/TCA Feature.xctemplate/___FILEBASENAME___.swift index 058c59e..b4b7f30 100644 --- a/templates/TCA Feature.xctemplate/___FILEBASENAME___.swift +++ b/templates/TCA Feature.xctemplate/___FILEBASENAME___.swift @@ -2,7 +2,8 @@ import ComposableArchitecture -public struct ___VARIABLE_productName:identifier___: Reducer { +@Reducer +public struct ___VARIABLE_productName:identifier___ { public init() {} diff --git a/templates/TCA Feature.xctemplate/___FILEBASENAME___View.swift b/templates/TCA Feature.xctemplate/___FILEBASENAME___View.swift index 133956f..d74e7a7 100644 --- a/templates/TCA Feature.xctemplate/___FILEBASENAME___View.swift +++ b/templates/TCA Feature.xctemplate/___FILEBASENAME___View.swift @@ -7,12 +7,9 @@ import ComposableArchitecture // MARK: - View public struct ___FILEBASENAMEASIDENTIFIER___: View { - @ObservedObject - private var viewStore: ViewStoreOf<___VARIABLE_productName:identifier___> private let store: StoreOf<___VARIABLE_productName:identifier___> public init(store: StoreOf<___VARIABLE_productName:identifier___>) { - self.viewStore = .init(store, observe: { $0 }) self.store = store } @@ -21,7 +18,7 @@ public struct ___FILEBASENAMEASIDENTIFIER___: View { Text("Hello, ___VARIABLE_productName:identifier___!") } .task { - await viewStore + await store .send(.onAppear) .finish() } @@ -40,3 +37,4 @@ public struct ___FILEBASENAMEASIDENTIFIER___: View { ) ) } +