ARTICLE AD BOX
I was using with satisfaction the snippet by @ChrisR from his post Carousel SwiftUI until I upgraded my iPhone and iPad to iOS26.2
In Chris' example I substituted the Coloured Rounded rectangles with scrollable list views. And to me, that has done fine for a while. Also it is doing quite OK on simulators.
But after upgrading to iOS26.2 the functioning has become erratic on physical devices. It seems there is conflict of gesture detection between the carousel and the list. Is this specific to iOS26.2 or I just did not notice before ?
Is there another way to achieve the same ?
Here is the amended snippet from @ChrisR (thanks to him):
import SwiftUI import Combine struct Item: Identifiable { var id: Int var objList: [String] } class Store: ObservableObject { @Published var items: [Item] init() { items = [] items.append(Item(id: 0, objList: ["Dog", "Cat", "Fish", "Bird", "Reptile", "Amphibian", "Insect", "Mollusk", "Crustacean"])) items.append(Item(id: 1, objList: ["House", "Car", "Table", "Chair", "TVset" ])) items.append(Item(id:2, objList: ["Apple", "Banana", "Orange", "Pineapple", "Strawberry", "Blueberry", "Cherry", "Grapes", "Mango"])) } } struct ContentView: View { @StateObject var store = Store() @State private var snappedItem = 0.0 @State private var draggingItem = 0.0 @State private var viewWidth: CGFloat = 0.0 var body: some View { GeometryReader { proxy in ZStack { ForEach(store.items) { item in List(item.objList, id: \.self) {l in Text(l) .font(.title2) } .frame(width: proxy.size.width, height: proxy.size.height) .opacity(1.0 - abs(distance(item.id)) * 0.3 ) .offset(x: myXOffset(item.id), y: 0) .zIndex(1.0 - abs(distance(item.id)) * 0.1) } } .onAppear { viewWidth = proxy.size.width } .simultaneousGesture( DragGesture() .onChanged { value in if value.translation.width > 50 { // <-- added this condition here. See first comment below. draggingItem = snappedItem + value.translation.width / 200 } } .onEnded { value in withAnimation(.interpolatingSpring(stiffness: 300, damping: 30, initialVelocity: 10)) { draggingItem = snappedItem + value.translation.width / 200 draggingItem = round(draggingItem).remainder(dividingBy: Double(store.items.count)) snappedItem = draggingItem } } ) } } func distance(_ item: Int) -> Double { return (draggingItem - Double(item)).remainder(dividingBy: Double(store.items.count)) } func myXOffset(_ item: Int) -> Double { let angle = Double.pi * 2 / Double(store.items.count) * distance(item) return sin(angle) * viewWidth } }