From b05826e41232953d3debc704dbb0c3fb31b86969 Mon Sep 17 00:00:00 2001 From: baegteun Date: Sun, 26 May 2024 22:42:58 +0900 Subject: [PATCH] =?UTF-8?q?:recycle:=20::=20[#336]=20SMSSegmentedControl?= =?UTF-8?q?=20/=20=EC=99=B8=EB=B6=80=EC=97=90=EC=84=9C=20selected=20option?= =?UTF-8?q?=EC=9D=84=20=EC=A0=9C=EC=96=B4=20=EA=B0=80=EB=8A=A5=ED=95=98?= =?UTF-8?q?=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../SegmentedControl/SMSSegmentedControl.swift | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift b/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift index 2f176e34..101aba28 100644 --- a/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift +++ b/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift @@ -1,23 +1,26 @@ import SwiftUI public struct SMSSegmentedControl: View { - @State private var selectedIndex = 0 @Namespace private var segmentNamespace private let options: [String] + private let selectedOption: String? private let onSelect: (String) -> Void public init( options: [String], + selectedOption: String? = nil, onSelect: @escaping (String) -> Void ) { self.options = options + self.selectedOption = selectedOption self.onSelect = onSelect } public var body: some View { HStack(spacing: 0) { ForEach(0..