@@ -33,7 +33,7 @@ struct ClothCardView: View {
3333 ProgressView ( )
3434 case . success( let image) :
3535 image. resizable ( ) . scaledToFit ( )
36- case . failure( let error ) :
36+ case . failure:
3737 Image ( systemName: " exclamationmark.triangle " )
3838 . foregroundColor ( . gray)
3939 @unknown default :
@@ -169,10 +169,10 @@ struct CodiClothCarouselView: View {
169169 )
170170 }
171171 . onChange ( of: currentIndex) { newValue in
172- withAnimation ( . spring( ) ) {
173- proxy. scrollTo ( newValue, anchor: . center)
174- }
175- }
172+ withAnimation ( . spring( ) ) {
173+ proxy. scrollTo ( newValue, anchor: . center)
174+ }
175+ }
176176 . scrollDisabled ( isEmptyState)
177177 . onAppear {
178178 proxy. scrollTo ( currentIndex, anchor: . center)
@@ -188,54 +188,14 @@ struct CodiClothCarouselView: View {
188188 }
189189}
190190
191- //struct CodiClothView: View {
192- // let title: String
193- // let items: [HomeClothEntity]
194- // let isEmptyState: Bool
195- // var onIndexChanged: ((Int) -> Void)?
196- //
197- // // Carousel 설정
198- // let spacing: CGFloat = 12
199- // let activeScale: CGFloat = 1.0
200- // let inactiveScale: CGFloat = 0.85
201- //
202- // @State private var currentIndex: Int
203- //
204- // init(title: String, items: [HomeClothEntity], isEmptyState: Bool, onIndexChanged: ((Int) -> Void)? = nil) {
205- // self.title = title
206- // self.items = items
207- // self.isEmptyState = isEmptyState
208- // self.onIndexChanged = onIndexChanged
209- //
210- // let initialIndex = isEmptyState ? 1 : 0
211- // _currentIndex = State(initialValue: initialIndex)
212- // }
213- //
214- // var body: some View {
215- // HStack(spacing: 8) {
216- // ZStack(alignment: .topLeading) {
217- // CodiClothCarouselView(
218- // items: items,
219- // currentIndex: $currentIndex,
220- // spacing: spacing,
221- // activeScale: activeScale,
222- // inactiveScale: inactiveScale,
223- // isEmptyState: isEmptyState
224- // )
225- // .onChange(of: currentIndex) { newValue in
226- // onIndexChanged?(newValue)
227- // }
228191struct CodiClothView : View {
229192 let title : String
230193 let items : [ HomeClothEntity ]
231194 let isEmptyState : Bool
232- // var onIndexChanged: ((Int) -> Void)?
233- //
234- // Carousel 설정
235- let spacing : CGFloat = 12
236- let activeScale : CGFloat = 1.0
237- let inactiveScale : CGFloat = 0.85
238- // 추가: 외부에서 주입받는 인덱스
195+
196+ let spacing : CGFloat = 12
197+ let activeScale : CGFloat = 1.0
198+ let inactiveScale : CGFloat = 0.85
239199 let selectedIndex : Int
240200 var onIndexChanged : ( ( Int ) -> Void ) ?
241201
@@ -247,7 +207,7 @@ struct CodiClothView: View {
247207 self . isEmptyState = isEmptyState
248208 self . selectedIndex = selectedIndex
249209 self . onIndexChanged = onIndexChanged
250-
210+
251211 // 초기값 설정: 비어있으면 1(중앙), 아니면 전달받은 selectedIndex 사용
252212 let initialIndex = isEmptyState ? 1 : selectedIndex
253213 _currentIndex = State ( initialValue: initialIndex)
0 commit comments