SwiftUI添加自定义UIViewControllerTransitioningDelegate

Wim*_*nsa 15 ios uistoryboardsegue swift swiftui

我正在尝试创建SwiftUI自定义的segue动画,像这样

在此处输入图片说明

我尝试将动画链接到,Destination但没有用,它只是Destination在演示动画完成后在内容内设置动画。

struct ContentView : View {
    var body: some View {
        NavigationView {
            VStack {
                List {
                    NavigationButton(destination: withAnimation{
                        Destination()
                        }.frame(width: 300, height: 300)
                         .animation(.basic())) {
                            CellView()
                        }
                    }
                }
            }

    }
}

struct CellView : View {
    var body: some View {
        VStack {
            Text("Cell")
        }
    }
}

struct Destination : View {
    var body: some View {
        VStack {
            Text("GFD")
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

sug*_*oft 1

你可以尝试删除动画