From 43b127f1e0b18ef407ad9e0a6bf93a6883f5fa8f Mon Sep 17 00:00:00 2001 From: yungu0010 Date: Fri, 19 Apr 2024 14:10:06 +0900 Subject: [PATCH] =?UTF-8?q?[Add]=20#252=20-=20=EC=BB=A4=EC=8A=A4=ED=85=80?= =?UTF-8?q?=20=EC=B2=B4=ED=81=AC=EB=B0=95=EC=8A=A4=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Components/CheckboxToggleStyle.swift | 23 +++++++++++++------ 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/iOS-NOTTODO/Widget-NOTTODO/Common/Components/CheckboxToggleStyle.swift b/iOS-NOTTODO/Widget-NOTTODO/Common/Components/CheckboxToggleStyle.swift index 6538ae2..130cee0 100644 --- a/iOS-NOTTODO/Widget-NOTTODO/Common/Components/CheckboxToggleStyle.swift +++ b/iOS-NOTTODO/Widget-NOTTODO/Common/Components/CheckboxToggleStyle.swift @@ -7,12 +7,21 @@ import SwiftUI -struct CheckboxToggleStyle: View { - var body: some View { - Text(/*@START_MENU_TOKEN@*/"Hello, World!"/*@END_MENU_TOKEN@*/) +struct CheckboxToggleStyle: ToggleStyle { + @Environment(\.isEnabled) var isEnabled + + func makeBody(configuration: Configuration) -> some View { + Button(action: { + configuration.isOn.toggle() + }, label: { + HStack { + Image(configuration.isOn ? .btnSmallBoxFill : .btnSmallBox) + .imageScale(.large) + configuration.label + } + }) + .buttonStyle(.plain) + .frame(width: 16, height: 16) + .disabled(!isEnabled) } } - -#Preview { - CheckboxToggleStyle() -}