diff --git a/app-ios/Sources/ContributorFeature/ContributorReducer.swift b/app-ios/Sources/ContributorFeature/ContributorReducer.swift index cd35c86ed..67465b369 100644 --- a/app-ios/Sources/ContributorFeature/ContributorReducer.swift +++ b/app-ios/Sources/ContributorFeature/ContributorReducer.swift @@ -18,7 +18,7 @@ public struct ContributorReducer: Sendable { } } - public enum Action: Sendable, BindableAction { + public enum Action: Sendable, BindableAction, ViewAction { case binding(BindingAction) case onAppear case response(Result<[Contributor], any Error>) diff --git a/app-ios/Sources/ContributorFeature/ContributorView.swift b/app-ios/Sources/ContributorFeature/ContributorView.swift index 2188d28f5..67a43da1a 100644 --- a/app-ios/Sources/ContributorFeature/ContributorView.swift +++ b/app-ios/Sources/ContributorFeature/ContributorView.swift @@ -5,6 +5,7 @@ import Theme import shared import CommonComponents +@ViewAction(for: ContributorReducer.self) public struct ContributorView: View { private enum ViewType: String, CaseIterable { case swift @@ -27,7 +28,7 @@ public struct ContributorView: View { @State private var selectedTab: ViewType = .swift @Namespace var namespace - @Bindable var store: StoreOf + @Bindable public var store: StoreOf public init(store: StoreOf) { self.store = store @@ -43,7 +44,7 @@ public struct ContributorView: View { case .kmpPresenter: KmpPresenterContributorView { - store.send(.view(.contributorButtonTapped($0))) + send(.contributorButtonTapped($0)) } .tag(ViewType.kmpPresenter) case .fullKmp: @@ -51,7 +52,7 @@ public struct ContributorView: View { guard let url = URL(string: urlString) else { return } - store.send(.view(.contributorButtonTapped(url))) + send(.contributorButtonTapped(url)) } } } diff --git a/app-ios/Sources/SponsorFeature/SponsorReducer.swift b/app-ios/Sources/SponsorFeature/SponsorReducer.swift index 42cfe359e..5ff64a6db 100644 --- a/app-ios/Sources/SponsorFeature/SponsorReducer.swift +++ b/app-ios/Sources/SponsorFeature/SponsorReducer.swift @@ -19,7 +19,7 @@ public struct SponsorReducer : Sendable { public init() { } } - public enum Action : Sendable, BindableAction { + public enum Action: Sendable, BindableAction, ViewAction { case binding(BindingAction) case response(Result<[Sponsor], any Error>) case view(View) diff --git a/app-ios/Sources/SponsorFeature/SponsorView.swift b/app-ios/Sources/SponsorFeature/SponsorView.swift index 052482c79..327377fb4 100644 --- a/app-ios/Sources/SponsorFeature/SponsorView.swift +++ b/app-ios/Sources/SponsorFeature/SponsorView.swift @@ -4,8 +4,9 @@ import Theme import Model import CommonComponents +@ViewAction(for: SponsorReducer.self) public struct SponsorView: View { - @Bindable private var store: StoreOf + @Bindable public var store: StoreOf public init(store: StoreOf) { self.store = store @@ -39,7 +40,7 @@ public struct SponsorView: View { } .background(AssetColors.Surface.surface.swiftUIColor) .onAppear { - store.send(.view(.onAppear)) + send(.onAppear) } .navigationBarTitleDisplayMode(.large) .navigationTitle(String(localized: "Sponsor", bundle: .module)) @@ -60,7 +61,7 @@ public struct SponsorView: View { ZStack { Color.white.clipShape(RoundedRectangle(cornerRadius: 12)) Button { - store.send(.view(.sponsorTapped(item.link))) + send(.sponsorTapped(item.link)) } label: { AsyncImage(url: item.logo) { $0.image? diff --git a/app-ios/Sources/StaffFeature/StaffReducer.swift b/app-ios/Sources/StaffFeature/StaffReducer.swift index 517d2e4a9..c590570e5 100644 --- a/app-ios/Sources/StaffFeature/StaffReducer.swift +++ b/app-ios/Sources/StaffFeature/StaffReducer.swift @@ -16,9 +16,13 @@ public struct StaffReducer : Sendable { public init() { } } - public enum Action : Sendable { - case onAppear + public enum Action: Sendable, ViewAction { + case view(View) case response(Result<[Model.Staff], any Error>) + + public enum View: Sendable { + case onAppear + } } public var body: some ReducerOf { @@ -26,7 +30,7 @@ public struct StaffReducer : Sendable { enum CancelID { case connection } switch action { - case .onAppear: + case .view(.onAppear): return .run { send in do { for try await staffs in try staffsData.streamStaffs() { diff --git a/app-ios/Sources/StaffFeature/StaffView.swift b/app-ios/Sources/StaffFeature/StaffView.swift index d5d9f8235..cd329f219 100644 --- a/app-ios/Sources/StaffFeature/StaffView.swift +++ b/app-ios/Sources/StaffFeature/StaffView.swift @@ -4,8 +4,9 @@ import Theme import CommonComponents import Model +@ViewAction(for: StaffReducer.self) public struct StaffView: View { - private let store: StoreOf + public let store: StoreOf @State private var selectedStaffData: Staff? public init(store: StoreOf) { @@ -28,7 +29,7 @@ public struct StaffView: View { } .background(AssetColors.Surface.surface.swiftUIColor) .onAppear { - store.send(.onAppear) + send(.onAppear) } .navigationBarTitleDisplayMode(.large) .navigationTitle(String(localized: "Staff", bundle: .module)) diff --git a/app-ios/Tests/StaffFeatureTests/StaffFeatureTests.swift b/app-ios/Tests/StaffFeatureTests/StaffFeatureTests.swift index a04b34198..58ee53362 100644 --- a/app-ios/Tests/StaffFeatureTests/StaffFeatureTests.swift +++ b/app-ios/Tests/StaffFeatureTests/StaffFeatureTests.swift @@ -23,7 +23,7 @@ final class StaffFeatureTests: XCTestCase { } } } - await store.send(.onAppear) + await store.send(.view(.onAppear)) await store.receive(\.response.success) { $0.list = [.init(id: 0, name: "testValue", icon: .init(string: "https://avatars.githubusercontent.com/u/10727543?s=200&v=4")!, github: .init(string: "https://2024.droidkaigi.jp/")!)] }