From 7aa62ee3b0393c3dc94f79de9baa5d692d0ad5d2 Mon Sep 17 00:00:00 2001 From: baegteun Date: Fri, 24 May 2024 00:25:24 +0900 Subject: [PATCH 1/2] :lipstick: :: [#326] DesignSystem / SMSSegmentedControl --- .../SMSSegmentedControl.swift | 55 +++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift diff --git a/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift b/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift new file mode 100644 index 00000000..5cf56786 --- /dev/null +++ b/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift @@ -0,0 +1,55 @@ +import SwiftUI + +public struct SMSSegmentedControl: View { + @State private var selectedIndex = 0 + @Namespace private var segmentNamespace + private let options: [String] + private let onSelect: (String) -> Void + + public init( + options: [String], + onSelect: @escaping (String) -> Void + ) { + self.options = options + self.onSelect = onSelect + } + + public var body: some View { + HStack(spacing: 0) { + ForEach(0.. Date: Fri, 24 May 2024 08:49:07 +0900 Subject: [PATCH 2/2] Update SMSSegmentedControl.swift Co-authored-by: uuuunseo <105629604+uuuunseo@users.noreply.github.com> --- .../Sources/SegmentedControl/SMSSegmentedControl.swift | 3 --- 1 file changed, 3 deletions(-) diff --git a/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift b/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift index 5cf56786..2f176e34 100644 --- a/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift +++ b/Projects/Core/DesignSystem/Sources/SegmentedControl/SMSSegmentedControl.swift @@ -50,6 +50,3 @@ public struct SMSSegmentedControl: View { } } -#Preview { - SMSSegmentedControl(options: ["True", "False"]) { _ in } -}