From e83f10459c7c38983907bb7ba9c7c86a30dbbdba Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Fri, 7 Feb 2025 16:23:16 +0900 Subject: [PATCH] =?UTF-8?q?[#84]=20toggle=20.onChange=20=EC=95=A1=EC=85=98?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 버전이슈 해결 필요 --- .../Feature/Setting/View/ListRowView.swift | 13 ++++++++++++- .../Feature/Setting/View/SettingView.swift | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/Soomsil-USaint/Application/Feature/Setting/View/ListRowView.swift b/Soomsil-USaint/Application/Feature/Setting/View/ListRowView.swift index c688e67..0845fb3 100644 --- a/Soomsil-USaint/Application/Feature/Setting/View/ListRowView.swift +++ b/Soomsil-USaint/Application/Feature/Setting/View/ListRowView.swift @@ -60,7 +60,12 @@ struct ItemModel: View { .onChanged { _ in isPressed = true } .onEnded { _ in isPressed = false - action() + switch rightItem { + case .none: + action() + case .toggle(let isPushAuthorizationEnabled): + return + } } ) @@ -75,6 +80,12 @@ struct ItemModel: View { .tint(YDSColor.buttonPoint) .frame(height: 48) // TODO: onChange 액션 추가 + .onChange(of: isPushAuthorizationEnabled) { + action() + } +// .onReceive(isPushAuthorizationEnabled.projectedValue) { newValue in +// action() +// } } } } diff --git a/Soomsil-USaint/Application/Feature/Setting/View/SettingView.swift b/Soomsil-USaint/Application/Feature/Setting/View/SettingView.swift index 6895e95..1159796 100644 --- a/Soomsil-USaint/Application/Feature/Setting/View/SettingView.swift +++ b/Soomsil-USaint/Application/Feature/Setting/View/SettingView.swift @@ -65,6 +65,7 @@ struct SettingView: View { ), action: { // TODO: onChange 호출시 액션 전달 + listItemTapped(.toggleAuthorization(isPushAuthorizationEnabled)) } ) ])