matchedGeometryEffect doesn't work with PageTabView

Viewed 140
@Namespace var ns

    var body: some View {
        ZStack {
            Color(.black)
            TabView {
                ForEach(0..<5) { i in
                    Text("item \(i)")
                        .foregroundColor(.white)
                        .matchedGeometryEffect(id: i, in: ns)
                        .frame(maxWidth: .infinity)
                }
            }
                .tabViewStyle(PageTabViewStyle(indexDisplayMode: .always))

        }
    }

When I tried to give each TabView item an effect id, it complains Multiple inserted views in matched geometry group Pair<Int, ID>(first: 0, second: SwiftUI.Namespace.ID(id: 180)) have isSource: true, results are undefined.

What's the correct way to assign a matchedGeometryEffect id to items in PageTabView so that I can zoom in and out with transition like the iOS photos app?

Or is it a bug of SwiftUI?

0 Answers
Related